2018-10-01 01:00:00 +01:00
|
|
|
{ pname, ffversion, meta, updateScript ? null
|
|
|
|
, src, unpackPhase ? null, patches ? []
|
2020-02-01 17:56:13 +00:00
|
|
|
, extraNativeBuildInputs ? [], extraConfigureFlags ? [], extraMakeFlags ? [] }:
|
2017-03-27 13:33:00 +01:00
|
|
|
|
2020-06-20 22:33:39 +01:00
|
|
|
{ lib, stdenv, pkgconfig, pango, perl, python2, python3, zip
|
2018-02-25 02:23:58 +00:00
|
|
|
, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
|
2020-11-18 14:15:01 +00:00
|
|
|
, freetype, fontconfig, file, nspr, nss, nss_3_53, libnotify
|
2019-11-10 16:44:34 +00:00
|
|
|
, yasm, libGLU, libGL, sqlite, unzip, makeWrapper
|
2020-04-06 16:34:05 +01:00
|
|
|
, hunspell, libXdamage, libevent, libstartup_notification
|
2020-09-10 01:06:07 +01:00
|
|
|
, libvpx_1_8
|
|
|
|
, icu67, libpng, jemalloc, glib
|
2020-11-07 13:53:42 +00:00
|
|
|
, autoconf213, which, gnused, rustPackages, rustPackages_1_45
|
2019-04-06 15:52:35 +01:00
|
|
|
, rust-cbindgen, nodejs, nasm, fetchpatch
|
2020-10-20 14:56:14 +01:00
|
|
|
, gnum4
|
2013-10-06 05:07:42 +01:00
|
|
|
, debugBuild ? false
|
2017-03-27 13:33:00 +01:00
|
|
|
|
|
|
|
### optionals
|
|
|
|
|
2017-03-27 13:35:34 +01:00
|
|
|
## optional libraries
|
|
|
|
|
2018-07-10 23:10:04 +01:00
|
|
|
, alsaSupport ? stdenv.isLinux, alsaLib
|
2018-11-07 09:07:40 +00:00
|
|
|
, pulseaudioSupport ? stdenv.isLinux, libpulseaudio
|
2018-11-14 22:29:48 +00:00
|
|
|
, ffmpegSupport ? true
|
2018-10-01 01:00:00 +01:00
|
|
|
, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
|
2020-10-06 11:10:08 +01:00
|
|
|
, waylandSupport ? true, libxkbcommon
|
2020-10-23 01:50:02 +01:00
|
|
|
# LTO is disabled since it caused segfaults on wayland see https://github.com/NixOS/nixpkgs/issues/10142
|
|
|
|
, ltoSupport ? false, overrideCC, buildPackages
|
2017-09-27 14:30:29 +01:00
|
|
|
, gssSupport ? true, kerberos
|
2020-10-06 11:10:08 +01:00
|
|
|
, pipewireSupport ? waylandSupport && webrtcSupport, pipewire
|
2017-03-27 13:33:00 +01:00
|
|
|
|
2017-03-27 13:35:34 +01:00
|
|
|
## privacy-related options
|
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
, privacySupport ? false
|
2017-03-27 13:35:34 +01:00
|
|
|
|
|
|
|
# WARNING: NEVER set any of the options below to `true` by default.
|
2019-04-06 15:49:14 +01:00
|
|
|
# Set to `!privacySupport` or `false`.
|
2017-03-27 13:35:34 +01:00
|
|
|
|
2019-04-06 15:49:14 +01:00
|
|
|
# webrtcSupport breaks the aarch64 build on version >= 60, fixed in 63.
|
2018-05-13 18:19:55 +01:00
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1434589
|
2020-02-01 17:56:13 +00:00
|
|
|
, webrtcSupport ? !privacySupport
|
2017-11-15 00:00:00 +00:00
|
|
|
, geolocationSupport ? !privacySupport
|
|
|
|
, googleAPISupport ? geolocationSupport
|
2017-03-27 13:33:00 +01:00
|
|
|
, crashreporterSupport ? false
|
|
|
|
|
2017-11-15 00:00:00 +00:00
|
|
|
, safeBrowsingSupport ? false
|
2017-03-27 13:33:00 +01:00
|
|
|
, drmSupport ? false
|
|
|
|
|
2018-07-10 23:10:04 +01:00
|
|
|
# macOS dependencies
|
2018-07-11 22:01:35 +01:00
|
|
|
, xcbuild, CoreMedia, ExceptionHandling, Kerberos, AVFoundation, MediaToolbox
|
2018-07-29 05:15:14 +01:00
|
|
|
, CoreLocation, Foundation, AddressBook, libobjc, cups, rsync
|
2018-07-10 23:10:04 +01:00
|
|
|
|
2017-03-27 13:35:34 +01:00
|
|
|
## other
|
|
|
|
|
2018-01-31 16:50:10 +00:00
|
|
|
# As stated by Sylvestre Ledru (@sylvestre) on Nov 22, 2017 at
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/31843#issuecomment-346372756 we
|
|
|
|
# have permission to use the official firefox branding.
|
|
|
|
#
|
2020-07-24 08:49:43 +01:00
|
|
|
# For purposes of documentation the statement of @sylvestre:
|
2018-01-31 16:50:10 +00:00
|
|
|
# > As the person who did part of the work described in the LWN article
|
|
|
|
# > and release manager working for Mozilla, I can confirm the statement
|
|
|
|
# > that I made in
|
|
|
|
# > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815006
|
|
|
|
# >
|
|
|
|
# > @garbas shared with me the list of patches applied for the Nix package.
|
|
|
|
# > As they are just for portability and tiny modifications, they don't
|
|
|
|
# > alter the experience of the product. In parallel, Rok also shared the
|
|
|
|
# > build options. They seem good (even if I cannot judge the quality of the
|
|
|
|
# > packaging of the underlying dependencies like sqlite, png, etc).
|
|
|
|
# > Therefor, as long as you keep the patch queue sane and you don't alter
|
|
|
|
# > the experience of Firefox users, you won't have any issues using the
|
|
|
|
# > official branding.
|
|
|
|
, enableOfficialBranding ? true
|
2013-06-06 12:07:54 +01:00
|
|
|
}:
|
|
|
|
|
2018-02-01 00:00:00 +00:00
|
|
|
assert stdenv.cc.libc or null != null;
|
2020-10-06 11:10:08 +01:00
|
|
|
assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "pipewireSupport requires both wayland and webrtc support.";
|
2020-10-09 04:29:13 +01:00
|
|
|
assert ltoSupport -> stdenv.isDarwin -> throw "LTO is broken on Darwin (see PR#19312).";
|
2013-06-06 12:07:54 +01:00
|
|
|
|
2015-09-03 09:54:13 +01:00
|
|
|
let
|
2017-03-27 13:33:00 +01:00
|
|
|
flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
|
2018-07-10 23:10:04 +01:00
|
|
|
|
|
|
|
default-toolkit = if stdenv.isDarwin then "cairo-cocoa"
|
2019-02-03 10:34:39 +00:00
|
|
|
else "cairo-gtk${if gtk3Support then "3${lib.optionalString waylandSupport "-wayland"}" else "2"}";
|
2018-07-29 05:15:14 +01:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
binaryName = "firefox";
|
2019-01-01 00:00:00 +00:00
|
|
|
binaryNameCapitalized = lib.toUpper (lib.substring 0 1 binaryName) + lib.substring 1 (-1) binaryName;
|
|
|
|
|
|
|
|
browserName = if stdenv.isDarwin then binaryNameCapitalized else binaryName;
|
|
|
|
|
2018-07-29 05:15:14 +01:00
|
|
|
execdir = if stdenv.isDarwin
|
2019-01-01 00:00:00 +00:00
|
|
|
then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
|
2018-07-29 05:15:14 +01:00
|
|
|
else "/bin";
|
2020-10-06 11:10:08 +01:00
|
|
|
|
2020-10-09 04:29:13 +01:00
|
|
|
# Darwin's stdenv provides the default llvmPackages version, match that since
|
|
|
|
# clang LTO on Darwin is broken so the stdenv is not being changed.
|
|
|
|
llvmPackages = if stdenv.isDarwin
|
|
|
|
then buildPackages.llvmPackages
|
|
|
|
else buildPackages.llvmPackages_10;
|
2020-10-06 19:14:06 +01:00
|
|
|
|
2020-10-09 04:29:13 +01:00
|
|
|
# When LTO for Darwin is fixed, the following will need updating as lld
|
|
|
|
# doesn't work on it. For now it is fine since ltoSupport implies no Darwin.
|
2020-10-06 19:14:06 +01:00
|
|
|
buildStdenv = if ltoSupport
|
|
|
|
then overrideCC stdenv llvmPackages.lldClang
|
|
|
|
else stdenv;
|
2020-11-07 13:53:42 +00:00
|
|
|
|
|
|
|
# 78 ESR won't build with rustc 1.47
|
|
|
|
inherit (if lib.versionAtLeast ffversion "82" then rustPackages else rustPackages_1_45)
|
|
|
|
rustc cargo;
|
2020-11-18 14:15:01 +00:00
|
|
|
|
|
|
|
nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss;
|
2020-02-01 17:56:13 +00:00
|
|
|
in
|
|
|
|
|
2020-10-06 19:14:06 +01:00
|
|
|
buildStdenv.mkDerivation ({
|
2020-02-01 17:56:13 +00:00
|
|
|
name = "${pname}-unwrapped-${ffversion}";
|
|
|
|
version = ffversion;
|
2019-01-01 00:00:00 +00:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
inherit src unpackPhase meta;
|
2019-01-31 16:38:01 +00:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
patches = [
|
2019-01-31 16:38:01 +00:00
|
|
|
./env_var_for_system_dir.patch
|
2020-11-18 11:47:05 +00:00
|
|
|
] ++
|
|
|
|
|
|
|
|
# there are two flavors of pipewire support
|
|
|
|
# The patches for the ESR release and the patches for the current stable
|
|
|
|
# release.
|
|
|
|
# Until firefox upstream stabilizes pipewire support we will have to continue
|
|
|
|
# tracking multiple versions here.
|
|
|
|
lib.optional (pipewireSupport && lib.versionOlder ffversion "83")
|
2020-08-13 06:30:03 +01:00
|
|
|
(fetchpatch {
|
|
|
|
# https://src.fedoraproject.org/rpms/firefox/blob/master/f/firefox-pipewire-0-3.patch
|
|
|
|
url = "https://src.fedoraproject.org/rpms/firefox/raw/e99b683a352cf5b2c9ff198756859bae408b5d9d/f/firefox-pipewire-0-3.patch";
|
|
|
|
sha256 = "0qc62di5823r7ly2lxkclzj9rhg2z7ms81igz44nv0fzv3dszdab";
|
|
|
|
})
|
2020-11-18 11:47:05 +00:00
|
|
|
++
|
|
|
|
# This picks pipewire patches from fedora that are part of https://bugzilla.mozilla.org/show_bug.cgi?id=1672944
|
|
|
|
lib.optionals (pipewireSupport && lib.versionAtLeast ffversion "83") (let
|
|
|
|
fedora_revision = "d6756537dd8cf4d9816dc63ada66ea026e0fd128";
|
|
|
|
mkPWPatch = spec: fetchpatch {
|
|
|
|
inherit (spec) name sha256;
|
|
|
|
url = "https://src.fedoraproject.org/rpms/firefox/raw/${fedora_revision}/f/${spec.name}";
|
|
|
|
};
|
|
|
|
in map mkPWPatch [
|
|
|
|
{ name = "pw1.patch"; sha256 = "1a7zvngn3k7dg886zmi38kmrsdzh2rrr46aw59bhr1gfmq8wlwn0"; }
|
|
|
|
{ name = "pw2.patch"; sha256 = "17irg3yb2mchcy0z0nr4k65mwvkps467cvvczr10fnm06lhkhw1l"; }
|
|
|
|
{ name = "pw3.patch"; sha256 = "12p6ql5ff2lfzlni6xkpz63h2xr6n2a9zf8hhjl99fj56rif6706"; }
|
|
|
|
{ name = "pw4.patch"; sha256 = "0rvysc92rdm98s47w5lvbnrklrf7d299k3918qnldniyb4b9p4mg"; }
|
|
|
|
{ name = "pw5.patch"; sha256 = "0kk2yxq4qkfwc4px6m08jrn18a7a7dhrngfiaw84r9ga6sgn0z00"; }
|
|
|
|
{ name = "pw6.patch"; sha256 = "12lhx9wjpw0ahbfmw07wsx76bb223mr453q9cg8cq951vyskch3s"; }
|
|
|
|
{ name = "pw7.patch"; sha256 = "0afw7cfd48vn62zb9y5kd2l26fg44s3aq1kyg3gm4q3rj34xidf6"; }
|
|
|
|
])
|
|
|
|
|
2019-12-07 18:22:10 +00:00
|
|
|
++ patches;
|
2019-01-31 16:38:01 +00:00
|
|
|
|
2017-03-27 13:33:00 +01:00
|
|
|
|
2019-01-23 00:04:04 +00:00
|
|
|
# Ignore trivial whitespace changes in patches, this fixes compatibility of
|
|
|
|
# ./env_var_for_system_dir.patch with Firefox >=65 without having to track
|
|
|
|
# two patches.
|
|
|
|
patchFlags = [ "-p1" "-l" ];
|
|
|
|
|
2017-03-27 13:33:00 +01:00
|
|
|
buildInputs = [
|
2020-06-20 22:33:39 +01:00
|
|
|
gtk2 perl zip libjpeg zlib bzip2
|
2018-07-12 14:05:52 +01:00
|
|
|
dbus dbus-glib pango freetype fontconfig xorg.libXi xorg.libXcursor
|
2017-03-27 13:33:00 +01:00
|
|
|
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
|
2019-11-10 16:44:34 +00:00
|
|
|
libnotify xorg.pixman yasm libGLU libGL
|
2020-08-21 10:12:43 +01:00
|
|
|
xorg.xorgproto
|
2020-04-06 16:34:05 +01:00
|
|
|
xorg.libXext unzip makeWrapper
|
|
|
|
libevent libstartup_notification /* cairo */
|
2020-07-01 14:54:25 +01:00
|
|
|
libpng jemalloc glib
|
2020-09-10 01:06:07 +01:00
|
|
|
nasm icu67 libvpx_1_8
|
2020-02-01 17:56:13 +00:00
|
|
|
# >= 66 requires nasm for the AV1 lib dav1d
|
|
|
|
# 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
|
2020-11-18 14:15:01 +00:00
|
|
|
nspr nss_pkg
|
2017-03-27 13:33:00 +01:00
|
|
|
]
|
|
|
|
++ lib.optional alsaSupport alsaLib
|
|
|
|
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
|
2017-09-27 14:30:29 +01:00
|
|
|
++ lib.optional gtk3Support gtk3
|
2018-07-10 23:10:04 +01:00
|
|
|
++ lib.optional gssSupport kerberos
|
2020-10-06 19:14:06 +01:00
|
|
|
++ lib.optional ltoSupport llvmPackages.libunwind
|
2020-10-06 11:10:08 +01:00
|
|
|
++ lib.optionals waylandSupport [ libxkbcommon ]
|
|
|
|
++ lib.optionals pipewireSupport [ pipewire ]
|
2020-10-20 14:56:14 +01:00
|
|
|
++ lib.optionals (lib.versionAtLeast ffversion "82") [ gnum4 ]
|
2020-10-06 19:14:06 +01:00
|
|
|
++ lib.optionals buildStdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
|
|
|
|
AVFoundation MediaToolbox CoreLocation
|
|
|
|
Foundation libobjc AddressBook cups ];
|
|
|
|
|
|
|
|
NIX_LDFLAGS = lib.optionalString ltoSupport ''
|
|
|
|
-rpath ${placeholder "out"}/lib/${binaryName}
|
|
|
|
-rpath ${llvmPackages.libunwind.out}/lib
|
|
|
|
'';
|
2018-07-11 22:01:35 +01:00
|
|
|
|
2020-09-10 01:06:07 +01:00
|
|
|
NIX_CFLAGS_COMPILE = toString [
|
2018-10-01 01:00:00 +01:00
|
|
|
"-I${glib.dev}/include/gio-unix-2.0"
|
2020-11-18 14:15:01 +00:00
|
|
|
"-I${nss_pkg.dev}/include/nss"
|
2020-09-10 01:06:07 +01:00
|
|
|
];
|
2018-07-11 22:01:35 +01:00
|
|
|
|
2020-09-21 07:13:00 +01:00
|
|
|
MACH_USE_SYSTEM_PYTHON = "1";
|
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
postPatch = ''
|
2019-07-14 06:54:14 +01:00
|
|
|
rm -rf obj-x86_64-pc-linux-gnu
|
2020-11-18 11:47:05 +00:00
|
|
|
'' + lib.optionalString (pipewireSupport && lib.versionOlder ffversion "83") ''
|
2020-10-06 11:10:08 +01:00
|
|
|
# substitute the /usr/include/ lines for the libraries that pipewire provides.
|
|
|
|
# The patch we pick from fedora only contains the generated moz.build files
|
|
|
|
# which hardcode the dependency paths instead of running pkg_config.
|
2020-08-13 06:30:03 +01:00
|
|
|
substituteInPlace \
|
|
|
|
media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build \
|
|
|
|
--replace /usr/include ${pipewire.dev}/include
|
2020-08-27 11:17:59 +01:00
|
|
|
'' + lib.optionalString (lib.versionAtLeast ffversion "80") ''
|
|
|
|
substituteInPlace dom/system/IOUtils.h \
|
|
|
|
--replace '#include "nspr/prio.h"' '#include "prio.h"'
|
|
|
|
|
|
|
|
substituteInPlace dom/system/IOUtils.cpp \
|
|
|
|
--replace '#include "nspr/prio.h"' '#include "prio.h"' \
|
|
|
|
--replace '#include "nspr/private/pprio.h"' '#include "private/pprio.h"' \
|
|
|
|
--replace '#include "nspr/prtypes.h"' '#include "prtypes.h"'
|
2018-07-11 22:01:35 +01:00
|
|
|
'';
|
2017-09-28 01:13:15 +01:00
|
|
|
|
2017-04-23 03:50:33 +01:00
|
|
|
nativeBuildInputs =
|
2020-02-01 17:56:13 +00:00
|
|
|
[
|
|
|
|
autoconf213
|
|
|
|
cargo
|
|
|
|
gnused
|
|
|
|
llvmPackages.llvm # llvm-objdump
|
|
|
|
nodejs
|
|
|
|
perl
|
|
|
|
pkgconfig
|
|
|
|
python2
|
|
|
|
python3
|
|
|
|
rust-cbindgen
|
|
|
|
rustc
|
|
|
|
which
|
|
|
|
]
|
2018-07-10 23:10:04 +01:00
|
|
|
++ lib.optional gtk3Support wrapGAppsHook
|
2020-10-06 19:14:06 +01:00
|
|
|
++ lib.optionals buildStdenv.isDarwin [ xcbuild rsync ]
|
2018-07-10 23:10:04 +01:00
|
|
|
++ extraNativeBuildInputs;
|
2017-03-27 13:33:00 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# remove distributed configuration files
|
|
|
|
rm -f configure
|
|
|
|
rm -f js/src/configure
|
|
|
|
rm -f .mozconfig*
|
2020-02-01 17:56:13 +00:00
|
|
|
# this will run autoconf213
|
2018-02-01 00:00:00 +00:00
|
|
|
configureScript="$(realpath ./mach) configure"
|
2018-07-11 22:01:35 +01:00
|
|
|
export MOZCONFIG=$(pwd)/mozconfig
|
|
|
|
|
|
|
|
# Set C flags for Rust's bindgen program. Unlike ordinary C
|
|
|
|
# compilation, bindgen does not invoke $CC directly. Instead it
|
|
|
|
# uses LLVM's libclang. To make sure all necessary flags are
|
|
|
|
# included we need to look in a few places.
|
|
|
|
# TODO: generalize this process for other use-cases.
|
2018-07-29 05:15:14 +01:00
|
|
|
|
2020-10-06 19:14:06 +01:00
|
|
|
BINDGEN_CFLAGS="$(< ${buildStdenv.cc}/nix-support/libc-crt1-cflags) \
|
|
|
|
$(< ${buildStdenv.cc}/nix-support/libc-cflags) \
|
|
|
|
$(< ${buildStdenv.cc}/nix-support/cc-cflags) \
|
|
|
|
$(< ${buildStdenv.cc}/nix-support/libcxx-cxxflags) \
|
|
|
|
${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
|
|
|
|
${lib.optionalString buildStdenv.cc.isGNU "-isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc} -isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc}/${buildStdenv.hostPlatform.config}"} \
|
2018-07-29 05:15:14 +01:00
|
|
|
$NIX_CFLAGS_COMPILE"
|
|
|
|
|
|
|
|
echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
|
2020-02-01 17:56:13 +00:00
|
|
|
'' + (lib.optionalString googleAPISupport ''
|
2018-01-31 00:52:10 +00:00
|
|
|
# Google API key used by Chromium and Firefox.
|
|
|
|
# Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
|
|
|
|
# please get your own set of keys.
|
|
|
|
echo "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI" > $TMPDIR/ga
|
2019-03-01 08:22:32 +00:00
|
|
|
# 60.5+ & 66+ did split the google API key arguments: https://bugzilla.mozilla.org/show_bug.cgi?id=1531176
|
2020-02-01 17:56:13 +00:00
|
|
|
configureFlagsArray+=("--with-google-location-service-api-keyfile=$TMPDIR/ga")
|
|
|
|
configureFlagsArray+=("--with-google-safebrowsing-api-keyfile=$TMPDIR/ga")
|
|
|
|
'') + ''
|
|
|
|
# AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286
|
2018-12-11 09:37:55 +00:00
|
|
|
unset AS
|
2017-03-27 13:33:00 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-application=browser"
|
|
|
|
"--with-system-jpeg"
|
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-libevent"
|
|
|
|
"--with-system-libvpx"
|
|
|
|
"--with-system-png" # needs APNG support
|
|
|
|
"--with-system-icu"
|
|
|
|
"--enable-system-ffi"
|
|
|
|
"--enable-system-pixman"
|
|
|
|
#"--enable-system-cairo"
|
|
|
|
"--disable-tests"
|
|
|
|
"--disable-necko-wifi" # maybe we want to enable this at some point
|
|
|
|
"--disable-updater"
|
|
|
|
"--enable-jemalloc"
|
2018-07-10 23:10:04 +01:00
|
|
|
"--enable-default-toolkit=${default-toolkit}"
|
2018-01-16 21:19:02 +00:00
|
|
|
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
2017-04-01 01:00:00 +01:00
|
|
|
"--with-system-nspr"
|
2018-10-01 01:00:00 +01:00
|
|
|
"--with-system-nss"
|
2017-04-01 01:00:00 +01:00
|
|
|
]
|
2020-10-06 19:14:06 +01:00
|
|
|
++ lib.optional (buildStdenv.isDarwin) "--disable-xcode-checks"
|
|
|
|
++ lib.optional (!ltoSupport) "--with-clang-path=${llvmPackages.clang}/bin/clang"
|
2020-10-09 02:55:23 +01:00
|
|
|
# LTO is done using clang and lld on Linux.
|
|
|
|
# Darwin needs to use the default linker as lld is not supported (yet?):
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1538724
|
2020-10-09 04:29:13 +01:00
|
|
|
# elf-hack is broken when using clang+lld:
|
2020-10-09 02:55:23 +01:00
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
|
2020-10-06 19:14:06 +01:00
|
|
|
++ lib.optionals ltoSupport [
|
|
|
|
"--enable-lto"
|
|
|
|
"--disable-elf-hack"
|
2020-10-09 02:55:23 +01:00
|
|
|
] ++ lib.optional (ltoSupport && !buildStdenv.isDarwin) "--enable-linker=lld"
|
2017-04-01 01:00:00 +01:00
|
|
|
|
2017-03-27 13:33:00 +01:00
|
|
|
++ flag alsaSupport "alsa"
|
|
|
|
++ flag pulseaudioSupport "pulseaudio"
|
|
|
|
++ flag ffmpegSupport "ffmpeg"
|
2017-09-27 14:30:29 +01:00
|
|
|
++ flag gssSupport "negotiateauth"
|
2017-03-27 13:33:00 +01:00
|
|
|
++ flag webrtcSupport "webrtc"
|
|
|
|
++ flag crashreporterSupport "crashreporter"
|
2017-07-01 04:06:51 +01:00
|
|
|
++ lib.optional drmSupport "--enable-eme=widevine"
|
2017-03-27 13:33:00 +01:00
|
|
|
|
|
|
|
++ (if debugBuild then [ "--enable-debug" "--enable-profiling" ]
|
|
|
|
else [ "--disable-debug" "--enable-release"
|
|
|
|
"--enable-optimize"
|
|
|
|
"--enable-strip" ])
|
2017-08-15 01:00:00 +01:00
|
|
|
++ lib.optional enableOfficialBranding "--enable-official-branding"
|
|
|
|
++ extraConfigureFlags;
|
2014-07-23 14:31:49 +01:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
postConfigure = ''
|
2018-02-01 00:00:00 +00:00
|
|
|
cd obj-*
|
|
|
|
'';
|
|
|
|
|
2017-08-15 01:00:00 +01:00
|
|
|
makeFlags = lib.optionals enableOfficialBranding [
|
|
|
|
"MOZILLA_OFFICIAL=1"
|
|
|
|
"BUILD_OFFICIAL=1"
|
|
|
|
]
|
|
|
|
++ extraMakeFlags;
|
|
|
|
|
2014-07-23 14:31:49 +01:00
|
|
|
enableParallelBuilding = true;
|
2018-04-25 04:20:18 +01:00
|
|
|
doCheck = false; # "--disable-tests" above
|
2014-07-23 14:31:49 +01:00
|
|
|
|
2020-10-06 19:14:06 +01:00
|
|
|
installPhase = if buildStdenv.isDarwin then ''
|
2018-07-29 05:15:14 +01:00
|
|
|
mkdir -p $out/Applications
|
2019-01-01 00:00:00 +00:00
|
|
|
cp -LR dist/${binaryNameCapitalized}.app $out/Applications
|
2018-07-29 05:15:14 +01:00
|
|
|
'' else null;
|
|
|
|
|
2020-10-06 19:14:06 +01:00
|
|
|
postInstall = lib.optionalString buildStdenv.isLinux ''
|
2017-03-27 13:33:00 +01:00
|
|
|
# Remove SDK cruft. FIXME: move to a separate output?
|
2019-01-01 00:00:00 +00:00
|
|
|
rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-*
|
2017-03-27 13:33:00 +01:00
|
|
|
|
|
|
|
# Needed to find Mozilla runtime
|
2019-01-01 00:00:00 +00:00
|
|
|
gappsWrapperArgs+=(--argv0 "$out/bin/.${binaryName}-wrapped")
|
2017-03-27 13:33:00 +01:00
|
|
|
'';
|
|
|
|
|
2020-10-06 19:14:06 +01:00
|
|
|
postFixup = lib.optionalString buildStdenv.isLinux ''
|
2016-09-18 22:19:51 +01:00
|
|
|
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
|
2017-03-27 13:33:00 +01:00
|
|
|
patchelf --set-rpath "${lib.getLib libnotify
|
2019-01-01 00:00:00 +00:00
|
|
|
}/lib:$(patchelf --print-rpath "$out"/lib/${binaryName}*/libxul.so)" \
|
|
|
|
"$out"/lib/${binaryName}*/libxul.so
|
2020-08-21 10:12:43 +01:00
|
|
|
patchelf --add-needed ${xorg.libXScrnSaver.out}/lib/libXss.so $out/lib/${binaryName}/${binaryName}
|
2017-03-27 13:33:00 +01:00
|
|
|
'';
|
2016-09-18 22:19:51 +01:00
|
|
|
|
2017-04-09 18:17:40 +01:00
|
|
|
doInstallCheck = true;
|
2017-03-27 13:33:00 +01:00
|
|
|
installCheckPhase = ''
|
|
|
|
# Some basic testing
|
2018-07-29 05:15:14 +01:00
|
|
|
"$out${execdir}/${browserName}" --version
|
2017-03-27 13:33:00 +01:00
|
|
|
'';
|
2013-06-06 12:07:54 +01:00
|
|
|
|
2014-07-23 14:31:49 +01:00
|
|
|
passthru = {
|
2020-02-01 17:56:13 +00:00
|
|
|
inherit updateScript;
|
|
|
|
version = ffversion;
|
2017-03-27 13:33:00 +01:00
|
|
|
isFirefox3Like = true;
|
|
|
|
gtk = gtk2;
|
2020-10-22 02:47:30 +01:00
|
|
|
inherit alsaSupport;
|
2017-03-27 13:33:00 +01:00
|
|
|
inherit nspr;
|
|
|
|
inherit ffmpegSupport;
|
2017-09-27 14:30:29 +01:00
|
|
|
inherit gssSupport;
|
2018-07-29 05:15:14 +01:00
|
|
|
inherit execdir;
|
|
|
|
inherit browserName;
|
2017-05-04 21:09:15 +01:00
|
|
|
} // lib.optionalAttrs gtk3Support { inherit gtk3; };
|
2020-09-10 01:06:07 +01:00
|
|
|
|
2020-03-12 13:47:56 +00:00
|
|
|
hardeningDisable = [ "format" ]; # -Werror=format-security
|
2020-02-01 17:56:13 +00:00
|
|
|
|
2020-09-10 01:06:07 +01:00
|
|
|
# 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.
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/77289 for more details
|
2020-01-08 22:14:50 +00:00
|
|
|
# Ideally we would figure out how to tell the build system to not
|
|
|
|
# care about changed hashes as we are already doing that when we
|
|
|
|
# fetch the sources. Any further modifications of the source tree
|
|
|
|
# is on purpose by some of our tool (or by accident and a bug?).
|
2020-01-07 17:40:56 +00:00
|
|
|
dontFixLibtool = true;
|
2020-01-08 22:14:50 +00:00
|
|
|
|
|
|
|
# on aarch64 this is also required
|
|
|
|
dontUpdateAutotoolsGnuConfigScripts = true;
|
2020-01-07 17:40:56 +00:00
|
|
|
})
|