From c8488b913a285b72bb9dc090f2903762b11ac9ce Mon Sep 17 00:00:00 2001 From: Izorkin Date: Thu, 1 Aug 2019 14:15:55 +0300 Subject: [PATCH] mariadb: add option to build server without client binary files --- .../sql/mariadb/cmake-without-client.patch | 15 +++++++++++ pkgs/servers/sql/mariadb/default.nix | 25 ++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 pkgs/servers/sql/mariadb/cmake-without-client.patch diff --git a/pkgs/servers/sql/mariadb/cmake-without-client.patch b/pkgs/servers/sql/mariadb/cmake-without-client.patch new file mode 100644 index 000000000000..ce36d036b6d0 --- /dev/null +++ b/pkgs/servers/sql/mariadb/cmake-without-client.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ea7c1df..b0face0d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -176,6 +176,10 @@ ELSE() + SET (SKIP_COMPONENTS "N-O-N-E") + ENDIF() + ++IF (WITHOUT_CLIENT) ++ SET (SKIP_COMPONENTS "Client|ClientPlugins|ManPagesClient") ++ENDIF() ++ + OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF) + + INCLUDE(check_compiler_flag) diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix index fb280ed374d4..a4d6df2432d3 100644 --- a/pkgs/servers/sql/mariadb/default.nix +++ b/pkgs/servers/sql/mariadb/default.nix @@ -4,6 +4,7 @@ , fixDarwinDylibNames, cctools, CoreServices , asio, buildEnv, check, scons , less +, withoutClient ? false }: with stdenv.lib; @@ -14,9 +15,9 @@ libExt = stdenv.hostPlatform.extensions.sharedLibrary; mytopEnv = perl.withPackages (p: with p; [ DataDumper DBDmysql DBI TermReadKey ]); -mariadb = everything // { +mariadb = server // { 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 + server = server; # MariaDB Server inherit connector-c; # libmysqlclient.so inherit galera; }; @@ -146,8 +147,8 @@ client = stdenv.mkDerivation (common // { enableParallelBuilding = true; # the client should be OK }); -everything = stdenv.mkDerivation (common // { - pname = "mariadb"; +server = stdenv.mkDerivation (common // { + pname = "mariadb-server"; outputs = [ "out" "dev" "man" ]; @@ -159,6 +160,10 @@ everything = stdenv.mkDerivation (common // { ] ++ optional (stdenv.isLinux && !stdenv.isAarch32) numactl ++ optional (!stdenv.isDarwin) mytopEnv; + patches = common.patches ++ [ + ./cmake-without-client.patch + ]; + cmakeFlags = common.cmakeFlags ++ [ "-DMYSQL_DATADIR=/var/lib/mysql" "-DINSTALL_PLUGINDIR=lib/mysql/plugin" @@ -171,6 +176,8 @@ everything = stdenv.mkDerivation (common // { "-DWITH_INNODB_DISALLOW_WRITES=ON" "-DWITHOUT_EXAMPLE=1" "-DWITHOUT_FEDERATED=1" + ] ++ stdenv.lib.optionals withoutClient [ + "-DWITHOUT_CLIENT=ON" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "-DWITHOUT_OQGRAPH=1" "-DWITHOUT_TOKUDB=1" @@ -188,16 +195,16 @@ everything = stdenv.mkDerivation (common // { postInstall = common.postInstall + '' chmod +x "$out"/bin/wsrep_sst_common rm -r "$out"/data # Don't need testing data - rm "$out"/bin/{mysql_find_rows,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck} - rm "$out"/bin/{mysqldump,mysqlhotcopy,mysqlimport,mysqlshow,mysqlslap,mysqltest} + rm "$out"/lib/mysql/plugin/daemon_example.ini + rm "$out"/lib/mysql/{libmysqlclient${libExt},libmysqlclient_r${libExt}} + mv "$out"/share/{groonga,groonga-normalizer-mysql} "$out"/share/doc/mysql + '' + optionalString withoutClient '' ${ # We don't build with GSSAPI on Darwin optionalString (! stdenv.isDarwin) '' rm "$out"/lib/mysql/plugin/auth_gssapi_client.so '' } - rm "$out"/lib/mysql/plugin/{client_ed25519.so,daemon_example.ini} - rm "$out"/lib/mysql/{libmysqlclient${libExt},libmysqlclient_r${libExt}} - mv "$out"/share/{groonga,groonga-normalizer-mysql} "$out"/share/doc/mysql + rm "$out"/lib/mysql/plugin/client_ed25519.so '' + optionalString (! stdenv.isDarwin) '' sed -i 's/-mariadb/-mysql/' "$out"/bin/galera_new_cluster '';