diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-15 10:30:44 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-15 10:30:44 +0000 |
commit | e0794be8a0d11e90461e5a9c85012a36b93ec976 (patch) | |
tree | efd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/development/libraries/nss | |
parent | 3538874082ded7647b1ccec0343c7c1e882cfef3 (diff) | |
parent | 1a57d96edd156958b12782e8c8b6a374142a7248 (diff) | |
download | nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2 nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip |
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/nss')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/nss/3.44.nix | 6 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/nss/3.53.nix | 169 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/nss/default.nix | 31 |
3 files changed, 195 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/libraries/nss/3.44.nix b/nixpkgs/pkgs/development/libraries/nss/3.44.nix index ad58bfccaee6..1c89dd793316 100644 --- a/nixpkgs/pkgs/development/libraries/nss/3.44.nix +++ b/nixpkgs/pkgs/development/libraries/nss/3.44.nix @@ -19,10 +19,10 @@ in stdenv.mkDerivation rec { depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ perl ]; + nativeBuildInputs = [ perl ] + ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; - buildInputs = [ zlib sqlite ] - ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + buildInputs = [ zlib sqlite ]; propagatedBuildInputs = [ nspr ]; diff --git a/nixpkgs/pkgs/development/libraries/nss/3.53.nix b/nixpkgs/pkgs/development/libraries/nss/3.53.nix new file mode 100644 index 000000000000..dcd9ade629b7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/nss/3.53.nix @@ -0,0 +1,169 @@ +{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja +, # allow FIPS mode. Note that this makes the output non-reproducible. + # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6 + enableFIPS ? false +}: + +let + nssPEM = fetchurl { + url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz"; + sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw"; + }; + version = "3.53.1"; + underscoreVersion = builtins.replaceStrings ["."] ["_"] version; + +in stdenv.mkDerivation rec { + pname = "nss"; + inherit version; + + src = fetchurl { + url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${pname}-${version}.tar.gz"; + sha256 = "05jk65x3zy6q8lx2djj8ik7kg741n88iy4n3bblw89cv0xkxxk1d"; + }; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + nativeBuildInputs = [ perl ninja (buildPackages.python3.withPackages (ps: with ps; [ gyp ])) ] + ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ]; + + buildInputs = [ zlib sqlite ]; + + propagatedBuildInputs = [ nspr ]; + + prePatch = '' + # strip the trailing whitespace from the patch line and the renamed CKO_NETSCAPE_ enum to CKO_NSS_ + xz -d < ${nssPEM} | sed \ + -e 's/-DIRS = builtins $/-DIRS = . builtins/g' \ + -e 's/CKO_NETSCAPE_/CKO_NSS_/g' \ + -e 's/CKT_NETSCAPE_/CKT_NSS_/g' \ + | patch -p1 + + 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 + ./85_security_load.patch + ./ckpem.patch + ./fix-cross-compilation.patch + ]; + + patchFlags = [ "-p0" ]; + + postPatch = stdenv.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'" + ''; + + outputs = [ "out" "dev" "tools" ]; + + preConfigure = "cd nss"; + + buildPhase = let + getArch = platform: if platform.isx86_64 then "x64" + else if platform.isx86_32 then "ia32" + else if platform.isAarch32 then "arm" + else if platform.isAarch64 then "arm64" + else if platform.isPower && platform.is64bit then ( + if platform.isLittleEndian then "ppc64le" else "ppc64" + ) + else platform.parsed.cpu.name; + # yes, this is correct. nixpkgs uses "host" for the platform the binary will run on whereas nss uses "host" for the platform that the build is running on + target = getArch stdenv.hostPlatform; + host = getArch stdenv.buildPlatform; + in '' + runHook preBuild + + sed -i 's|nss_dist_dir="$dist_dir"|nss_dist_dir="'$out'"|;s|nss_dist_obj_dir="$obj_dir"|nss_dist_obj_dir="'$out'"|' build.sh + ./build.sh -v --opt \ + --with-nspr=${nspr.dev}/include:${nspr.out}/lib \ + --system-sqlite \ + --enable-legacy-db \ + --target ${target} \ + -Dhost_arch=${host} \ + -Duse_system_zlib=1 \ + --enable-libpkix \ + ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \ + ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \ + ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"} + + runHook postBuild + ''; + + NIX_CFLAGS_COMPILE = "-Wno-error -DNIX_NSS_LIBDIR=\"${placeholder "out"}/lib/\""; + + installPhase = '' + runHook preInstall + + rm -rf $out/private + find $out -name "*.TOC" -delete + mv $out/public $out/include + + ln -s lib $out/lib64 + + # Upstream issue: https://bugzilla.mozilla.org/show_bug.cgi?id=530672 + # https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch?id=af1acce6c6d2c3adb17689261dfe2c2b6771ab8a + NSS_MAJOR_VERSION=`grep "NSS_VMAJOR" lib/nss/nss.h | awk '{print $3}'` + NSS_MINOR_VERSION=`grep "NSS_VMINOR" lib/nss/nss.h | awk '{print $3}'` + NSS_PATCH_VERSION=`grep "NSS_VPATCH" lib/nss/nss.h | awk '{print $3}'` + PREFIX="$out" + + mkdir -p $out/lib/pkgconfig + sed -e "s,%prefix%,$PREFIX," \ + -e "s,%exec_prefix%,$PREFIX," \ + -e "s,%libdir%,$PREFIX/lib64," \ + -e "s,%includedir%,$dev/include/nss," \ + -e "s,%NSS_VERSION%,$NSS_MAJOR_VERSION.$NSS_MINOR_VERSION.$NSS_PATCH_VERSION,g" \ + -e "s,%NSPR_VERSION%,4.16,g" \ + pkg/pkg-config/nss.pc.in > $out/lib/pkgconfig/nss.pc + chmod 0644 $out/lib/pkgconfig/nss.pc + + sed -e "s,@prefix@,$PREFIX," \ + -e "s,@MOD_MAJOR_VERSION@,$NSS_MAJOR_VERSION," \ + -e "s,@MOD_MINOR_VERSION@,$NSS_MINOR_VERSION," \ + -e "s,@MOD_PATCH_VERSION@,$NSS_PATCH_VERSION," \ + pkg/pkg-config/nss-config.in > $out/bin/nss-config + chmod 0755 $out/bin/nss-config + ''; + + postFixup = let + isCross = stdenv.hostPlatform != stdenv.buildPlatform; + nss = if isCross then buildPackages.nss.tools else "$out"; + in + (stdenv.lib.optionalString enableFIPS ('' + for libname in freebl3 nssdbm3 softokn3 + do '' + + (if stdenv.isDarwin + then '' + libfile="$out/lib/lib$libname.dylib" + DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \ + '' else '' + libfile="$out/lib/lib$libname.so" + LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \ + '') + '' + ${nss}/bin/shlibsign -v -i "$libfile" + done + '')) + + '' + moveToOutput bin "$tools" + moveToOutput bin/nss-config "$dev" + moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example + rm -f "$out"/lib/*.a + + runHook postInstall + ''; + + meta = with stdenv.lib; { + homepage = "https://developer.mozilla.org/en-US/docs/NSS"; + description = "A set of libraries for development of security-enabled client and server applications"; + license = licenses.mpl20; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/nss/default.nix b/nixpkgs/pkgs/development/libraries/nss/default.nix index 8c8a25d807e7..17dc93c9f1ea 100644 --- a/nixpkgs/pkgs/development/libraries/nss/default.nix +++ b/nixpkgs/pkgs/development/libraries/nss/default.nix @@ -1,11 +1,21 @@ -{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja }: +{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja +, # allow FIPS mode. Note that this makes the output non-reproducible. + # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6 + enableFIPS ? false +}: let nssPEM = fetchurl { url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz"; sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw"; }; - version = "3.58"; + + # NOTE: Whenever you updated this version check if the `cacert` package also + # needs an update. You can run the regular updater script for cacerts. + # It will rebuild itself using the version of this package (NSS) and if + # an update is required do the required changes to the expression. + # Example: nix-shell ./maintainers/scripts/update.nix --argstr package cacert + version = "3.60"; underscoreVersion = builtins.replaceStrings ["."] ["_"] version; in stdenv.mkDerivation rec { @@ -14,16 +24,15 @@ in stdenv.mkDerivation rec { src = fetchurl { url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${pname}-${version}.tar.gz"; - sha256 = "1h2kjdicnxprwf6brw0qinlay34vc0dmafajisbrn42zkdwcywwz"; + sha256 = "0ggyj3ax3kal65sl1vl4nfhx2s08blg4dg8iwlxcax5qb9bxbaw4"; }; depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl ninja (buildPackages.python3.withPackages (ps: with ps; [ gyp ])) ] - ++ stdenv.lib.optional stdenv.isDarwin darwin.cctools; + ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ]; - buildInputs = [ zlib sqlite ] - ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + buildInputs = [ zlib sqlite ]; propagatedBuildInputs = [ nspr ]; @@ -68,6 +77,9 @@ in stdenv.mkDerivation rec { else if platform.isx86_32 then "ia32" else if platform.isAarch32 then "arm" else if platform.isAarch64 then "arm64" + else if platform.isPower && platform.is64bit then ( + if platform.isLittleEndian then "ppc64le" else "ppc64" + ) else platform.parsed.cpu.name; # yes, this is correct. nixpkgs uses "host" for the platform the binary will run on whereas nss uses "host" for the platform that the build is running on target = getArch stdenv.hostPlatform; @@ -84,6 +96,7 @@ in stdenv.mkDerivation rec { -Dhost_arch=${host} \ -Duse_system_zlib=1 \ --enable-libpkix \ + ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \ ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \ ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"} @@ -129,7 +142,8 @@ in stdenv.mkDerivation rec { postFixup = let isCross = stdenv.hostPlatform != stdenv.buildPlatform; nss = if isCross then buildPackages.nss.tools else "$out"; - in '' + in + (stdenv.lib.optionalString enableFIPS ('' for libname in freebl3 nssdbm3 softokn3 do '' + (if stdenv.isDarwin @@ -142,7 +156,8 @@ in stdenv.mkDerivation rec { '') + '' ${nss}/bin/shlibsign -v -i "$libfile" done - + '')) + + '' moveToOutput bin "$tools" moveToOutput bin/nss-config "$dev" moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example |