git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #104176 from andir/firefox-83

firefox: 82.0.3 -> 83.0, firefox-esr: 78.4.1esr -> 78.5.0esr, nss: 3.56 -> 3.58, cacert refactor

commite5f945b13b3f6a39ec9fbb66c9794b277dc32aa1 authorAndreas Rammhold <andreas@rammhold.de> dateThu 19 Nov 2020, 00:47 (6 years ago) parent7266caefce1a3e
7 files changed+259−13
pkgs/applications/networking/browsers/firefox/common.nix+32−5 pkgs/applications/networking/browsers/firefox/packages.nix+4−4 pkgs/data/misc/cacert/default.nix+9−2 pkgs/data/misc/cacert/update.sh+34 pkgs/development/libraries/nss/3.53.nix+169 pkgs/development/libraries/nss/default.nix+8−2 pkgs/top-level/all-packages.nix+3
pkgs/applications/networking/browsers/firefox/common.nix+32−5
@@ -4,7 +4,7 @@
44
55{ lib, stdenv, pkgconfig, pango, perl, python2, python3, zip
66, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
7−, freetype, fontconfig, file, nspr, nss, libnotify
7+, freetype, fontconfig, file, nspr, nss, nss_3_53, libnotify
88, yasm, libGLU, libGL, sqlite, unzip, makeWrapper
99, hunspell, libXdamage, libevent, libstartup_notification
1010, libvpx_1_8
@@ -106,6 +106,8 @@ let
106106 # 78 ESR won't build with rustc 1.47
107107 inherit (if lib.versionAtLeast ffversion "82" then rustPackages else rustPackages_1_45)
108108 rustc cargo;
109+
110+ nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss;
109111in
110112
111113buildStdenv.mkDerivation ({
@@ -116,12 +118,37 @@ buildStdenv.mkDerivation ({
116118
117119 patches = [
118120 ./env_var_for_system_dir.patch
119− ] ++ lib.optional pipewireSupport
121+ ] ++
122+
123+ # there are two flavors of pipewire support
124+ # The patches for the ESR release and the patches for the current stable
125+ # release.
126+ # Until firefox upstream stabilizes pipewire support we will have to continue
127+ # tracking multiple versions here.
128+ lib.optional (pipewireSupport && lib.versionOlder ffversion "83")
120129 (fetchpatch {
121130 # https://src.fedoraproject.org/rpms/firefox/blob/master/f/firefox-pipewire-0-3.patch
122131 url = "https://src.fedoraproject.org/rpms/firefox/raw/e99b683a352cf5b2c9ff198756859bae408b5d9d/f/firefox-pipewire-0-3.patch";
123132 sha256 = "0qc62di5823r7ly2lxkclzj9rhg2z7ms81igz44nv0fzv3dszdab";
124133 })
134+ ++
135+ # This picks pipewire patches from fedora that are part of https://bugzilla.mozilla.org/show_bug.cgi?id=1672944
136+ lib.optionals (pipewireSupport && lib.versionAtLeast ffversion "83") (let
137+ fedora_revision = "d6756537dd8cf4d9816dc63ada66ea026e0fd128";
138+ mkPWPatch = spec: fetchpatch {
139+ inherit (spec) name sha256;
140+ url = "https://src.fedoraproject.org/rpms/firefox/raw/${fedora_revision}/f/${spec.name}";
141+ };
142+ in map mkPWPatch [
143+ { name = "pw1.patch"; sha256 = "1a7zvngn3k7dg886zmi38kmrsdzh2rrr46aw59bhr1gfmq8wlwn0"; }
144+ { name = "pw2.patch"; sha256 = "17irg3yb2mchcy0z0nr4k65mwvkps467cvvczr10fnm06lhkhw1l"; }
145+ { name = "pw3.patch"; sha256 = "12p6ql5ff2lfzlni6xkpz63h2xr6n2a9zf8hhjl99fj56rif6706"; }
146+ { name = "pw4.patch"; sha256 = "0rvysc92rdm98s47w5lvbnrklrf7d299k3918qnldniyb4b9p4mg"; }
147+ { name = "pw5.patch"; sha256 = "0kk2yxq4qkfwc4px6m08jrn18a7a7dhrngfiaw84r9ga6sgn0z00"; }
148+ { name = "pw6.patch"; sha256 = "12lhx9wjpw0ahbfmw07wsx76bb223mr453q9cg8cq951vyskch3s"; }
149+ { name = "pw7.patch"; sha256 = "0afw7cfd48vn62zb9y5kd2l26fg44s3aq1kyg3gm4q3rj34xidf6"; }
150+ ])
151+
125152 ++ patches;
126153
127154
@@ -144,7 +171,7 @@ buildStdenv.mkDerivation ({
144171 # yasm can potentially be removed in future versions
145172 # https://bugzilla.mozilla.org/show_bug.cgi?id=1501796
146173 # https://groups.google.com/forum/#!msg/mozilla.dev.platform/o-8levmLU80/SM_zQvfzCQAJ
147− nspr nss
174+ nspr nss_pkg
148175 ]
149176 ++ lib.optional alsaSupport alsaLib
150177 ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
@@ -165,14 +192,14 @@ buildStdenv.mkDerivation ({
165192
166193 NIX_CFLAGS_COMPILE = toString [
167194 "-I${glib.dev}/include/gio-unix-2.0"
168− "-I${nss.dev}/include/nss"
195+ "-I${nss_pkg.dev}/include/nss"
169196 ];
170197
171198 MACH_USE_SYSTEM_PYTHON = "1";
172199
173200 postPatch = ''
174201 rm -rf obj-x86_64-pc-linux-gnu
175− '' + lib.optionalString pipewireSupport ''
202+ '' + lib.optionalString (pipewireSupport && lib.versionOlder ffversion "83") ''
176203 # substitute the /usr/include/ lines for the libraries that pipewire provides.
177204 # The patch we pick from fedora only contains the generated moz.build files
178205 # which hardcode the dependency paths instead of running pkg_config.
pkgs/applications/networking/browsers/firefox/packages.nix+4−4
@@ -7,10 +7,10 @@ in
77rec {
88 firefox = common rec {
99 pname = "firefox";
10− ffversion = "82.0.3";
10+ ffversion = "83.0";
1111 src = fetchurl {
1212 url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz";
13− sha512 = "0j5s5fkph9bm87lv53d4xvfj02qjfqzj5graxcc8air49iqswfmqjdzghna6bj9m8fbn6f5klgm6jbrmavdsycbps0y88x23b6kab5i";
13+ sha512 = "3va5a9471677jfzkhqp8xkba45n0bcpphbabhqbcbnps6p85m3y98pl5jy9q7cpq3a6gxc4ax7bp90yz2nfvfq7i64iz397xpprri2a";
1414 };
1515
1616 patches = [
@@ -35,10 +35,10 @@ rec {
3535
3636 firefox-esr-78 = common rec {
3737 pname = "firefox-esr";
38− ffversion = "78.4.1esr";
38+ ffversion = "78.5.0esr";
3939 src = fetchurl {
4040 url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz";
41− sha512 = "3gfhipbihyznnh822lxams6rm0bcslh31b58lzibjx8a9dn99hy3p04h07slygcqazbz1rrs7b2b8q321fknp27aisk0sz8cynrcw18";
41+ sha512 = "20h53cn7p4dds1yfm166iwbjdmw4fkv5pfk4z0pni6x8ddjvg19imzs6ggmpnfhaji8mnlknm7xp5j7x9vi24awvdxdds5n88rh25hd";
4242 };
4343
4444 patches = [
pkgs/data/misc/cacert/default.nix+9−2
@@ -13,12 +13,17 @@ let
1313 sha256 = "1d4q27j1gss0186a5m8bs5dk786w07ccyq0qi6xmd2zr1a8q16wy";
1414 };
1515
16+ version = "3.57";
17+ underscoreVersion = builtins.replaceStrings ["."] ["_"] version;
1618in
1719
1820stdenv.mkDerivation {
19− name = "nss-cacert-${nss.version}";
21+ name = "nss-cacert-${version}";
2022
21− src = nss.src;
23+ src = fetchurl {
24+ url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/nss-${version}.tar.gz";
25+ sha256 = "55a86c01be860381d64bb4e5b94eb198df9b0f098a8af0e58c014df398bdc382";
26+ };
2227
2328 outputs = [ "out" "unbundled" ];
2429
@@ -60,6 +65,8 @@ stdenv.mkDerivation {
6065
6166 setupHook = ./setup-hook.sh;
6267
68+ passthru.updateScript = ./update.sh;
69+
6370 meta = {
6471 homepage = "https://curl.haxx.se/docs/caextract.html";
6572 description = "A bundle of X.509 certificates of public Certificate Authorities (CA)";
pkgs/data/misc/cacert/update.shnew file+34
@@ -0,0 +1,34 @@
1+#!/usr/bin/env nix-shell
2+#!nix-shell -i bash -p nix common-updater-scripts jq
3+
4+# Build both the cacert package and an overriden version where we use the source attribute of NSS.
5+# Cacert and NSS are both from the same upstream sources. They are decoupled as
6+# the cacert output only cares about a few infrequently changing files in the
7+# sources while the NSS source code changes frequently.
8+#
9+# By having cacert on a older source revision that produces the same
10+# certificate output as a newer version we can avoid large amounts of
11+# unnecessary rebuilds.
12+#
13+# As of this writing there are a few magnitudes more packages depending on
14+# cacert than on nss.
15+
16+
17+set -ex
18+
19+BASEDIR="$(dirname "$0")/../../../.."
20+
21+
22+CURRENT_PATH=$(nix-build --no-out-link -A cacert.out)
23+PATCHED_PATH=$(nix-build --no-out-link -E "with import $BASEDIR {}; (cacert.overrideAttrs (_: { inherit (nss) src version; })).out")
24+
25+# Check the hash of the etc subfolder
26+# We can't check the entire output as that contains the nix-support folder
27+# which contains the output path itself.
28+CURRENT_HASH=$(nix-hash "$CURRENT_PATH/etc")
29+PATCHED_HASH=$(nix-hash "$PATCHED_PATH/etc")
30+
31+if [[ "$CURRENT_HASH" != "$PATCHED_HASH" ]]; then
32+ NSS_VERSION=$(nix-instantiate --json --eval -E "with import $BASEDIR {}; nss.version" | jq -r .)
33+ update-source-version cacert "$NSS_VERSION"
34+fi
pkgs/development/libraries/nss/3.53.nixnew file+169
@@ -0,0 +1,169 @@
1+{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
2+, # allow FIPS mode. Note that this makes the output non-reproducible.
3+ # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6
4+ enableFIPS ? false
5+}:
6+
7+let
8+ nssPEM = fetchurl {
9+ url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz";
10+ sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
11+ };
12+ version = "3.53.1";
13+ underscoreVersion = builtins.replaceStrings ["."] ["_"] version;
14+
15+in stdenv.mkDerivation rec {
16+ pname = "nss";
17+ inherit version;
18+
19+ src = fetchurl {
20+ url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${pname}-${version}.tar.gz";
21+ sha256 = "05jk65x3zy6q8lx2djj8ik7kg741n88iy4n3bblw89cv0xkxxk1d";
22+ };
23+
24+ depsBuildBuild = [ buildPackages.stdenv.cc ];
25+
26+ nativeBuildInputs = [ perl ninja (buildPackages.python3.withPackages (ps: with ps; [ gyp ])) ]
27+ ++ stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools fixDarwinDylibNames ];
28+
29+ buildInputs = [ zlib sqlite ];
30+
31+ propagatedBuildInputs = [ nspr ];
32+
33+ prePatch = ''
34+ # strip the trailing whitespace from the patch line and the renamed CKO_NETSCAPE_ enum to CKO_NSS_
35+ xz -d < ${nssPEM} | sed \
36+ -e 's/-DIRS = builtins $/-DIRS = . builtins/g' \
37+ -e 's/CKO_NETSCAPE_/CKO_NSS_/g' \
38+ -e 's/CKT_NETSCAPE_/CKT_NSS_/g' \
39+ | patch -p1
40+
41+ patchShebangs nss
42+
43+ for f in nss/coreconf/config.gypi nss/build.sh nss/coreconf/config.gypi; do
44+ substituteInPlace "$f" --replace "/usr/bin/env" "${buildPackages.coreutils}/bin/env"
45+ done
46+
47+ substituteInPlace nss/coreconf/config.gypi --replace "/usr/bin/grep" "${buildPackages.coreutils}/bin/env grep"
48+ '';
49+
50+ patches =
51+ [
52+ # Based on http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.4-1/85_security_load.patch
53+ ./85_security_load.patch
54+ ./ckpem.patch
55+ ./fix-cross-compilation.patch
56+ ];
57+
58+ patchFlags = [ "-p0" ];
59+
60+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
61+ substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
62+ substituteInPlace nss/coreconf/config.gypi --replace "'DYLIB_INSTALL_NAME_BASE': '@executable_path'" "'DYLIB_INSTALL_NAME_BASE': '$out/lib'"
63+ '';
64+
65+ outputs = [ "out" "dev" "tools" ];
66+
67+ preConfigure = "cd nss";
68+
69+ buildPhase = let
70+ getArch = platform: if platform.isx86_64 then "x64"
71+ else if platform.isx86_32 then "ia32"
72+ else if platform.isAarch32 then "arm"
73+ else if platform.isAarch64 then "arm64"
74+ else if platform.isPower && platform.is64bit then (
75+ if platform.isLittleEndian then "ppc64le" else "ppc64"
76+ )
77+ else platform.parsed.cpu.name;
78+ # 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
79+ target = getArch stdenv.hostPlatform;
80+ host = getArch stdenv.buildPlatform;
81+ in ''
82+ runHook preBuild
83+
84+ 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
85+ ./build.sh -v --opt \
86+ --with-nspr=${nspr.dev}/include:${nspr.out}/lib \
87+ --system-sqlite \
88+ --enable-legacy-db \
89+ --target ${target} \
90+ -Dhost_arch=${host} \
91+ -Duse_system_zlib=1 \
92+ --enable-libpkix \
93+ ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \
94+ ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \
95+ ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
96+
97+ runHook postBuild
98+ '';
99+
100+ NIX_CFLAGS_COMPILE = "-Wno-error -DNIX_NSS_LIBDIR=\"${placeholder "out"}/lib/\"";
101+
102+ installPhase = ''
103+ runHook preInstall
104+
105+ rm -rf $out/private
106+ find $out -name "*.TOC" -delete
107+ mv $out/public $out/include
108+
109+ ln -s lib $out/lib64
110+
111+ # Upstream issue: https://bugzilla.mozilla.org/show_bug.cgi?id=530672
112+ # https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch?id=af1acce6c6d2c3adb17689261dfe2c2b6771ab8a
113+ NSS_MAJOR_VERSION=`grep "NSS_VMAJOR" lib/nss/nss.h | awk '{print $3}'`
114+ NSS_MINOR_VERSION=`grep "NSS_VMINOR" lib/nss/nss.h | awk '{print $3}'`
115+ NSS_PATCH_VERSION=`grep "NSS_VPATCH" lib/nss/nss.h | awk '{print $3}'`
116+ PREFIX="$out"
117+
118+ mkdir -p $out/lib/pkgconfig
119+ sed -e "s,%prefix%,$PREFIX," \
120+ -e "s,%exec_prefix%,$PREFIX," \
121+ -e "s,%libdir%,$PREFIX/lib64," \
122+ -e "s,%includedir%,$dev/include/nss," \
123+ -e "s,%NSS_VERSION%,$NSS_MAJOR_VERSION.$NSS_MINOR_VERSION.$NSS_PATCH_VERSION,g" \
124+ -e "s,%NSPR_VERSION%,4.16,g" \
125+ pkg/pkg-config/nss.pc.in > $out/lib/pkgconfig/nss.pc
126+ chmod 0644 $out/lib/pkgconfig/nss.pc
127+
128+ sed -e "s,@prefix@,$PREFIX," \
129+ -e "s,@MOD_MAJOR_VERSION@,$NSS_MAJOR_VERSION," \
130+ -e "s,@MOD_MINOR_VERSION@,$NSS_MINOR_VERSION," \
131+ -e "s,@MOD_PATCH_VERSION@,$NSS_PATCH_VERSION," \
132+ pkg/pkg-config/nss-config.in > $out/bin/nss-config
133+ chmod 0755 $out/bin/nss-config
134+ '';
135+
136+ postFixup = let
137+ isCross = stdenv.hostPlatform != stdenv.buildPlatform;
138+ nss = if isCross then buildPackages.nss.tools else "$out";
139+ in
140+ (stdenv.lib.optionalString enableFIPS (''
141+ for libname in freebl3 nssdbm3 softokn3
142+ do '' +
143+ (if stdenv.isDarwin
144+ then ''
145+ libfile="$out/lib/lib$libname.dylib"
146+ DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
147+ '' else ''
148+ libfile="$out/lib/lib$libname.so"
149+ LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
150+ '') + ''
151+ ${nss}/bin/shlibsign -v -i "$libfile"
152+ done
153+ '')) +
154+ ''
155+ moveToOutput bin "$tools"
156+ moveToOutput bin/nss-config "$dev"
157+ moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example
158+ rm -f "$out"/lib/*.a
159+
160+ runHook postInstall
161+ '';
162+
163+ meta = with stdenv.lib; {
164+ homepage = "https://developer.mozilla.org/en-US/docs/NSS";
165+ description = "A set of libraries for development of security-enabled client and server applications";
166+ license = licenses.mpl20;
167+ platforms = platforms.all;
168+ };
169+}
pkgs/development/libraries/nss/default.nix+8−2
@@ -9,7 +9,13 @@ let
99 url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz";
1010 sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
1111 };
12− version = "3.57";
12+
13+ # NOTE: Whenever you updated this version check if the `cacert` package also
14+ # needs an update. You can run the regular updater script for cacerts.
15+ # It will rebuild itself using the version of this package (NSS) and if
16+ # an update is required do the required changes to the expression.
17+ # Example: nix-shell ./maintainers/scripts/update.nix --argstr package cacert
18+ version = "3.59";
1319 underscoreVersion = builtins.replaceStrings ["."] ["_"] version;
1420
1521in stdenv.mkDerivation rec {
@@ -18,7 +24,7 @@ in stdenv.mkDerivation rec {
1824
1925 src = fetchurl {
2026 url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${pname}-${version}.tar.gz";
21− sha256 = "55a86c01be860381d64bb4e5b94eb198df9b0f098a8af0e58c014df398bdc382";
27+ sha256 = "096fs3z21r171q24ca3rq53p1389xmvqz1f2rpm7nlm8r9s82ag6";
2228 };
2329
2430 depsBuildBuild = [ buildPackages.stdenv.cc ];
pkgs/top-level/all-packages.nix+3
@@ -14896,6 +14896,9 @@ julia_15 = callPackage ../development/compilers/julia/1.5.nix {
1489614896 nss_3_44 = lowPrio (callPackage ../development/libraries/nss/3.44.nix { });
1489714897 nssTools = nss.tools;
1489814898
14899+ # required for stable thunderbird and firefox-esr-78
14900+ nss_3_53 = lowPrio (callPackage ../development/libraries/nss/3.53.nix { });
14901+
1489914902 nss_wrapper = callPackage ../development/libraries/nss_wrapper { };
1490014903
1490114904 nsss = skawarePackages.nsss;