mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
firefox: add ltoSupport and enable it by default
This commit is contained in:
parent
301d04f329
commit
4f12bddea6
1 changed files with 37 additions and 17 deletions
|
@ -9,7 +9,7 @@
|
||||||
, hunspell, libXdamage, libevent, libstartup_notification
|
, hunspell, libXdamage, libevent, libstartup_notification
|
||||||
, libvpx_1_8
|
, libvpx_1_8
|
||||||
, icu67, libpng, jemalloc, glib
|
, icu67, libpng, jemalloc, glib
|
||||||
, autoconf213, which, gnused, cargo, rustc, llvmPackages
|
, autoconf213, which, gnused, cargo, rustc
|
||||||
, rust-cbindgen, nodejs, nasm, fetchpatch
|
, rust-cbindgen, nodejs, nasm, fetchpatch
|
||||||
, debugBuild ? false
|
, debugBuild ? false
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
, ffmpegSupport ? true
|
, ffmpegSupport ? true
|
||||||
, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
|
, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
|
||||||
, waylandSupport ? true, libxkbcommon
|
, waylandSupport ? true, libxkbcommon
|
||||||
|
, ltoSupport ? true, overrideCC, buildPackages
|
||||||
, gssSupport ? true, kerberos
|
, gssSupport ? true, kerberos
|
||||||
, pipewireSupport ? waylandSupport && webrtcSupport, pipewire
|
, pipewireSupport ? waylandSupport && webrtcSupport, pipewire
|
||||||
|
|
||||||
|
@ -87,9 +88,14 @@ let
|
||||||
then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
|
then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
|
||||||
else "/bin";
|
else "/bin";
|
||||||
|
|
||||||
|
llvmPackages = buildPackages.llvmPackages_10;
|
||||||
|
|
||||||
|
buildStdenv = if ltoSupport
|
||||||
|
then overrideCC stdenv llvmPackages.lldClang
|
||||||
|
else stdenv;
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation ({
|
buildStdenv.mkDerivation ({
|
||||||
name = "${pname}-unwrapped-${ffversion}";
|
name = "${pname}-unwrapped-${ffversion}";
|
||||||
version = ffversion;
|
version = ffversion;
|
||||||
|
|
||||||
|
@ -131,12 +137,18 @@ stdenv.mkDerivation ({
|
||||||
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
|
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
|
||||||
++ lib.optional gtk3Support gtk3
|
++ lib.optional gtk3Support gtk3
|
||||||
++ lib.optional gssSupport kerberos
|
++ lib.optional gssSupport kerberos
|
||||||
|
++ lib.optional ltoSupport llvmPackages.libunwind
|
||||||
++ lib.optionals waylandSupport [ libxkbcommon ]
|
++ lib.optionals waylandSupport [ libxkbcommon ]
|
||||||
++ lib.optionals pipewireSupport [ pipewire ]
|
++ lib.optionals pipewireSupport [ pipewire ]
|
||||||
++ lib.optionals stdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
|
++ lib.optionals buildStdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
|
||||||
AVFoundation MediaToolbox CoreLocation
|
AVFoundation MediaToolbox CoreLocation
|
||||||
Foundation libobjc AddressBook cups ];
|
Foundation libobjc AddressBook cups ];
|
||||||
|
|
||||||
|
NIX_LDFLAGS = lib.optionalString ltoSupport ''
|
||||||
|
-rpath ${placeholder "out"}/lib/${binaryName}
|
||||||
|
-rpath ${llvmPackages.libunwind.out}/lib
|
||||||
|
'';
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = toString [
|
NIX_CFLAGS_COMPILE = toString [
|
||||||
"-I${glib.dev}/include/gio-unix-2.0"
|
"-I${glib.dev}/include/gio-unix-2.0"
|
||||||
"-I${nss.dev}/include/nss"
|
"-I${nss.dev}/include/nss"
|
||||||
|
@ -179,7 +191,7 @@ stdenv.mkDerivation ({
|
||||||
which
|
which
|
||||||
]
|
]
|
||||||
++ lib.optional gtk3Support wrapGAppsHook
|
++ lib.optional gtk3Support wrapGAppsHook
|
||||||
++ lib.optionals stdenv.isDarwin [ xcbuild rsync ]
|
++ lib.optionals buildStdenv.isDarwin [ xcbuild rsync ]
|
||||||
++ extraNativeBuildInputs;
|
++ extraNativeBuildInputs;
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
|
@ -197,12 +209,12 @@ stdenv.mkDerivation ({
|
||||||
# included we need to look in a few places.
|
# included we need to look in a few places.
|
||||||
# TODO: generalize this process for other use-cases.
|
# TODO: generalize this process for other use-cases.
|
||||||
|
|
||||||
BINDGEN_CFLAGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \
|
BINDGEN_CFLAGS="$(< ${buildStdenv.cc}/nix-support/libc-crt1-cflags) \
|
||||||
$(< ${stdenv.cc}/nix-support/libc-cflags) \
|
$(< ${buildStdenv.cc}/nix-support/libc-cflags) \
|
||||||
$(< ${stdenv.cc}/nix-support/cc-cflags) \
|
$(< ${buildStdenv.cc}/nix-support/cc-cflags) \
|
||||||
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
|
$(< ${buildStdenv.cc}/nix-support/libcxx-cxxflags) \
|
||||||
${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \
|
${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
|
||||||
${lib.optionalString stdenv.cc.isGNU "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config}"} \
|
${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}"} \
|
||||||
$NIX_CFLAGS_COMPILE"
|
$NIX_CFLAGS_COMPILE"
|
||||||
|
|
||||||
echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
|
echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
|
||||||
|
@ -236,11 +248,19 @@ stdenv.mkDerivation ({
|
||||||
"--enable-jemalloc"
|
"--enable-jemalloc"
|
||||||
"--enable-default-toolkit=${default-toolkit}"
|
"--enable-default-toolkit=${default-toolkit}"
|
||||||
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
||||||
"--with-clang-path=${llvmPackages.clang}/bin/clang"
|
|
||||||
"--with-system-nspr"
|
"--with-system-nspr"
|
||||||
"--with-system-nss"
|
"--with-system-nss"
|
||||||
]
|
]
|
||||||
++ lib.optional (stdenv.isDarwin) "--disable-xcode-checks"
|
++ lib.optional (buildStdenv.isDarwin) "--disable-xcode-checks"
|
||||||
|
++ lib.optional (!ltoSupport) "--with-clang-path=${llvmPackages.clang}/bin/clang"
|
||||||
|
# LTO is done using clang and lld.
|
||||||
|
# elf-hack is broken when using clang:
|
||||||
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
|
||||||
|
++ lib.optionals ltoSupport [
|
||||||
|
"--enable-lto"
|
||||||
|
"--enable-linker=lld"
|
||||||
|
"--disable-elf-hack"
|
||||||
|
]
|
||||||
|
|
||||||
++ flag alsaSupport "alsa"
|
++ flag alsaSupport "alsa"
|
||||||
++ flag pulseaudioSupport "pulseaudio"
|
++ flag pulseaudioSupport "pulseaudio"
|
||||||
|
@ -270,12 +290,12 @@ stdenv.mkDerivation ({
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
doCheck = false; # "--disable-tests" above
|
doCheck = false; # "--disable-tests" above
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin then ''
|
installPhase = if buildStdenv.isDarwin then ''
|
||||||
mkdir -p $out/Applications
|
mkdir -p $out/Applications
|
||||||
cp -LR dist/${binaryNameCapitalized}.app $out/Applications
|
cp -LR dist/${binaryNameCapitalized}.app $out/Applications
|
||||||
'' else null;
|
'' else null;
|
||||||
|
|
||||||
postInstall = lib.optionalString stdenv.isLinux ''
|
postInstall = lib.optionalString buildStdenv.isLinux ''
|
||||||
# Remove SDK cruft. FIXME: move to a separate output?
|
# Remove SDK cruft. FIXME: move to a separate output?
|
||||||
rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-*
|
rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-*
|
||||||
|
|
||||||
|
@ -283,7 +303,7 @@ stdenv.mkDerivation ({
|
||||||
gappsWrapperArgs+=(--argv0 "$out/bin/.${binaryName}-wrapped")
|
gappsWrapperArgs+=(--argv0 "$out/bin/.${binaryName}-wrapped")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = lib.optionalString stdenv.isLinux ''
|
postFixup = lib.optionalString buildStdenv.isLinux ''
|
||||||
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
|
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
|
||||||
patchelf --set-rpath "${lib.getLib libnotify
|
patchelf --set-rpath "${lib.getLib libnotify
|
||||||
}/lib:$(patchelf --print-rpath "$out"/lib/${binaryName}*/libxul.so)" \
|
}/lib:$(patchelf --print-rpath "$out"/lib/${binaryName}*/libxul.so)" \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue