Skip to content

Commit

Permalink
mariadb: fix darwin build
Browse files Browse the repository at this point in the history
  • Loading branch information
LnL7 authored and globin committed Jan 6, 2018
1 parent cb506e6 commit 106d87b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
17 changes: 17 additions & 0 deletions pkgs/servers/sql/mariadb/clang-isfinite.patch
@@ -0,0 +1,17 @@
diff --git a/include/my_global.h b/include/my_global.h
index cb31ae2..2866f87 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -803,12 +803,6 @@ inline unsigned long long my_double2ulonglong(double d)
#endif

#ifndef isfinite
-#ifdef HAVE_FINITE
-#define isfinite(x) finite(x)
-#else
-#define finite(x) (1.0 / fabs(x) > 0.0)
-#endif /* HAVE_FINITE */
-#elif (__cplusplus >= 201103L)
#include <cmath>
static inline bool isfinite(double x) { return std::isfinite(x); }
#endif /* isfinite */
9 changes: 6 additions & 3 deletions pkgs/servers/sql/mariadb/default.nix
Expand Up @@ -34,7 +34,8 @@ common = rec { # attributes common to both builds
sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt
'';

patches = [ ./cmake-includedir.patch ];
patches = [ ./cmake-includedir.patch ]
++ stdenv.lib.optional stdenv.cc.isClang ./clang-isfinite.patch;

cmakeFlags = [
"-DBUILD_CONFIG=mysql_release"
Expand Down Expand Up @@ -121,7 +122,8 @@ everything = stdenv.mkDerivation (common // {
buildInputs = common.buildInputs ++ [
xz lzo lz4 bzip2 snappy
libxml2 boost judy libevent cracklib
] ++ optionals (stdenv.isLinux && !stdenv.isArm) [ numactl ];
] ++ optional (stdenv.isLinux && !stdenv.isArm) numactl
++ optional stdenv.isDarwin libiconv;

cmakeFlags = common.cmakeFlags ++ [
"-DMYSQL_DATADIR=/var/lib/mysql"
Expand Down Expand Up @@ -159,7 +161,8 @@ everything = stdenv.mkDerivation (common // {
rm "$out"/bin/rcmysql
'';

CXXFLAGS = optionalString stdenv.isi686 "-fpermissive";
CXXFLAGS = optionalString stdenv.isi686 "-fpermissive"
+ optionalString stdenv.isDarwin " -std=c++11";
});

connector-c = stdenv.mkDerivation rec {
Expand Down

0 comments on commit 106d87b

Please sign in to comment.