summary refs log tree commit diff
diff options
context:
space:
mode:
authorIzorkin <Izorkin@gmail.com>2018-06-10 23:50:36 +0300
committerxeji <36407913+xeji@users.noreply.github.com>2018-06-10 22:50:36 +0200
commit35ce5c1c8e5228f43cde083f897ac9da9f24031c (patch)
tree4742e1422358db085d0af76de11772a845fe51b6
parent67b6b251347c287dd311d27a467c5dc5dd42e794 (diff)
downloadnixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar.gz
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar.bz2
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar.lz
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar.xz
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.tar.zst
nixpkgs-35ce5c1c8e5228f43cde083f897ac9da9f24031c.zip
maxscale: init at 2.1.17 (#33835)
-rw-r--r--lib/licenses.nix10
-rw-r--r--pkgs/tools/networking/maxscale/default.nix87
-rw-r--r--pkgs/tools/networking/maxscale/getopt.patch11
-rw-r--r--pkgs/top-level/all-packages.nix4
4 files changed, 112 insertions, 0 deletions
diff --git a/lib/licenses.nix b/lib/licenses.nix
index 767fd89b948..a0b0f8727af 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -99,6 +99,16 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
     fullName = ''BSD 4-clause "Original" or "Old" License'';
   };
 
+  bsl10 = {
+    fullName = "Business Source License 1.0";
+    url = https://mariadb.com/bsl10;
+  };
+
+  bsl11 = {
+    fullName = "Business Source License 1.1";
+    url = https://mariadb.com/bsl11;
+  };
+
   clArtistic = spdx {
     spdxId = "ClArtistic";
     fullName = "Clarified Artistic License";
diff --git a/pkgs/tools/networking/maxscale/default.nix b/pkgs/tools/networking/maxscale/default.nix
new file mode 100644
index 00000000000..425e531419e
--- /dev/null
+++ b/pkgs/tools/networking/maxscale/default.nix
@@ -0,0 +1,87 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, gcc, glibc
+, bison2, curl, flex, gperftools, jansson, jemalloc, kerberos, lua, mariadb
+, ncurses, openssl, pcre, pcre2, perl, rabbitmq-c, sqlite, tcl
+, libaio, libedit, libtool, libui, libuuid, zlib
+}:
+
+stdenv.mkDerivation rec {
+  name = "maxscale-${version}";
+  version = "2.1.17";
+
+  src = fetchFromGitHub {
+    owner = "mariadb-corporation";
+    repo = "MaxScale";
+    rev = "${name}";
+    sha256 = "161kc6aqqj3z509q4qwvsd86h06hlyzdask4gawn2ij0h3ca58q6";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [
+    bison2 curl flex gperftools jansson jemalloc kerberos lua mariadb.connector-c
+    ncurses openssl pcre pcre2 perl rabbitmq-c sqlite tcl
+    libaio libedit libtool libui libuuid zlib
+  ];
+
+  patches = [ ./getopt.patch ];
+
+  preConfigure = ''
+    for i in `grep -l -R '#include <getopt.h>' .`; do
+      substituteInPlace $i --replace "#include <getopt.h>" "#include <${glibc.dev}/include/getopt.h>"
+    done
+ '';
+
+  cmakeFlags = [
+    "-DUSE_C99=YES"
+    "-DDEFAULT_ADMIN_USER=root"
+    "-DWITH_MAXSCALE_CNF=YES"
+    "-DSTATIC_EMBEDDED=YES"
+    "-DBUILD_RABBITMQ=YES"
+    "-DBUILD_BINLOG=YES"
+    "-DBUILD_CDC=NO"
+    "-DBUILD_MMMON=YES"
+    "-DBUILD_LUAFILTER=YES"
+    "-DLUA_LIBRARIES=${lua}/lib"
+    "-DLUA_INCLUDE_DIR=${lua}/include"
+    "-DGCOV=NO"
+    "-DWITH_SCRIPTS=OFF"
+    "-DBUILD_TESTS=NO"
+    "-DBUILD_TOOLS=NO"
+    "-DPROFILE=NO"
+    "-DWITH_TCMALLOC=YES"
+    "-DWITH_JEMALLOC=YES"
+    "-DINSTALL_EXPERIMENTAL=YES"
+    "-DTARGET_COMPONENT=all"
+  ];
+
+  CFLAGS = "-std=gnu99";
+
+  enableParallelBuilding = false;
+
+  dontStrip = true;
+
+  postInstall = ''
+    find $out/bin -type f -perm -0100 | while read f1; do
+      patchelf \
+        --set-rpath "$(patchelf --print-rpath $f1):${mariadb.connector-c}/lib/mariadb:$out/lib/maxscale" \
+        --set-interpreter "$(cat ${stdenv.cc}/nix-support/dynamic-linker)" $f1 \
+        && patchelf --shrink-rpath $f1
+    done
+
+    find $out/lib/maxscale -type f -perm -0100 | while read f2; do
+      patchelf \
+        --set-rpath "$(patchelf --print-rpath $f2)":$out/lib/maxscale $f2
+    done
+
+    mv $out/share/maxscale/create_grants $out/bin
+    rm -rf $out/{etc,var}
+  '';
+
+  meta = with stdenv.lib; {
+     description = ''MaxScale database proxy extends MariaDB Server's high availability'';
+     homepage = https://mariadb.com/products/technology/maxscale;
+     license = licenses.bsl11;
+     platforms = platforms.linux;
+     maintainers = with maintainers; [ izorkin ];
+ };
+}
diff --git a/pkgs/tools/networking/maxscale/getopt.patch b/pkgs/tools/networking/maxscale/getopt.patch
new file mode 100644
index 00000000000..db09a8e8f1e
--- /dev/null
+++ b/pkgs/tools/networking/maxscale/getopt.patch
@@ -0,0 +1,11 @@
+--- a/server/core/maxpasswd.c   2018-01-12 05:06:49.000000000 -0500
++++ b/server/core/maxpasswd.c   2018-01-12 06:50:18.518000000 -0500
+@@ -25,6 +25,7 @@
+
+ #include <maxscale/cdefs.h>
+
++#include <getopt.h>
+ #include <stdio.h>
+ #include <errno.h>
+ #include <sys/stat.h>
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5e138285e82..4d6703eb295 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17226,6 +17226,10 @@ with pkgs;
 
   maxlib = callPackage ../applications/audio/pd-plugins/maxlib { };
 
+  maxscale = callPackage ../tools/networking/maxscale {
+    stdenv = overrideCC stdenv gcc6;
+  };
+
   pdfdiff = callPackage ../applications/misc/pdfdiff { };
 
   mupdf = callPackage ../applications/misc/mupdf { };