mariadb: Make derivation smaller and split out libs

This commit is contained in:
William A. Kennington III 2015-04-01 12:36:19 -07:00
parent 050e6fa431
commit 53f1d8147d

View File

@ -55,13 +55,42 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
outputs = [ "out" "lib" ];
prePatch = '' prePatch = ''
substituteInPlace cmake/libutils.cmake \ substituteInPlace cmake/libutils.cmake \
--replace /usr/bin/libtool libtool --replace /usr/bin/libtool libtool
sed -i "s,SET(DEFAULT_MYSQL_HOME.*$,SET(DEFAULT_MYSQL_HOME /not/a/real/dir),g" CMakeLists.txt
sed -i "s,SET(PLUGINDIR.*$,SET(PLUGINDIR $lib/lib/mysql/plugin),g" CMakeLists.txt
sed -i "s,SET(pkgincludedir.*$,SET(pkgincludedir $lib/include),g" scripts/CMakeLists.txt
sed -i "s,SET(pkglibdir.*$,SET(pkglibdir $lib/lib),g" scripts/CMakeLists.txt
sed -i "s,SET(pkgplugindir.*$,SET(pkgplugindir $lib/lib/mysql/plugin),g" scripts/CMakeLists.txt
sed -i "s,set(libdir.*$,SET(libdir $lib/lib),g" storage/mroonga/vendor/groonga/CMakeLists.txt
sed -i "s,set(includedir.*$,SET(includedir $lib/include),g" storage/mroonga/vendor/groonga/CMakeLists.txt
sed -i "/\"\$[{]CMAKE_INSTALL_PREFIX}\/\$[{]GRN_RELATIVE_PLUGINS_DIR}\"/d" storage/mroonga/vendor/groonga/CMakeLists.txt
sed -i "s,set(GRN_PLUGINS_DIR.*$,SET(GRN_PLUGINS_DIR $lib/\$\{GRN_RELATIVE_PLUGINS_DIR}),g" storage/mroonga/vendor/groonga/CMakeLists.txt
''; '';
postInstall = '' postInstall = ''
substituteInPlace $out/bin/mysql_install_db \ substituteInPlace $out/bin/mysql_install_db \
--replace basedir=\"\" basedir=\"$out\" --replace basedir=\"\" basedir=\"$out\"
# Remove superfluous files
rm -r $out/mysql-test $out/sql-bench $out/data
rm $out/share/man/man1/mysql-test-run.pl.1
rm $out/bin/rcmysql
find $out/bin -name \*test\* -exec rm {} \;
# Separate libs and includes into their own derivation
mkdir -p $lib
mv $out/lib $lib
mv $out/include $lib
# Make sure to propagate lib for compatability
mkdir -p $out/nix-support
echo "$lib" > $out/nix-support/propagated-native-build-inputs
''; '';
passthru.mysqlVersion = "5.6"; passthru.mysqlVersion = "5.6";