about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libidn2
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libidn2')
-rw-r--r--nixpkgs/pkgs/development/libraries/libidn2/default.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/libidn2/no-bootstrap-reference.nix30
2 files changed, 34 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libidn2/default.nix b/nixpkgs/pkgs/development/libraries/libidn2/default.nix
index d8294f56adc3..724778999f5f 100644
--- a/nixpkgs/pkgs/development/libraries/libidn2/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libidn2/default.nix
@@ -16,10 +16,14 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-dpQM1Od46Ak1eanRlbJf/16Tbp3GJCBoUotDenZ2T5E=";
   };
 
+  strictDeps = true;
+  # Beware: non-bootstrap libidn2 is overridden by ./hack.nix
   outputs = [ "bin" "dev" "out" "info" "devdoc" ];
 
   patches = optional stdenv.isDarwin ./fix-error-darwin.patch;
 
+  enableParallelBuilding = true;
+
   # The above patch causes the documentation to be regenerated, so the
   # documentation tools are required.
   nativeBuildInputs = optionals stdenv.isDarwin [ help2man texinfo ];
diff --git a/nixpkgs/pkgs/development/libraries/libidn2/no-bootstrap-reference.nix b/nixpkgs/pkgs/development/libraries/libidn2/no-bootstrap-reference.nix
new file mode 100644
index 000000000000..e5922073437d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libidn2/no-bootstrap-reference.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, libidn2, libunistring, runCommandLocal, patchelf }:
+# Construct a copy of libidn2.* where all (transitive) libc references (in .bin)
+# get replaced by a new one, so that there's no reference to bootstrap tools.
+runCommandLocal
+  "${libidn2.pname}-${libidn2.version}"
+  {
+    outputs = [ "bin" "dev" "out" ];
+    passthru = {
+      inherit (libidn2) out info devdoc; # no need to touch these store paths
+    };
+  }
+  ''
+    cp -r '${libidn2.bin}' "$bin"
+    chmod +w "$bin"/bin/*
+    patchelf \
+      --set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \
+      --set-rpath '${lib.concatMapStringsSep ":" (p: lib.getLib p + "/lib")
+                      [ stdenv.cc.libc libunistring libidn2 ]}' \
+      "$bin"/bin/*
+
+    cp -r '${libidn2.dev}' "$dev"
+    chmod +w "$dev"/nix-support/propagated-build-inputs
+    substituteInPlace "$dev"/nix-support/propagated-build-inputs \
+      --replace '${libidn2.bin}' "$bin"
+    substituteInPlace "$dev"/lib/pkgconfig/libidn2.pc \
+      --replace '${libidn2.dev}' "$dev"
+
+    ln -s '${libidn2.out}' "$out" # it's hard to be without any $out
+  ''
+