nss: migrate manual patching into postPatch

This commit is contained in:
Martin Weinelt 2022-08-19 15:16:13 +02:00
parent df214678dc
commit 0badc2389a
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -39,16 +39,6 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [ nspr ];
prePatch = ''
patchShebangs nss
for f in nss/coreconf/config.gypi nss/build.sh nss/coreconf/config.gypi; do
substituteInPlace "$f" --replace "/usr/bin/env" "${buildPackages.coreutils}/bin/env"
done
substituteInPlace nss/coreconf/config.gypi --replace "/usr/bin/grep" "${buildPackages.coreutils}/bin/env grep"
'';
patches = [
# Based on http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.4-1/85_security_load.patch
(if (lib.versionOlder version "3.77") then
@ -61,7 +51,15 @@ stdenv.mkDerivation rec {
patchFlags = [ "-p0" ];
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
postPatch = ''
patchShebangs nss
for f in nss/coreconf/config.gypi nss/build.sh nss/coreconf/config.gypi; do
substituteInPlace "$f" --replace "/usr/bin/env" "${buildPackages.coreutils}/bin/env"
done
substituteInPlace nss/coreconf/config.gypi --replace "/usr/bin/grep" "${buildPackages.coreutils}/bin/env grep"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
substituteInPlace nss/coreconf/config.gypi --replace "'DYLIB_INSTALL_NAME_BASE': '@executable_path'" "'DYLIB_INSTALL_NAME_BASE': '$out/lib'"
'';