summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorPatrick Mahoney <pat@polycrystal.org>2014-04-30 09:54:35 -0500
committerPatrick Mahoney <pat@polycrystal.org>2014-08-30 14:41:51 -0500
commit1e06594c0c70f618887e1ddaba35b4e165b448d5 (patch)
tree9cb82f2ca97d5f448bdadf0d8861f0424b305337 /pkgs
parentb8fca7b38c38fe28dc8bfe3d3e566581f296e03a (diff)
downloadnixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar.gz
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar.bz2
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar.lz
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar.xz
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.tar.zst
nixlib-1e06594c0c70f618887e1ddaba35b4e165b448d5.zip
mariadb: Patch to compile on OS X.
* perl is required at build time on darwin. Copied from the
  mysql/5.5.x.nix

* CMake on darwin creates shared libraries with relative 'install_name'
  paths which are made absolute by fixDarwinDylibNames.

  See http://answers.opencv.org/question/4134/cmake-install_name_tool-absolute-path-for-library/

* The asm patch was needed to compile on darwin, though I do not
  understand what is going on. Error before the patch:

  [ 15%] Building C object mysys/CMakeFiles/mysys.dir/my_context.c.o
  .../nix-build-mariadb-10.0.13.drv-1/mariadb-10.0.13/mysys/my_context.c:207:Unknown pseudo-op: .cfi_escape
  .../nix-build-mariadb-10.0.13.drv-1/mariadb-10.0.13/mysys/my_context.c:207:Rest of line ignored. 1st junk character valued 48 (0).
  make[2]: *** [mysys/CMakeFiles/mysys.dir/my_context.c.o] Error 1
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/servers/sql/mariadb/default.nix17
-rw-r--r--pkgs/servers/sql/mariadb/my_context_asm.patch18
2 files changed, 33 insertions, 2 deletions
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index bb0c0bc8da86..0efdd542fa4e 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ncurses, openssl, bison, boost, libxml2, libaio, judy, libevent, groff }:
+{ stdenv, fetchurl, cmake, ncurses, openssl, bison, boost, libxml2, libaio, judy, libevent, groff, perl, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   name = "mariadb-${version}";
@@ -9,12 +9,25 @@ stdenv.mkDerivation rec {
     sha256 = "039wz89vs03a27anpshj5xaqknm7cqi7mrypvwingqkq26ns0mhs";
   };
 
-  buildInputs = [ cmake ncurses openssl bison boost libxml2 libaio judy libevent groff ];
+  buildInputs = [ cmake ncurses openssl bison boost libxml2 judy libevent groff ]
+     ++ stdenv.lib.optional (!stdenv.isDarwin) libaio
+     ++ stdenv.lib.optionals stdenv.isDarwin [ perl fixDarwinDylibNames ];
+
+  patches = stdenv.lib.optional stdenv.isDarwin ./my_context_asm.patch;
 
   cmakeFlags = [ "-DWITH_READLINE=yes" "-DWITH_EMBEDDED_SERVER=yes" "-DINSTALL_SCRIPTDIR=bin" ];
 
   enableParallelBuilding = true;
 
+  prePatch = ''
+    substituteInPlace cmake/libutils.cmake \
+      --replace /usr/bin/libtool libtool
+  '';
+  postInstall = ''
+    substituteInPlace $out/bin/mysql_install_db \
+      --replace basedir=\"\" basedir=\"$out\"
+  '';
+
   passthru.mysqlVersion = "5.5";
 
   meta = {
diff --git a/pkgs/servers/sql/mariadb/my_context_asm.patch b/pkgs/servers/sql/mariadb/my_context_asm.patch
new file mode 100644
index 000000000000..3a747ed1b03c
--- /dev/null
+++ b/pkgs/servers/sql/mariadb/my_context_asm.patch
@@ -0,0 +1,18 @@
+--- a/mysys/my_context.c
++++ b/mysys/my_context.c
+@@ -206,15 +206,6 @@ my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
+     (
+      "movq %%rsp, (%[save])\n\t"
+      "movq %[stack], %%rsp\n\t"
+-#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 && !defined(__INTEL_COMPILER)
+-     /*
+-       This emits a DWARF DW_CFA_undefined directive to make the return address
+-       undefined. This indicates that this is the top of the stack frame, and
+-       helps tools that use DWARF stack unwinding to obtain stack traces.
+-       (I use numeric constant to avoid a dependency on libdwarf includes).
+-     */
+-     ".cfi_escape 0x07, 16\n\t"
+-#endif
+      "movq %%rbp, 8(%[save])\n\t"
+      "movq %%rbx, 16(%[save])\n\t"
+      "movq %%r12, 24(%[save])\n\t"