diff options
author | Dmitry Kalinkin <dmitry.kalinkin@gmail.com> | 2020-07-01 22:29:42 -0400 |
---|---|---|
committer | Dmitry Kalinkin <dmitry.kalinkin@gmail.com> | 2020-07-02 12:10:15 -0400 |
commit | f6ef3ac294335434b233b587cc01df8f68b2bf21 (patch) | |
tree | 38fc8b99755f917ca3c16e7cc9aa1814aa802c40 /pkgs/tools/compression | |
parent | e640908b9213dd1a7c3a4dddb986ce0e9803a32f (diff) | |
download | nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar.gz nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar.bz2 nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar.lz nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar.xz nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.tar.zst nixpkgs-f6ef3ac294335434b233b587cc01df8f68b2bf21.zip |
zstd: build programs and tests against the shared library
Diffstat (limited to 'pkgs/tools/compression')
-rw-r--r-- | pkgs/tools/compression/zstd/default.nix | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix index f919fb92ed1..9c9f91f9c19 100644 --- a/pkgs/tools/compression/zstd/default.nix +++ b/pkgs/tools/compression/zstd/default.nix @@ -2,7 +2,8 @@ , fixDarwinDylibNames , file , legacySupport ? false -, enableShared ? true }: +, static ? false +}: stdenv.mkDerivation rec { pname = "zstd"; @@ -28,9 +29,24 @@ stdenv.mkDerivation rec { # work fine, and I'm not sure how to write the condition. ++ stdenv.lib.optional stdenv.hostPlatform.isWindows ./mcfgthreads-no-pthread.patch; + postPatch = + # Patch shebangs for playTests + '' + patchShebangs programs/zstdgrep + '' + stdenv.lib.optionalString (!static) '' + substituteInPlace build/cmake/CMakeLists.txt \ + --replace 'message(SEND_ERROR "You need to build static library to build tests")' "" + substituteInPlace build/cmake/tests/CMakeLists.txt \ + --replace 'libzstd_static' 'libzstd_shared' + sed -i \ + "1aexport ${stdenv.lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/build_/lib" \ + tests/playTests.sh + ''; + cmakeFlags = [ - "-DZSTD_BUILD_SHARED:BOOL=${if enableShared then "ON" else "OFF"}" - # They require STATIC for bin/zstd and tests. + "-DZSTD_BUILD_SHARED:BOOL=${if (!static) then "ON" else "OFF"}" + "-DZSTD_BUILD_STATIC:BOOL=${if static then "ON" else "OFF"}" + "-DZSTD_PROGRAMS_LINK_SHARED:BOOL=${if (!static) then "ON" else "OFF"}" "-DZSTD_LEGACY_SUPPORT:BOOL=${if legacySupport then "ON" else "OFF"}" "-DZSTD_BUILD_TESTS:BOOL=ON" ]; @@ -56,8 +72,6 @@ stdenv.mkDerivation rec { substituteInPlace ../programs/zstdless \ --replace "zstdcat" "$bin/bin/zstdcat" ''; - # Don't duplicate the library code in runtime closures. - postInstall = stdenv.lib.optionalString enableShared ''rm "$out"/lib/libzstd.a''; outputs = [ "bin" "dev" "man" "out" ]; |