3
0
Fork 0
forked from mirrors/nixpkgs

mariadb: add option to build server without client binary files

This commit is contained in:
Izorkin 2019-08-01 14:15:55 +03:00
parent f0d88f05b6
commit c8488b913a
2 changed files with 31 additions and 9 deletions

View file

@ -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)

View file

@ -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
'';