From 789c0614f06e0ea98193e20fa726e87554cd8e88 Mon Sep 17 00:00:00 2001 From: Izorkin Date: Fri, 29 Dec 2017 20:28:53 +0300 Subject: [PATCH] mariadb galera: init at 25.3.23 --- pkgs/servers/sql/mariadb/default.nix | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix index 66125b353783..19154bd655ea 100644 --- a/pkgs/servers/sql/mariadb/default.nix +++ b/pkgs/servers/sql/mariadb/default.nix @@ -2,6 +2,7 @@ , openssl, pcre, boost, judy, bison, libxml2 , libaio, libevent, groff, jemalloc, cracklib, systemd, numactl, perl , fixDarwinDylibNames, cctools, CoreServices +, asio, buildEnv, check, qt4, scons }: with stdenv.lib; @@ -12,6 +13,12 @@ mariadb = everything // { inherit client; # libmysqlclient.so in .out, necessary headers in .dev and utils in .bin server = everything; # a full single-output build, including everything in `client` again inherit connector-c; # libmysqlclient.so + inherit galera; +}; + +galeraLibs = buildEnv { + name = "galera-lib-inputs-united"; + paths = [ openssl.out boost check ]; }; common = rec { # attributes common to both builds @@ -146,6 +153,7 @@ everything = stdenv.mkDerivation (common // { "-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1" "-DWITHOUT_FEDERATED_STORAGE_ENGINE=1" "-DWITH_WSREP=ON" + "-DWITH_INNODB_DISALLOW_WRITES=ON" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "-DWITHOUT_OQGRAPH_STORAGE_ENGINE=1" "-DWITHOUT_TOKUDB=1" @@ -155,6 +163,7 @@ everything = stdenv.mkDerivation (common // { rm -r "$out"/{mysql-test,sql-bench,data} # Don't need testing data rm "$out"/share/man/man1/mysql-test-run.pl.1 rm "$out"/bin/rcmysql + sed -i 's/-mariadb/-mysql/' "$out"/bin/galera_new_cluster ''; CXXFLAGS = optionalString stdenv.isi686 "-fpermissive"; @@ -195,4 +204,52 @@ connector-c = stdenv.mkDerivation rec { }; }; +galera = stdenv.mkDerivation rec { + name = "mariadb-galera-${version}"; + version = "25.3.23"; + + src = fetchurl { + url = "https://mirrors.nxthost.com/mariadb/mariadb-10.2.14/galera-${version}/src/galera-${version}.tar.gz"; + sha256 = "11pfc85z29jk0h6g6bmi3hdv4in4yb00xsr2r0qm1b0y7m2wq3ra"; + }; + + buildInputs = [ asio boost check openssl qt4 scons ]; + + patchPhase = '' + substituteInPlace SConstruct \ + --replace "boost_library_path = '''" "boost_library_path = '${boost}/lib'" + ''; + + preConfigure = '' + export CPPFLAGS="-I${asio}/include -I${boost.dev}/include -I${check}/include -I${openssl.dev}/include" + export LIBPATH="${galeraLibs}/lib" + ''; + + buildPhase = '' + scons -j$NIX_BUILD_CORES ssl=1 system_asio=1 strict_build_flags=0 + ''; + + installPhase = '' + # copied with modifications from scripts/packages/freebsd.sh + GALERA_LICENSE_DIR="$share/licenses/${name}" + install -d $out/{bin,lib/galera,share/doc/galera,$GALERA_LICENSE_DIR} + install -m 555 "garb/garbd" "$out/bin/garbd" + install -m 444 "libgalera_smm.so" "$out/lib/galera/libgalera_smm.so" + install -m 444 "scripts/packages/README" "$out/share/doc/galera/" + install -m 444 "scripts/packages/README-MySQL" "$out/share/doc/galera/" + install -m 444 "scripts/packages/freebsd/LICENSE" "$out/$GALERA_LICENSE_DIR" + install -m 444 "LICENSE" "$out/$GALERA_LICENSE_DIR/GPLv2" + install -m 444 "asio/LICENSE_1_0.txt" "$out/$GALERA_LICENSE_DIR/LICENSE.asio" + install -m 444 "www.evanjones.ca/LICENSE" "$out/$GALERA_LICENSE_DIR/LICENSE.crc32c" + install -m 444 "chromium/LICENSE" "$out/$GALERA_LICENSE_DIR/LICENSE.chromium" + ''; + + meta = { + description = "Galera 3 wsrep provider library"; + homepage = http://galeracluster.com/; + license = licenses.lgpl2; + maintainers = with maintainers; [ izorkin ]; + platforms = platforms.all; + }; +}; in mariadb