From 882dac865faf5279242e66329d52b1317700535e Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Wed, 24 Mar 2021 19:05:44 +0100 Subject: [PATCH] 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 --- .../development/libraries/leveldb/default.nix | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/pkgs/development/libraries/leveldb/default.nix b/pkgs/development/libraries/leveldb/default.nix index 0a1dabef328..2a7fb196ea6 100644 --- a/pkgs/development/libraries/leveldb/default.nix +++ b/pkgs/development/libraries/leveldb/default.nix @@ -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";