nss: format, cleanup

This commit is contained in:
Sandro Jäckel 2021-08-10 13:01:37 +02:00
parent 81777e9a43
commit 4b84c7a0c8
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -1,4 +1,14 @@
{ lib, stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
{ lib
, 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
@ -9,7 +19,8 @@ let
url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz";
sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
};
in stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "nss";
version = "3.53.1";
@ -44,8 +55,7 @@ in stdenv.mkDerivation rec {
substituteInPlace nss/coreconf/config.gypi --replace "/usr/bin/grep" "${buildPackages.coreutils}/bin/env grep"
'';
patches =
[
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
@ -63,19 +73,23 @@ in stdenv.mkDerivation rec {
preConfigure = "cd nss";
buildPhase = let
getArch = platform: if platform.isx86_64 then "x64"
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 (
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 ''
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
@ -130,7 +144,8 @@ in stdenv.mkDerivation rec {
chmod 0755 $out/bin/nss-config
'';
postFixup = let
postFixup =
let
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
nss = if isCross then buildPackages.nss.tools else "$out";
in
@ -158,8 +173,9 @@ in stdenv.mkDerivation rec {
'';
meta = with lib; {
homepage = "https://developer.mozilla.org/en-US/docs/NSS";
homepage = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS";
description = "A set of libraries for development of security-enabled client and server applications";
maintainers = with maintainers; [ ];
license = licenses.mpl20;
platforms = platforms.all;
};