3
0
Fork 0
forked from mirrors/nixpkgs

leveldb: fix static build and cleanup

- fix build of pkgsStatic.leveldb
- use runHook to start pre/post install phases
- run tests
- install the db_bench tool
This commit is contained in:
rnhmjoj 2021-03-24 19:05:44 +01:00
parent 7865db274b
commit 882dac865f
No known key found for this signature in database
GPG key ID: BFBAF4C975F76450

View file

@ -13,25 +13,28 @@ stdenv.mkDerivation rec {
buildInputs = [ snappy ];
nativeBuildInputs = []
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildPhase = ''
make all
doCheck = true;
buildFlags = [ "all" ];
postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
# remove shared objects from "all" target
sed -i '/^all:/ s/$(SHARED_LIBS) $(SHARED_PROGRAMS)//' Makefile
'';
installPhase = "
mkdir -p $out/{bin,lib,include}
installPhase = ''
runHook preInstall
cp -r include $out
mkdir -p $out/include/leveldb/helpers
cp helpers/memenv/memenv.h $out/include/leveldb/helpers
install -D -t $out/include/leveldb include/leveldb/*
install -D helpers/memenv/memenv.h $out/include/leveldb/helpers
cp out-shared/lib* $out/lib
cp out-static/lib* $out/lib
install -D -t $out/lib out-{static,shared}/lib*
install -D -t $out/bin out-static/{leveldbutil,db_bench}
cp out-static/leveldbutil $out/bin
";
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/google/leveldb";