Merge pull request #84248 from andir/20.03/firefox

[20.03] update firefox to latests stable (secure) release
This commit is contained in:
Samuel Dionne-Riel
2020-04-04 18:08:00 -04:00
committed by GitHub
8 changed files with 1404 additions and 1167 deletions

View File

@@ -12,6 +12,12 @@
, rust-cbindgen, nodejs, nasm, fetchpatch
, debugBuild ? false
### backorted packages
, nss_3_51
, sqlite_3_31_1
### optionals
## optional libraries
@@ -83,6 +89,13 @@ let
execdir = if stdenv.isDarwin
then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
else "/bin";
# backported dependencies where the versions on the stable release did not meet
# Firefoxs requirements
nss_pkg = if lib.versionAtLeast ffversion "74" then nss_3_51 else nss;
sqlite_pkg = if lib.versionAtLeast ffversion "74" then sqlite_3_31_1 else sqlite;
in
stdenv.mkDerivation ({
@@ -94,11 +107,6 @@ stdenv.mkDerivation ({
patches = [
./env_var_for_system_dir.patch
]
++ lib.optional (lib.versionAtLeast ffversion "73") (fetchpatch {
# https://phabricator.services.mozilla.com/D60667
url = "https://hg.mozilla.org/mozilla-central/raw-rev/b3d8b08265b800165d684281d19ac845a8ff9a66";
sha256 = "0b4s75w7sl619rglcjmlyvyibpj2ar5cpy6pnywl1xpd9qzyb27p";
})
++ patches;
@@ -113,7 +121,7 @@ stdenv.mkDerivation ({
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
libnotify xorg.pixman yasm libGLU libGL
xorg.libXScrnSaver xorg.xorgproto
xorg.libXext sqlite unzip makeWrapper
xorg.libXext sqlite_pkg unzip makeWrapper
libevent libstartup_notification libvpx /* cairo */
icu libpng jemalloc glib
nasm
@@ -121,7 +129,7 @@ stdenv.mkDerivation ({
# yasm can potentially be removed in future versions
# https://bugzilla.mozilla.org/show_bug.cgi?id=1501796
# https://groups.google.com/forum/#!msg/mozilla.dev.platform/o-8levmLU80/SM_zQvfzCQAJ
nspr nss
nspr nss_pkg
]
++ lib.optional alsaSupport alsaLib
@@ -135,7 +143,7 @@ stdenv.mkDerivation ({
NIX_CFLAGS_COMPILE = toString ([
"-I${glib.dev}/include/gio-unix-2.0"
"-I${nss.dev}/include/nss"
"-I${nss_pkg.dev}/include/nss"
]
++ lib.optional (pname == "firefox-esr" && lib.versionOlder ffversion "69")
"-Wno-error=format-security");
@@ -297,6 +305,9 @@ stdenv.mkDerivation ({
inherit browserName;
} // lib.optionalAttrs gtk3Support { inherit gtk3; };
} //
lib.optionalAttrs (lib.versionAtLeast ffversion "74") {
hardeningDisable = [ "format" ]; # -Werror=format-security
} //
# the build system verifies checksums of the bundled rust sources
# ./third_party/rust is be patched by our libtool fixup code in stdenv
# unfortunately we can't just set this to `false` when we do not want it.

View File

@@ -7,10 +7,10 @@ in
rec {
firefox = common rec {
pname = "firefox";
ffversion = "73.0.1";
ffversion = "74.0.1";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz";
sha512 = "1vdz711v44xdiry5vm4rrg7fjkrlnyn5jjkaq0bcf98jwrn9bjklmgwblrrnvmpc9pjd2ff3m7354q7vy6gd6c3yh2jhbq91v2w5yl9";
sha512 = "3aycj3wllsz97x30dxngpbwryqss209cisj91vs1yfgspp8nbl148fk37id6bgl33hga1irc4zxx7glmymibymkfkrmy0xx803w8dy4";
};
patches = [
@@ -33,10 +33,10 @@ rec {
firefox-esr-68 = common rec {
pname = "firefox-esr";
ffversion = "68.6.0esr";
ffversion = "68.6.1esr";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz";
sha512 = "2ipajk86s7hfz7qky9lh24i5fgzgpv9hl12invr1rr6jhpp0h6gbb44ffim0z9lmcj49cr01cgqis0swhb4vph8dl1jvgfq9rjmsml4";
sha512 = "1xg2hdk50ys9np5a0jdwr2wb543sq8ibmvr05h9apmb4yn1hhz3ml9yq9r4v2di4hnb3s181zvq4np5srka2v6aqz8rk7cq46096fls";
};
patches = [

View File

@@ -0,0 +1,140 @@
{ stdenv, fetchurl, nspr, perl, zlib, sqlite, fixDarwinDylibNames, buildPackages }:
let
nssPEM = fetchurl {
url = http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz;
sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
};
version = "3.51";
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 = "1725d0idf5zzqafdqfdn9vprc7ys2ywhv23sqn328di968xqnd3m";
};
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl ];
buildInputs = [ zlib sqlite ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
propagatedBuildInputs = [ nspr ];
prePatch = ''
# strip the trailing whitespace from the patch line…
xz -d < ${nssPEM} | sed -e '/^-DIRS = builtins $/ s/ $//' | patch -p1
'';
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
];
patchFlags = [ "-p0" ];
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
'';
outputs = [ "out" "dev" "tools" ];
preConfigure = "cd nss";
makeFlags = let
cpu = stdenv.hostPlatform.parsed.cpu.name;
in [
"NSPR_INCLUDE_DIR=${nspr.dev}/include"
"NSPR_LIB_DIR=${nspr.out}/lib"
"NSDISTMODE=copy"
"BUILD_OPT=1"
"SOURCE_PREFIX=\$(out)"
"NSS_ENABLE_ECC=1"
"USE_SYSTEM_ZLIB=1"
"NSS_USE_SYSTEM_SQLITE=1"
"NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"OS_TEST=${cpu}"
"CPU_ARCH=${cpu}"
"CROSS_COMPILE=1"
"NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1"
++ stdenv.lib.optional stdenv.isDarwin "CCC=clang++";
NIX_CFLAGS_COMPILE = "-Wno-error";
# TODO(@oxij): investigate this: `make -n check` works but `make
# check` fails with "no rule", same for "installcheck".
doCheck = false;
doInstallCheck = false;
postInstall = ''
rm -rf $out/private
mv $out/public $out/include
mv $out/*.OBJ/* $out/
rmdir $out/*.OBJ
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 ''
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
'';
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;
};
}

View File

@@ -0,0 +1,84 @@
{ stdenv, fetchurl, zlib, interactive ? false, readline ? null, ncurses ? null }:
assert interactive -> readline != null && ncurses != null;
with stdenv.lib;
let
archiveVersion = import ./archive-version.nix stdenv.lib;
in
stdenv.mkDerivation rec {
pname = "sqlite";
version = "3.31.1";
# NB! Make sure to update analyzer.nix src (in the same directory).
src = fetchurl {
url = "https://sqlite.org/2020/sqlite-autoconf-${archiveVersion version}.tar.gz";
sha256 = "1bj936svd8i5g25xd1bj52hj4zca01fgl3sqkj86z9q5pkz4wa32";
};
outputs = [ "bin" "dev" "out" ];
separateDebugInfo = stdenv.isLinux;
buildInputs = [ zlib ] ++ optionals interactive [ readline ncurses ];
configureFlags = [ "--enable-threadsafe" ] ++ optional interactive "--enable-readline";
NIX_CFLAGS_COMPILE = toString [
"-DSQLITE_ENABLE_COLUMN_METADATA"
"-DSQLITE_ENABLE_DBSTAT_VTAB"
"-DSQLITE_ENABLE_JSON1"
"-DSQLITE_ENABLE_FTS3"
"-DSQLITE_ENABLE_FTS3_PARENTHESIS"
"-DSQLITE_ENABLE_FTS3_TOKENIZER"
"-DSQLITE_ENABLE_FTS4"
"-DSQLITE_ENABLE_FTS5"
"-DSQLITE_ENABLE_RTREE"
"-DSQLITE_ENABLE_STMT_SCANSTATUS"
"-DSQLITE_ENABLE_UNLOCK_NOTIFY"
"-DSQLITE_SOUNDEX"
"-DSQLITE_SECURE_DELETE"
"-DSQLITE_MAX_VARIABLE_NUMBER=250000"
"-DSQLITE_MAX_EXPR_DEPTH=10000"
];
# Test for features which may not be available at compile time
preBuild = ''
# Use pread(), pread64(), pwrite(), pwrite64() functions for better performance if they are available.
if cc -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread_pwrite_test" <<< \
''$'#include <unistd.h>\nint main()\n{\n pread(0, NULL, 0, 0);\n pwrite(0, NULL, 0, 0);\n return 0;\n}'; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD"
fi
if cc -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread64_pwrite64_test" <<< \
''$'#include <unistd.h>\nint main()\n{\n pread64(0, NULL, 0, 0);\n pwrite64(0, NULL, 0, 0);\n return 0;\n}'; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD64"
elif cc -D_LARGEFILE64_SOURCE -Werror=implicit-function-declaration -x c - -o "$TMPDIR/pread64_pwrite64_test" <<< \
''$'#include <unistd.h>\nint main()\n{\n pread64(0, NULL, 0, 0);\n pwrite64(0, NULL, 0, 0);\n return 0;\n}'; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DUSE_PREAD64 -D_LARGEFILE64_SOURCE"
fi
# Necessary for FTS5 on Linux
export NIX_LDFLAGS="$NIX_LDFLAGS -lm"
echo ""
echo "NIX_CFLAGS_COMPILE = $NIX_CFLAGS_COMPILE"
echo ""
'';
postInstall = ''
# Do not contaminate dependent libtool-based projects with sqlite dependencies.
sed -i $out/lib/libsqlite3.la -e "s/dependency_libs=.*/dependency_libs='''/"
'';
doCheck = false; # fails to link against tcl
meta = {
description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
downloadPage = https://sqlite.org/download.html;
homepage = https://www.sqlite.org/;
license = licenses.publicDomain;
maintainers = with maintainers; [ eelco np ];
platforms = platforms.unix ++ platforms.windows;
};
}

View File

@@ -13489,6 +13489,7 @@ in
inherit (darwin.apple_sdk.frameworks) CoreServices;
};
nss_3_51 = lowPrio (callPackage ../development/libraries/nss/3_51.nix { });
nss = lowPrio (callPackage ../development/libraries/nss { });
nssTools = nss.tools;
@@ -14324,6 +14325,7 @@ in
stxxl = callPackage ../development/libraries/stxxl { parallel = true; };
sqlite = lowPrio (callPackage ../development/libraries/sqlite { });
sqlite_3_31_1 = lowPrio (callPackage ../development/libraries/sqlite/3_31_1.nix { });
sqlite-analyzer = lowPrio (callPackage ../development/libraries/sqlite/analyzer.nix { });