nixpkgs/pkgs/servers/sql/mariadb/default.nix
Patrick Mahoney 1e06594c0c 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
2014-08-30 14:41:51 -05:00

41 lines
1.3 KiB
Nix

{ stdenv, fetchurl, cmake, ncurses, openssl, bison, boost, libxml2, libaio, judy, libevent, groff, perl, fixDarwinDylibNames }:
stdenv.mkDerivation rec {
name = "mariadb-${version}";
version = "10.0.13";
src = fetchurl {
url = "https://downloads.mariadb.org/interstitial/mariadb-${version}/source/mariadb-${version}.tar.gz";
sha256 = "039wz89vs03a27anpshj5xaqknm7cqi7mrypvwingqkq26ns0mhs";
};
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 = {
description = "An enhanced, drop-in replacement for MySQL";
homepage = https://mariadb.org/;
license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [ shlevy thoughtpolice ];
platforms = stdenv.lib.platforms.all;
};
}