2021-07-13 17:04:57 +00:00
|
|
|
{ pname, version, meta, updateScript ? null
|
|
|
|
, binaryName ? "firefox", application ? "browser"
|
2018-10-01 00:00:00 +00:00
|
|
|
, src, unpackPhase ? null, patches ? []
|
2022-02-11 18:05:45 +00:00
|
|
|
, extraNativeBuildInputs ? [], extraConfigureFlags ? [], extraMakeFlags ? [], tests ? []
|
|
|
|
, extraPostPatch ? "", extraPassthru ? {} }:
|
2017-03-27 12:33:00 +00:00
|
|
|
|
2021-01-17 02:09:27 +00:00
|
|
|
{ lib, stdenv, pkg-config, pango, perl, python3, zip
|
2018-02-25 02:23:58 +00:00
|
|
|
, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
|
2021-11-02 09:39:56 +00:00
|
|
|
, freetype, fontconfig, file, nspr, nss
|
2019-11-10 16:44:34 +00:00
|
|
|
, yasm, libGLU, libGL, sqlite, unzip, makeWrapper
|
2021-04-05 09:30:23 +00:00
|
|
|
, hunspell, libevent, libstartup_notification
|
2021-11-29 09:09:07 +00:00
|
|
|
, libvpx
|
2022-01-10 23:34:29 +00:00
|
|
|
, icu70, libpng, glib, pciutils
|
2022-02-16 12:00:00 +00:00
|
|
|
, autoconf213, which, gnused, rustPackages, rustPlatform
|
2019-04-06 14:52:35 +00:00
|
|
|
, rust-cbindgen, nodejs, nasm, fetchpatch
|
2020-10-20 13:56:14 +00:00
|
|
|
, gnum4
|
2021-11-02 09:39:56 +00:00
|
|
|
, gtk3, wrapGAppsHook
|
2013-10-06 04:07:42 +00:00
|
|
|
, debugBuild ? false
|
2017-03-27 12:33:00 +00:00
|
|
|
|
|
|
|
### optionals
|
|
|
|
|
2017-03-27 12:35:34 +00:00
|
|
|
## optional libraries
|
|
|
|
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsaSupport ? stdenv.isLinux, alsa-lib
|
2018-11-07 09:07:40 +00:00
|
|
|
, pulseaudioSupport ? stdenv.isLinux, libpulseaudio
|
2018-11-14 22:29:48 +00:00
|
|
|
, ffmpegSupport ? true
|
2021-04-05 09:30:23 +00:00
|
|
|
, waylandSupport ? true, libxkbcommon, libdrm
|
2021-03-07 07:51:11 +00:00
|
|
|
, ltoSupport ? (stdenv.isLinux && stdenv.is64bit), overrideCC, buildPackages
|
2021-03-14 16:11:48 +00:00
|
|
|
, gssSupport ? true, libkrb5
|
2020-10-06 10:10:08 +00:00
|
|
|
, pipewireSupport ? waylandSupport && webrtcSupport, pipewire
|
2021-12-01 02:51:18 +00:00
|
|
|
# Jemalloc could reduce memory consumption.
|
|
|
|
, jemallocSupport ? true, jemalloc
|
2017-03-27 12:33:00 +00:00
|
|
|
|
2017-03-27 12:35:34 +00:00
|
|
|
## privacy-related options
|
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
, privacySupport ? false
|
2017-03-27 12:35:34 +00:00
|
|
|
|
|
|
|
# WARNING: NEVER set any of the options below to `true` by default.
|
2019-04-06 14:49:14 +00:00
|
|
|
# Set to `!privacySupport` or `false`.
|
2017-03-27 12:35:34 +00:00
|
|
|
|
2019-04-06 14:49:14 +00:00
|
|
|
# webrtcSupport breaks the aarch64 build on version >= 60, fixed in 63.
|
2018-05-13 17:19:55 +00: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 12:33:00 +00:00
|
|
|
, crashreporterSupport ? false
|
|
|
|
|
2017-11-15 00:00:00 +00:00
|
|
|
, safeBrowsingSupport ? false
|
2017-03-27 12:33:00 +00:00
|
|
|
, drmSupport ? false
|
|
|
|
|
2018-07-10 22:10:04 +00:00
|
|
|
# macOS dependencies
|
2018-07-11 21:01:35 +00:00
|
|
|
, xcbuild, CoreMedia, ExceptionHandling, Kerberos, AVFoundation, MediaToolbox
|
2018-07-29 04:15:14 +00:00
|
|
|
, CoreLocation, Foundation, AddressBook, libobjc, cups, rsync
|
2018-07-10 22:10:04 +00:00
|
|
|
|
2017-03-27 12:35:34 +00: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 07:49:43 +00: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
|
2021-11-16 10:38:56 +00:00
|
|
|
|
|
|
|
# On 32bit platforms, we disable adding "-g" for easier linking.
|
|
|
|
, enableDebugSymbols ? !stdenv.is32bit
|
2013-06-06 11:07:54 +00:00
|
|
|
}:
|
|
|
|
|
2018-02-01 00:00:00 +00:00
|
|
|
assert stdenv.cc.libc or null != null;
|
2020-10-06 10:10:08 +00:00
|
|
|
assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "pipewireSupport requires both wayland and webrtc support.";
|
2020-10-09 03:29:13 +00:00
|
|
|
assert ltoSupport -> stdenv.isDarwin -> throw "LTO is broken on Darwin (see PR#19312).";
|
2013-06-06 11:07:54 +00:00
|
|
|
|
2015-09-03 08:54:13 +00:00
|
|
|
let
|
2017-03-27 12:33:00 +00:00
|
|
|
flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
|
2018-07-10 22:10:04 +00:00
|
|
|
|
|
|
|
default-toolkit = if stdenv.isDarwin then "cairo-cocoa"
|
2021-07-12 13:38:03 +00:00
|
|
|
else "cairo-gtk3${lib.optionalString waylandSupport "-wayland"}";
|
2018-07-29 04:15:14 +00:00
|
|
|
|
2019-01-01 00:00:00 +00:00
|
|
|
binaryNameCapitalized = lib.toUpper (lib.substring 0 1 binaryName) + lib.substring 1 (-1) binaryName;
|
|
|
|
|
2021-07-13 17:04:57 +00:00
|
|
|
applicationName = if stdenv.isDarwin then binaryNameCapitalized else binaryName;
|
2019-01-01 00:00:00 +00:00
|
|
|
|
2018-07-29 04:15:14 +00:00
|
|
|
execdir = if stdenv.isDarwin
|
2019-01-01 00:00:00 +00:00
|
|
|
then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
|
2018-07-29 04:15:14 +00:00
|
|
|
else "/bin";
|
2020-10-06 10:10:08 +00:00
|
|
|
|
2021-11-02 09:39:56 +00:00
|
|
|
inherit (rustPackages) rustc cargo;
|
2020-12-10 03:20:59 +00:00
|
|
|
|
2020-10-09 03:29:13 +00: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.
|
2021-05-01 16:47:29 +00:00
|
|
|
# Target the LLVM version that rustc -Vv reports it is built with for LTO.
|
2021-05-01 03:03:19 +00:00
|
|
|
llvmPackages0 =
|
2021-11-02 09:39:56 +00:00
|
|
|
if stdenv.isDarwin
|
2021-05-01 03:03:19 +00:00
|
|
|
then buildPackages.llvmPackages
|
2021-11-02 16:36:12 +00:00
|
|
|
else rustc.llvmPackages;
|
2021-11-02 09:39:56 +00:00
|
|
|
|
2021-05-01 03:03:19 +00:00
|
|
|
# Force the use of lld and other llvm tools for LTO
|
|
|
|
llvmPackages = llvmPackages0.override {
|
|
|
|
bootBintoolsNoLibc = null;
|
|
|
|
bootBintools = null;
|
|
|
|
};
|
2020-10-06 18:14:06 +00:00
|
|
|
|
2020-10-09 03:29:13 +00: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 18:14:06 +00:00
|
|
|
buildStdenv = if ltoSupport
|
2021-11-13 13:32:18 +00:00
|
|
|
# LTO requires LLVM bintools including ld.lld and llvm-ar.
|
|
|
|
then overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
|
|
|
|
inherit (llvmPackages) bintools;
|
|
|
|
})
|
2020-10-06 18:14:06 +00:00
|
|
|
else stdenv;
|
2020-11-07 13:53:42 +00:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
in
|
|
|
|
|
2020-10-06 18:14:06 +00:00
|
|
|
buildStdenv.mkDerivation ({
|
2021-07-13 17:04:57 +00:00
|
|
|
name = "${pname}-unwrapped-${version}";
|
|
|
|
inherit version;
|
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 = [
|
2020-11-18 11:47:05 +00:00
|
|
|
] ++
|
2021-07-13 17:04:57 +00:00
|
|
|
lib.optional (lib.versionAtLeast version "86") ./env_var_for_system_dir-ff86.patch ++
|
2021-12-08 10:09:09 +00:00
|
|
|
lib.optional (lib.versionAtLeast version "90" && lib.versionOlder version "95") ./no-buildconfig-ffx90.patch ++
|
2022-01-10 23:34:29 +00:00
|
|
|
lib.optional (lib.versionAtLeast version "96") ./no-buildconfig-ffx96.patch ++
|
|
|
|
|
2021-11-02 09:39:56 +00:00
|
|
|
patches;
|
2017-03-27 12:33:00 +00: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 12:33:00 +00:00
|
|
|
buildInputs = [
|
2021-11-02 09:39:56 +00:00
|
|
|
gnum4 gtk3 perl zip libjpeg zlib bzip2
|
2018-07-12 13:05:52 +00:00
|
|
|
dbus dbus-glib pango freetype fontconfig xorg.libXi xorg.libXcursor
|
2017-03-27 12:33:00 +00:00
|
|
|
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
|
2020-12-10 02:26:58 +00:00
|
|
|
xorg.pixman yasm libGLU libGL
|
2020-08-21 09:12:43 +00:00
|
|
|
xorg.xorgproto
|
2021-04-05 09:30:23 +00:00
|
|
|
xorg.libXdamage
|
2021-07-12 20:06:14 +00:00
|
|
|
xorg.libXext
|
2022-01-10 23:34:29 +00:00
|
|
|
xorg.libXtst
|
2020-04-06 15:34:05 +00:00
|
|
|
libevent libstartup_notification /* cairo */
|
2021-09-20 16:42:35 +00:00
|
|
|
libpng glib
|
2022-01-10 23:34:29 +00:00
|
|
|
nasm icu70 libvpx
|
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
|
2021-11-02 09:39:56 +00:00
|
|
|
nspr nss
|
2017-03-27 12:33:00 +00:00
|
|
|
]
|
2021-06-10 02:57:09 +00:00
|
|
|
++ lib.optional alsaSupport alsa-lib
|
2017-03-27 12:33:00 +00:00
|
|
|
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
|
2021-03-14 16:11:48 +00:00
|
|
|
++ lib.optional gssSupport libkrb5
|
2021-04-05 09:30:23 +00:00
|
|
|
++ lib.optionals waylandSupport [ libxkbcommon libdrm ]
|
2020-12-10 01:36:16 +00:00
|
|
|
++ lib.optional pipewireSupport pipewire
|
2021-09-20 16:42:35 +00:00
|
|
|
++ lib.optional jemallocSupport jemalloc
|
2020-10-06 18:14:06 +00:00
|
|
|
++ lib.optionals buildStdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
|
|
|
|
AVFoundation MediaToolbox CoreLocation
|
2021-11-02 09:39:56 +00:00
|
|
|
Foundation libobjc AddressBook cups ];
|
2020-10-06 18:14:06 +00:00
|
|
|
|
2020-09-21 06:13:00 +00:00
|
|
|
MACH_USE_SYSTEM_PYTHON = "1";
|
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
postPatch = ''
|
2019-07-14 05:54:14 +00:00
|
|
|
rm -rf obj-x86_64-pc-linux-gnu
|
2021-02-07 04:51:31 +00:00
|
|
|
substituteInPlace toolkit/xre/glxtest.cpp \
|
|
|
|
--replace 'dlopen("libpci.so' 'dlopen("${pciutils}/lib/libpci.so'
|
2022-02-07 16:18:58 +00:00
|
|
|
|
|
|
|
patchShebangs mach
|
2022-02-11 18:05:45 +00:00
|
|
|
'' + extraPostPatch;
|
2017-09-28 00:13:15 +00:00
|
|
|
|
2017-04-23 02:50:33 +00:00
|
|
|
nativeBuildInputs =
|
2020-02-01 17:56:13 +00:00
|
|
|
[
|
|
|
|
autoconf213
|
|
|
|
cargo
|
|
|
|
gnused
|
|
|
|
llvmPackages.llvm # llvm-objdump
|
2021-07-12 20:06:14 +00:00
|
|
|
makeWrapper
|
2020-02-01 17:56:13 +00:00
|
|
|
nodejs
|
|
|
|
perl
|
2021-01-17 02:09:27 +00:00
|
|
|
pkg-config
|
2020-02-01 17:56:13 +00:00
|
|
|
python3
|
|
|
|
rust-cbindgen
|
|
|
|
rustc
|
|
|
|
which
|
2021-03-05 18:11:00 +00:00
|
|
|
unzip
|
2021-07-12 13:38:03 +00:00
|
|
|
wrapGAppsHook
|
2022-02-16 12:00:00 +00:00
|
|
|
rustPlatform.bindgenHook
|
2020-02-01 17:56:13 +00:00
|
|
|
]
|
2020-10-06 18:14:06 +00:00
|
|
|
++ lib.optionals buildStdenv.isDarwin [ xcbuild rsync ]
|
2018-07-10 22:10:04 +00:00
|
|
|
++ extraNativeBuildInputs;
|
2017-03-27 12:33:00 +00:00
|
|
|
|
2021-11-16 10:38:56 +00:00
|
|
|
separateDebugInfo = enableDebugSymbols;
|
|
|
|
setOutputFlags = false; # `./mach configure` doesn't understand `--*dir=` flags.
|
|
|
|
|
2017-03-27 12:33:00 +00: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"
|
2021-10-04 11:25:56 +00:00
|
|
|
export MOZBUILD_STATE_PATH=$(pwd)/mozbuild
|
2018-07-11 21:01:35 +00:00
|
|
|
|
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
|
2021-08-12 00:14:23 +00:00
|
|
|
'' + (lib.optionalString enableOfficialBranding ''
|
|
|
|
export MOZILLA_OFFICIAL=1
|
|
|
|
export BUILD_OFFICIAL=1
|
|
|
|
'');
|
2017-03-27 12:33:00 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
2021-07-13 17:04:57 +00:00
|
|
|
"--enable-application=${application}"
|
2017-03-27 12:33:00 +00:00
|
|
|
"--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"
|
2018-07-10 22:10:04 +00:00
|
|
|
"--enable-default-toolkit=${default-toolkit}"
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
"--with-libclang-path=${llvmPackages.libclang.lib}/lib"
|
2017-04-01 00:00:00 +00:00
|
|
|
"--with-system-nspr"
|
2018-10-01 00:00:00 +00:00
|
|
|
"--with-system-nss"
|
2017-04-01 00:00:00 +00:00
|
|
|
]
|
2020-10-06 18:14:06 +00:00
|
|
|
++ lib.optional (buildStdenv.isDarwin) "--disable-xcode-checks"
|
|
|
|
++ lib.optional (!ltoSupport) "--with-clang-path=${llvmPackages.clang}/bin/clang"
|
2020-10-09 01:55:23 +00: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 03:29:13 +00:00
|
|
|
# elf-hack is broken when using clang+lld:
|
2020-10-09 01:55:23 +00:00
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
|
2021-11-19 15:44:10 +00:00
|
|
|
++ lib.optional ltoSupport "--enable-lto=cross" # Cross-language LTO.
|
2021-01-17 03:26:40 +00:00
|
|
|
++ lib.optional (ltoSupport && (buildStdenv.isAarch32 || buildStdenv.isi686 || buildStdenv.isx86_64)) "--disable-elf-hack"
|
|
|
|
++ lib.optional (ltoSupport && !buildStdenv.isDarwin) "--enable-linker=lld"
|
2017-04-01 00:00:00 +00:00
|
|
|
|
2017-03-27 12:33:00 +00:00
|
|
|
++ flag alsaSupport "alsa"
|
|
|
|
++ flag pulseaudioSupport "pulseaudio"
|
|
|
|
++ flag ffmpegSupport "ffmpeg"
|
2021-09-20 16:42:35 +00:00
|
|
|
++ flag jemallocSupport "jemalloc"
|
2017-09-27 13:30:29 +00:00
|
|
|
++ flag gssSupport "negotiateauth"
|
2017-03-27 12:33:00 +00:00
|
|
|
++ flag webrtcSupport "webrtc"
|
|
|
|
++ flag crashreporterSupport "crashreporter"
|
2017-07-01 03:06:51 +00:00
|
|
|
++ lib.optional drmSupport "--enable-eme=widevine"
|
2017-03-27 12:33:00 +00:00
|
|
|
|
|
|
|
++ (if debugBuild then [ "--enable-debug" "--enable-profiling" ]
|
2021-11-16 10:38:56 +00:00
|
|
|
else [ "--disable-debug" "--enable-optimize" ])
|
|
|
|
# --enable-release adds -ffunction-sections & LTO that require a big amount of
|
|
|
|
# RAM and the 32-bit memory space cannot handle that linking
|
|
|
|
++ flag (!debugBuild && !stdenv.is32bit) "release"
|
|
|
|
++ flag enableDebugSymbols "debug-symbols"
|
|
|
|
++ lib.optionals enableDebugSymbols [ "--disable-strip" "--disable-install-strip" ]
|
|
|
|
|
2017-08-15 00:00:00 +00:00
|
|
|
++ lib.optional enableOfficialBranding "--enable-official-branding"
|
2021-12-08 10:09:09 +00:00
|
|
|
++ lib.optional (lib.versionAtLeast version "95") "--without-wasm-sandboxed-libraries"
|
2017-08-15 00:00:00 +00:00
|
|
|
++ extraConfigureFlags;
|
2014-07-23 13:31:49 +00:00
|
|
|
|
2020-02-01 17:56:13 +00:00
|
|
|
postConfigure = ''
|
2018-02-01 00:00:00 +00:00
|
|
|
cd obj-*
|
|
|
|
'';
|
|
|
|
|
2021-11-16 10:40:02 +00:00
|
|
|
makeFlags = extraMakeFlags;
|
2017-08-15 00:00:00 +00:00
|
|
|
|
2014-07-23 13:31:49 +00:00
|
|
|
enableParallelBuilding = true;
|
2018-04-25 03:20:18 +00:00
|
|
|
doCheck = false; # "--disable-tests" above
|
2014-07-23 13:31:49 +00:00
|
|
|
|
2020-10-06 18:14:06 +00:00
|
|
|
installPhase = if buildStdenv.isDarwin then ''
|
2018-07-29 04:15:14 +00:00
|
|
|
mkdir -p $out/Applications
|
2019-01-01 00:00:00 +00:00
|
|
|
cp -LR dist/${binaryNameCapitalized}.app $out/Applications
|
2018-07-29 04:15:14 +00:00
|
|
|
'' else null;
|
|
|
|
|
2020-10-06 18:14:06 +00:00
|
|
|
postInstall = lib.optionalString buildStdenv.isLinux ''
|
2017-03-27 12:33:00 +00: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 12:33:00 +00:00
|
|
|
|
|
|
|
# Needed to find Mozilla runtime
|
2019-01-01 00:00:00 +00:00
|
|
|
gappsWrapperArgs+=(--argv0 "$out/bin/.${binaryName}-wrapped")
|
2017-03-27 12:33:00 +00:00
|
|
|
'';
|
|
|
|
|
2021-11-16 10:38:56 +00:00
|
|
|
# Workaround: The separateDebugInfo hook skips artifacts whose build ID's length is not 40.
|
|
|
|
# But we got 16-length build ID here. The function body is mainly copied from pkgs/build-support/setup-hooks/separate-debug-info.sh
|
|
|
|
# Remove it when PR #146275 is merged.
|
|
|
|
preFixup = lib.optionalString enableDebugSymbols ''
|
|
|
|
_separateDebugInfo() {
|
|
|
|
[ -e "$prefix" ] || return 0
|
|
|
|
|
|
|
|
local dst="''${debug:-$out}"
|
|
|
|
if [ "$prefix" = "$dst" ]; then return 0; fi
|
|
|
|
|
|
|
|
dst="$dst/lib/debug/.build-id"
|
|
|
|
|
|
|
|
# Find executables and dynamic libraries.
|
|
|
|
local i
|
|
|
|
while IFS= read -r -d $'\0' i; do
|
|
|
|
if ! isELF "$i"; then continue; fi
|
|
|
|
|
|
|
|
# Extract the Build ID. FIXME: there's probably a cleaner way.
|
|
|
|
local id="$($READELF -n "$i" | sed 's/.*Build ID: \([0-9a-f]*\).*/\1/; t; d')"
|
|
|
|
if [[ -z "$id" ]]; then
|
|
|
|
echo "could not find build ID of $i, skipping" >&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Extract the debug info.
|
|
|
|
header "separating debug info from $i (build ID $id)"
|
|
|
|
mkdir -p "$dst/''${id:0:2}"
|
|
|
|
$OBJCOPY --only-keep-debug "$i" "$dst/''${id:0:2}/''${id:2}.debug"
|
|
|
|
$STRIP --strip-debug "$i"
|
|
|
|
|
|
|
|
# Also a create a symlink <original-name>.debug.
|
|
|
|
ln -sfn ".build-id/''${id:0:2}/''${id:2}.debug" "$dst/../$(basename "$i")"
|
|
|
|
done < <(find "$prefix" -type f -print0)
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2017-04-09 17:17:40 +00:00
|
|
|
doInstallCheck = true;
|
2017-03-27 12:33:00 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
# Some basic testing
|
2021-07-13 17:04:57 +00:00
|
|
|
"$out${execdir}/${applicationName}" --version
|
2017-03-27 12:33:00 +00:00
|
|
|
'';
|
2013-06-06 11:07:54 +00:00
|
|
|
|
2014-07-23 13:31:49 +00:00
|
|
|
passthru = {
|
2020-02-01 17:56:13 +00:00
|
|
|
inherit updateScript;
|
2021-07-13 17:04:57 +00:00
|
|
|
inherit version;
|
2020-10-22 01:47:30 +00:00
|
|
|
inherit alsaSupport;
|
2020-12-10 02:26:58 +00:00
|
|
|
inherit pipewireSupport;
|
2017-03-27 12:33:00 +00:00
|
|
|
inherit nspr;
|
|
|
|
inherit ffmpegSupport;
|
2017-09-27 13:30:29 +00:00
|
|
|
inherit gssSupport;
|
2018-07-29 04:15:14 +00:00
|
|
|
inherit execdir;
|
2021-07-13 17:04:57 +00:00
|
|
|
inherit applicationName;
|
2020-12-31 02:47:54 +00:00
|
|
|
inherit tests;
|
2021-07-12 13:38:03 +00:00
|
|
|
inherit gtk3;
|
2022-02-11 18:05:45 +00:00
|
|
|
} // extraPassthru;
|
2020-09-10 00:06:07 +00: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 00:06:07 +00: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-11-29 09:28:24 +00:00
|
|
|
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
2020-01-07 17:40:56 +00:00
|
|
|
})
|