From c06a0b2c8cf527b180740ee38e7d2fccad9fd064 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Fri, 11 Oct 2019 22:58:47 +0200 Subject: zstd: build with CMake CMake is used for static builds because the Makefile does not offer a way to disable the shared library. --- pkgs/tools/compression/zstd/default.nix | 51 ++++++++++++++------------------- pkgs/top-level/static.nix | 4 +++ 2 files changed, 25 insertions(+), 30 deletions(-) (limited to 'pkgs') diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix index a3aecf88c907..82a6a3a8a53c 100644 --- a/pkgs/tools/compression/zstd/default.nix +++ b/pkgs/tools/compression/zstd/default.nix @@ -1,7 +1,8 @@ -{ stdenv, fetchFromGitHub, fetchpatch, gnugrep +{ stdenv, fetchFromGitHub, fetchpatch, cmake, gnugrep , fixDarwinDylibNames , file -, legacySupport ? false }: +, legacySupport ? false +, enableShared ? true }: stdenv.mkDerivation rec { pname = "zstd"; @@ -14,56 +15,46 @@ stdenv.mkDerivation rec { owner = "facebook"; }; + nativeBuildInputs = [ cmake ] + ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + patches = [ - # All 3 from https://github.com/facebook/zstd/pull/1883 + # From https://github.com/facebook/zstd/pull/1883 (fetchpatch { url = "https://github.com/facebook/zstd/commit/106278e7e5fafaea3b7deb4147bdc8071562d2f0.diff"; sha256 = "13z7id1qbc05cv1rmak7c8xrchp7jh1i623bq5pwcihg57wzcyr8"; }) - (fetchpatch { - url = "https://github.com/facebook/zstd/commit/0ede342acc2c26f87ae962fa88e158904d4198c4.diff"; - sha256 = "12l5xbvnzkvr76mvl1ls767paqfwbd9q1pzq44ckacfpz4f6iaap"; - excludes = [ - # I think line endings are causing problems, or something like that - "programs/windres/generate_res.bat" - ]; - }) - (fetchpatch { - url = "https://github.com/facebook/zstd/commit/10552eaffef84c011f67af0e04f0780b50a5ab26.diff"; - sha256 = "1s27ravar3rn7q8abybp9733jhpsfcaci51k04da94ahahvxwiqw"; - }) ] # This I didn't upstream because if you use posix threads with MinGW it will # work find, and I'm not sure how to write the condition. ++ stdenv.lib.optional stdenv.hostPlatform.isWindows ./mcfgthreads-no-pthread.patch; - nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; - - makeFlags = [ - "ZSTD_LEGACY_SUPPORT=${if legacySupport then "1" else "0"}" - ] ++ stdenv.lib.optional stdenv.hostPlatform.isWindows "OS=Windows"; + cmakeFlags = [ + "-DZSTD_BUILD_SHARED:BOOL=${if enableShared then "ON" else "OFF"}" + "-DZSTD_LEGACY_SUPPORT:BOOL=${if legacySupport then "ON" else "OFF"}" + "-DZSTD_BUILD_TESTS:BOOL=ON" + ]; + cmakeDir = "../build/cmake"; + dontUseCmakeBuildDir = true; + preConfigure = '' + mkdir -p build_ && cd $_ + ''; checkInputs = [ file ]; doCheck = true; preCheck = '' - substituteInPlace tests/playTests.sh \ + substituteInPlace ../tests/playTests.sh \ --replace 'MD5SUM="md5 -r"' 'MD5SUM="md5sum"' ''; - installFlags = [ - "PREFIX=$(out)" - ]; - - preInstall = '' - substituteInPlace programs/zstdgrep \ + preInstall = stdenv.lib.optionalString enableShared '' + substituteInPlace ../programs/zstdgrep \ --replace ":-grep" ":-${gnugrep}/bin/grep" \ --replace ":-zstdcat" ":-$out/bin/zstdcat" - substituteInPlace programs/zstdless \ + substituteInPlace ../programs/zstdless \ --replace "zstdcat" "$out/bin/zstdcat" ''; - enableParallelBuilding = true; - meta = with stdenv.lib; { description = "Zstandard real-time compression algorithm"; longDescription = '' diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 687086b6ed3b..8723e209e7f9 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -223,6 +223,10 @@ in { staticOnly = true; }; + zstd = super.zstd.override { + enableShared = false; + }; + llvmPackages_8 = super.llvmPackages_8 // { libraries = super.llvmPackages_8.libraries // rec { libcxxabi = super.llvmPackages_8.libraries.libcxxabi.override { -- cgit 1.4.1 From 15fb93ac4f9f56d71efe3ff3891b9b5d62d88fe8 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 10:59:36 +0100 Subject: double-conversion: add pkgsStatic support --- pkgs/development/libraries/double-conversion/default.nix | 6 +++--- pkgs/top-level/static.nix | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/double-conversion/default.nix b/pkgs/development/libraries/double-conversion/default.nix index bc4bc8b23524..4d8f623b36a4 100644 --- a/pkgs/development/libraries/double-conversion/default.nix +++ b/pkgs/development/libraries/double-conversion/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, cmake }: +{ stdenv, lib, fetchFromGitHub, cmake, static ? false }: stdenv.mkDerivation rec { pname = "double-conversion"; @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; + cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" ]; # Case sensitivity issue preConfigure = lib.optionalString stdenv.isDarwin '' @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "Binary-decimal and decimal-binary routines for IEEE doubles"; - homepage = https://github.com/google/double-conversion; + homepage = "https://github.com/google/double-conversion"; license = licenses.bsd3; platforms = platforms.unix; maintainers = with maintainers; [ abbradar ]; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 8723e209e7f9..17000e8eced2 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -170,6 +170,9 @@ in { # --disable-shared flag stdenv = super.stdenv; }; + double-conversion = super.double-conversion.override { + static = true; + }; gmp = super.gmp.override { withStatic = true; }; -- cgit 1.4.1 From d567c7e49768f001de428573777ad5cd0265092c Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:04:53 +0100 Subject: glog: add pkgsStatic support --- pkgs/development/libraries/glog/default.nix | 8 +++++--- pkgs/top-level/static.nix | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix index 792217043da7..7809dc088427 100644 --- a/pkgs/development/libraries/glog/default.nix +++ b/pkgs/development/libraries/glog/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, fetchpatch, autoreconfHook, perl }: +{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, perl, static ? false }: stdenv.mkDerivation rec { pname = "glog"; @@ -20,13 +20,15 @@ stdenv.mkDerivation rec { }) ]; - nativeBuildInputs = [ autoreconfHook ]; + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" ]; checkInputs = [ perl ]; doCheck = false; # fails with "Mangled symbols (28 out of 380) found in demangle.dm" meta = with stdenv.lib; { - homepage = https://github.com/google/glog; + homepage = "https://github.com/google/glog"; license = licenses.bsd3; description = "Library for application-level logging"; platforms = platforms.unix; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 17000e8eced2..74c4b838ccc3 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -176,6 +176,9 @@ in { gmp = super.gmp.override { withStatic = true; }; + glog = super.glog.override { + static = true; + }; cdo = super.cdo.override { enable_all_static = true; }; -- cgit 1.4.1 From 93da24ca80f04349b5fc00848ae0a20120607e5c Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:05:48 +0100 Subject: gflags: add pkgsStatic support --- pkgs/development/libraries/gflags/default.nix | 6 +++--- pkgs/top-level/static.nix | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/gflags/default.nix b/pkgs/development/libraries/gflags/default.nix index 2e818ea94ea5..b09936f29240 100644 --- a/pkgs/development/libraries/gflags/default.nix +++ b/pkgs/development/libraries/gflags/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake }: +{ stdenv, fetchFromGitHub, cmake, enableShared ? true}: stdenv.mkDerivation rec { pname = "gflags"; @@ -17,8 +17,8 @@ stdenv.mkDerivation rec { preConfigure = "rm BUILD"; cmakeFlags = [ - "-DBUILD_SHARED_LIBS=ON" - "-DBUILD_STATIC_LIBS=ON" + "-DGFLAGS_BUILD_SHARED_LIBS=${if enableShared then "ON" else "OFF"}" + "-DGFLAGS_BUILD_STATIC_LIBS=ON" ]; doCheck = false; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 74c4b838ccc3..16484b47e010 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -176,6 +176,9 @@ in { gmp = super.gmp.override { withStatic = true; }; + gflags = super.gflags.override { + enableShared = false; + }; glog = super.glog.override { static = true; }; -- cgit 1.4.1 From 812ccd8e4c2d8b9bfe87e20251435140676b6b6b Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:06:59 +0100 Subject: gtest: add pkgsStatic support --- pkgs/top-level/static.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkgs') diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 16484b47e010..5aa5a103bde2 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -182,6 +182,9 @@ in { glog = super.glog.override { static = true; }; + gtest = super.gtest.override { + static = true; + }; cdo = super.cdo.override { enable_all_static = true; }; -- cgit 1.4.1 From 0aeacdeaae6fc6f7d0d6af71ef6a5af2661e9fd5 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:12:48 +0100 Subject: woff2: add pkgsStatic support --- pkgs/development/web/woff2/brotli-static.patch | 36 ++++++++++++++++++++++++++ pkgs/development/web/woff2/default.nix | 16 ++++++++---- pkgs/top-level/static.nix | 3 +++ 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/web/woff2/brotli-static.patch (limited to 'pkgs') diff --git a/pkgs/development/web/woff2/brotli-static.patch b/pkgs/development/web/woff2/brotli-static.patch new file mode 100644 index 000000000000..4ed6d7e741a8 --- /dev/null +++ b/pkgs/development/web/woff2/brotli-static.patch @@ -0,0 +1,36 @@ +diff a/cmake/FindBrotliDec.cmake b/cmake/FindBrotliDec.cmake +--- a/cmake/FindBrotliDec.cmake ++++ b/cmake/FindBrotliDec.cmake +@@ -18,10 +18,10 @@ find_path(BROTLIDEC_INCLUDE_DIRS + HINTS ${PC_BROTLIDEC_INCLUDEDIR} + ) + +-find_library(BROTLIDEC_LIBRARIES +- NAMES brotlidec +- HINTS ${PC_BROTLIDEC_LIBDIR} +-) ++if(NOT BUILD_SHARED_LIBS) ++ set(_S "STATIC_") ++endif() ++set(BROTLIDEC_LIBRARIES ${PC_BROTLIDEC_${_S}LIBRARIES}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BrotliDec +diff a/cmake/FindBrotliEnc.cmake b/cmake/FindBrotliEnc.cmake +--- a/cmake/FindBrotliEnc.cmake ++++ b/cmake/FindBrotliEnc.cmake +@@ -18,10 +18,10 @@ find_path(BROTLIENC_INCLUDE_DIRS + HINTS ${PC_BROTLIENC_INCLUDEDIR} + ) + +-find_library(BROTLIENC_LIBRARIES +- NAMES brotlienc +- HINTS ${PC_BROTLIENC_LIBDIR} +-) ++if(NOT BUILD_SHARED_LIBS) ++ set(_S "STATIC_") ++endif() ++set(BROTLIENC_LIBRARIES ${PC_BROTLIENC_${_S}LIBRARIES}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BrotliEnc diff --git a/pkgs/development/web/woff2/default.nix b/pkgs/development/web/woff2/default.nix index b77184e56525..ff0484547fc2 100644 --- a/pkgs/development/web/woff2/default.nix +++ b/pkgs/development/web/woff2/default.nix @@ -1,4 +1,4 @@ -{ brotli, cmake, fetchFromGitHub, stdenv }: +{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv, static ? false }: stdenv.mkDerivation rec { pname = "woff2"; @@ -13,18 +13,24 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "lib" ]; - nativeBuildInputs = [ cmake ]; + # Need to explicitly link to brotlicommon + patches = stdenv.lib.optional static ./brotli-static.patch; + + nativeBuildInputs = [ cmake pkgconfig ]; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" ] + ++ stdenv.lib.optional static "-DCMAKE_SKIP_RPATH:BOOL=TRUE"; propagatedBuildInputs = [ brotli ]; - # without this binaries only get built if shared libs are disable - patchPhase = '' + postPatch = '' + # without this binaries only get built if shared libs are disable sed 's@^if (NOT BUILD_SHARED_LIBS)$@if (TRUE)@g' -i CMakeLists.txt ''; meta = with stdenv.lib; { description = "Webfont compression reference code"; - homepage = https://github.com/google/woff2; + homepage = "https://github.com/google/woff2"; license = licenses.mit; maintainers = [ maintainers.hrdinka ]; platforms = platforms.unix; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 5aa5a103bde2..1d3c4af50430 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -203,6 +203,9 @@ in { # it doesn’t like the --disable-shared flag stdenv = super.stdenv; }; + woff2 = super.woff2.override { + static = true; + }; lz4 = super.lz4.override { enableShared = false; enableStatic = true; -- cgit 1.4.1 From a244885c63adf4d0c21702cd6a370dc656b9f353 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:16:38 +0100 Subject: snappy: add pkgsStatic support --- pkgs/development/libraries/snappy/default.nix | 9 ++++++--- pkgs/top-level/static.nix | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/snappy/default.nix b/pkgs/development/libraries/snappy/default.nix index f35f5bfc55a2..0ad1a4b28987 100644 --- a/pkgs/development/libraries/snappy/default.nix +++ b/pkgs/development/libraries/snappy/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake }: +{ stdenv, fetchFromGitHub, cmake, static ? false }: stdenv.mkDerivation rec { pname = "snappy"; @@ -17,7 +17,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_SKIP_BUILD_RPATH=OFF" ]; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" + "-DCMAKE_SKIP_BUILD_RPATH=OFF" + ]; postInstall = '' substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \ @@ -29,7 +32,7 @@ stdenv.mkDerivation rec { doCheck = true; meta = with stdenv.lib; { - homepage = https://google.github.io/snappy/; + homepage = "https://google.github.io/snappy/"; license = licenses.bsd3; description = "Compression/decompression library for very high speeds"; platforms = platforms.all; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 1d3c4af50430..c75e5127534f 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -206,6 +206,9 @@ in { woff2 = super.woff2.override { static = true; }; + snappy = super.snappy.override { + static = true; + }; lz4 = super.lz4.override { enableShared = false; enableStatic = true; -- cgit 1.4.1 From 0a21b322346977d7413c8cd2a3d834d8f1b03c96 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:39:21 +0100 Subject: thrift: build with CMake; add pkgsStatic support --- pkgs/development/libraries/thrift/default.nix | 36 ++++++++++++++++----------- pkgs/top-level/static.nix | 12 ++++++--- 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/thrift/default.nix b/pkgs/development/libraries/thrift/default.nix index ecdb831fcfaf..b1b66ed052fb 100644 --- a/pkgs/development/libraries/thrift/default.nix +++ b/pkgs/development/libraries/thrift/default.nix @@ -1,6 +1,5 @@ -{ stdenv, fetchurl, boost, zlib, libevent, openssl, python, pkgconfig, bison -, flex, twisted -}: +{ stdenv, fetchurl, boost, zlib, libevent, openssl, python, cmake, pkgconfig +, bison, flex, twisted, static ? false }: stdenv.mkDerivation rec { pname = "thrift"; @@ -11,27 +10,36 @@ stdenv.mkDerivation rec { sha256 = "0yai9c3bdsrkkjshgim7zk0i7malwfprg00l9774dbrkh2w4ilvs"; }; - #enableParallelBuilding = true; problems on hydra - # Workaround to make the python wrapper not drop this package: # pythonFull.buildEnv.override { extraLibs = [ thrift ]; } pythonPath = []; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ - boost zlib libevent openssl python bison flex twisted - ]; + nativeBuildInputs = [ cmake pkgconfig ]; + buildInputs = [ boost zlib libevent openssl python bison flex ] + ++ stdenv.lib.optional (!static) twisted; preConfigure = "export PY_PREFIX=$out"; - # TODO: package boost-test, so we can run the test suite. (Currently it fails - # to find libboost_unit_test_framework.a.) - configureFlags = [ "--enable-tests=no" ]; - doCheck = false; + cmakeFlags = [ + # FIXME: Fails to link in static mode with undefined reference to + # `boost::unit_test::unit_test_main(bool (*)(), int, char**)' + "-DBUILD_TESTING:BOOL=${if static then "OFF" else "ON"}" + ] ++ stdenv.lib.optionals static [ + "-DWITH_STATIC_LIB:BOOL=ON" + "-DOPENSSL_USE_STATIC_LIBS=ON" + ]; + + doCheck = !static; + checkPhase = '' + runHook preCheck + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib ctest -E PythonTestSSLSocket + runHook postCheck + ''; + enableParallelChecking = false; meta = with stdenv.lib; { description = "Library for scalable cross-language services"; - homepage = http://thrift.apache.org/; + homepage = "http://thrift.apache.org/"; license = licenses.asl20; platforms = platforms.linux ++ platforms.darwin; maintainers = [ maintainers.bjornfor ]; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index c75e5127534f..81c977b79814 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -55,7 +55,7 @@ self: super: let removeUnknownConfigureFlags = f: with self.lib; remove "--disable-shared" (remove "--enable-static" f); - + ocamlFixPackage = b: b.overrideAttrs (o: { configurePlatforms = [ ]; @@ -63,7 +63,7 @@ self: super: let buildInputs = o.buildInputs ++ o.nativeBuildInputs or [ ]; propagatedNativeBuildInputs = o.propagatedBuildInputs or [ ]; }); - + ocamlStaticAdapter = _: super: self.lib.mapAttrs (_: p: if p ? overrideAttrs then ocamlFixPackage p else p) @@ -170,6 +170,10 @@ in { # --disable-shared flag stdenv = super.stdenv; }; + thrift = super.thrift.override { + static = true; + twisted = null; + }; double-conversion = super.double-conversion.override { static = true; }; @@ -227,7 +231,7 @@ in { kmod = super.kmod.override { withStatic = true; }; - + curl = super.curl.override { # a very sad story: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039 gssSupport = false; @@ -263,6 +267,6 @@ in { ocaml-ng = self.lib.mapAttrs (_: set: if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set ) super.ocaml-ng; - + python27 = super.python27.override { static = true; }; } -- cgit 1.4.1 From 207db019cefd27b20e16609384ce1aedf998c991 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 16 Dec 2019 13:22:20 +0100 Subject: arrow-cpp: add pkgsStatic support --- pkgs/development/libraries/arrow-cpp/default.nix | 13 +++++++++++-- .../libraries/arrow-cpp/jemalloc-disable-shared.patch | 11 +++++++++++ pkgs/top-level/static.nix | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/arrow-cpp/jemalloc-disable-shared.patch (limited to 'pkgs') diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix index f6f3493002ad..587311a8cc3b 100644 --- a/pkgs/development/libraries/arrow-cpp/default.nix +++ b/pkgs/development/libraries/arrow-cpp/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchurl, fetchFromGitHub, fixDarwinDylibNames, autoconf, boost , brotli, cmake, double-conversion, flatbuffers, gflags, glog, gtest, lz4, perl -, python, rapidjson, snappy, thrift, uriparser, which, zlib, zstd }: +, python, rapidjson, snappy, thrift, uriparser, which, zlib, zstd +, enableShared ? true }: let parquet-testing = fetchFromGitHub { @@ -34,6 +35,9 @@ in stdenv.mkDerivation rec { patches = [ # patch to fix python-test ./darwin.patch + ] ++ stdenv.lib.optionals (!enableShared) [ + # The shared jemalloc lib is unused and breaks in static mode due to missing -fpic. + ./jemalloc-disable-shared.patch ]; nativeBuildInputs = [ @@ -71,8 +75,13 @@ in stdenv.mkDerivation rec { "-DARROW_DEPENDENCY_SOURCE=SYSTEM" "-DARROW_PARQUET=ON" "-DARROW_PLASMA=ON" - "-DARROW_PYTHON=ON" + # Disable Python for static mode because openblas is currently broken there. + "-DARROW_PYTHON=${if enableShared then "ON" else "OFF"}" "-Duriparser_SOURCE=SYSTEM" + ] ++ stdenv.lib.optionals (!enableShared) [ + "-DARROW_BUILD_SHARED=OFF" + "-DARROW_TEST_LINKAGE=static" + "-DOPENSSL_USE_STATIC_LIBS=ON" ] ++ stdenv.lib.optional (!stdenv.isx86_64) "-DARROW_USE_SIMD=OFF"; doInstallCheck = true; diff --git a/pkgs/development/libraries/arrow-cpp/jemalloc-disable-shared.patch b/pkgs/development/libraries/arrow-cpp/jemalloc-disable-shared.patch new file mode 100644 index 000000000000..0f7955724e16 --- /dev/null +++ b/pkgs/development/libraries/arrow-cpp/jemalloc-disable-shared.patch @@ -0,0 +1,11 @@ +diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake +--- a/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cmake_modules/ThirdpartyToolchain.cmake +@@ -1428,6 +1428,7 @@ if(ARROW_JEMALLOC) + "--with-jemalloc-prefix=je_arrow_" + "--with-private-namespace=je_arrow_private_" + "--without-export" ++ "--disable-shared" + # Don't override operator new() + "--disable-cxx" "--disable-libdl" + # See https://github.com/jemalloc/jemalloc/issues/1237 diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index 81c977b79814..fbffd8e08f5e 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -162,6 +162,10 @@ in { # --disable-shared flag stdenv = super.stdenv; }; + arrow-cpp = super.arrow-cpp.override { + enableShared = false; + python = { pkgs = { python = null; numpy = null; }; }; + }; boost = super.boost.override { enableStatic = true; enableShared = false; -- cgit 1.4.1 From cdbf3f78bfd1f88259116f6f7cbcc6c5df0a9687 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Sat, 20 Jul 2019 21:24:12 +0200 Subject: arrow-cpp: add lib parameter --- pkgs/development/libraries/arrow-cpp/default.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix index 587311a8cc3b..87684a4bbe4a 100644 --- a/pkgs/development/libraries/arrow-cpp/default.nix +++ b/pkgs/development/libraries/arrow-cpp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchFromGitHub, fixDarwinDylibNames, autoconf, boost +{ stdenv, lib, fetchurl, fetchFromGitHub, fixDarwinDylibNames, autoconf, boost , brotli, cmake, double-conversion, flatbuffers, gflags, glog, gtest, lz4, perl , python, rapidjson, snappy, thrift, uriparser, which, zlib, zstd , enableShared ? true }: @@ -35,7 +35,7 @@ in stdenv.mkDerivation rec { patches = [ # patch to fix python-test ./darwin.patch - ] ++ stdenv.lib.optionals (!enableShared) [ + ] ++ lib.optionals (!enableShared) [ # The shared jemalloc lib is unused and breaks in static mode due to missing -fpic. ./jemalloc-disable-shared.patch ]; @@ -44,7 +44,7 @@ in stdenv.mkDerivation rec { cmake autoconf # for vendored jemalloc flatbuffers - ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; buildInputs = [ boost brotli @@ -78,23 +78,23 @@ in stdenv.mkDerivation rec { # Disable Python for static mode because openblas is currently broken there. "-DARROW_PYTHON=${if enableShared then "ON" else "OFF"}" "-Duriparser_SOURCE=SYSTEM" - ] ++ stdenv.lib.optionals (!enableShared) [ + ] ++ lib.optionals (!enableShared) [ "-DARROW_BUILD_SHARED=OFF" "-DARROW_TEST_LINKAGE=static" "-DOPENSSL_USE_STATIC_LIBS=ON" - ] ++ stdenv.lib.optional (!stdenv.isx86_64) "-DARROW_USE_SIMD=OFF"; + ] ++ lib.optional (!stdenv.isx86_64) "-DARROW_USE_SIMD=OFF"; doInstallCheck = true; PARQUET_TEST_DATA = if doInstallCheck then "${parquet-testing}/data" else null; installCheckInputs = [ perl which ]; - installCheckPhase = (stdenv.lib.optionalString stdenv.isDarwin '' + installCheckPhase = (lib.optionalString stdenv.isDarwin '' for f in release/*test{,s}; do install_name_tool -add_rpath "$out"/lib "$f" done '') + (let - excludedTests = stdenv.lib.optionals stdenv.isDarwin [ + excludedTests = lib.optionals stdenv.isDarwin [ # Some plasma tests need to be patched to use a shorter AF_UNIX socket # path on Darwin. See https://github.com/NixOS/nix/pull/1085 "plasma-external-store-tests" @@ -108,8 +108,8 @@ in stdenv.mkDerivation rec { meta = { description = "A cross-language development platform for in-memory data"; homepage = "https://arrow.apache.org/"; - license = stdenv.lib.licenses.asl20; - platforms = stdenv.lib.platforms.unix; - maintainers = with stdenv.lib.maintainers; [ tobim veprbl ]; + license = lib.licenses.asl20; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ tobim veprbl ]; }; } -- cgit 1.4.1 From db5d3cdfe20035a92106bb498c50e35274b1d1aa Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Thu, 19 Dec 2019 13:14:07 +0100 Subject: openblas: partially fix static build --- pkgs/development/libraries/science/math/openblas/default.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index f8d392691ab2..bf9912f36e83 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -115,6 +115,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ perl which + ]; + + depsBuildBuild = [ buildPackages.gfortran buildPackages.stdenv.cc ]; -- cgit 1.4.1