diff options
author | Tom Sydney Kerckhove <syd@cs-syd.eu> | 2024-04-17 11:22:05 +0200 |
---|---|---|
committer | Tom Sydney Kerckhove <syd@cs-syd.eu> | 2024-04-17 21:39:22 +0200 |
commit | f3dee8a2e201ee0672d4268a062c3ec6f8f855c4 (patch) | |
tree | b518c0184038e97eabf3f41af6b271f58920c3cd /pkgs/development/libraries/icu | |
parent | 4a04be9a3cb62d6e6f70d08b34a04b7890ba2084 (diff) |
icu: Make static linking possible
Diffstat (limited to 'pkgs/development/libraries/icu')
-rw-r--r-- | pkgs/development/libraries/icu/make-icu.nix | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pkgs/development/libraries/icu/make-icu.nix b/pkgs/development/libraries/icu/make-icu.nix index 836a7e3c73a69..1bfb0c97fd60d 100644 --- a/pkgs/development/libraries/icu/make-icu.nix +++ b/pkgs/development/libraries/icu/make-icu.nix @@ -1,6 +1,6 @@ { stdenv, lib, buildPackages, fetchurl, fixDarwinDylibNames, testers }: -{ version, hash, patches ? [], patchFlags ? [] }: +{ version, hash, patches ? [], patchFlags ? [], withStatic ? stdenv.hostPlatform.isStatic }: let # Cross-compiled icu4c requires a build-root of a native compile @@ -36,9 +36,12 @@ let sed -e 's/LDFLAGSICUDT=-nodefaultlibs -nostdlib/LDFLAGSICUDT=/' -i config/mh-linux ''; + dontDisableStatic = withStatic; + configureFlags = [ "--disable-debug" ] ++ lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) "--enable-rpath" - ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--with-cross-build=${nativeBuildRoot}"; + ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--with-cross-build=${nativeBuildRoot}" + ++ lib.optional withStatic "--enable-static"; enableParallelBuilding = true; @@ -58,7 +61,7 @@ let realAttrs = baseAttrs // { name = pname + "-" + version; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" ] ++ lib.optional withStatic "static"; outputBin = "dev"; # FIXME: This fixes dylib references in the dylibs themselves, but @@ -66,7 +69,10 @@ let nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; # remove dependency on bootstrap-tools in early stdenv build - postInstall = lib.optionalString stdenv.isDarwin '' + postInstall = lib.optionalString withStatic '' + mkdir -p $static/lib + mv -v lib/*.a $static/lib + '' + lib.optionalString stdenv.isDarwin '' sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc '' + (let replacements = [ |