diff --git a/pkgs/applications/networking/browsers/firefox-bin/default.nix b/pkgs/applications/networking/browsers/firefox-bin/default.nix index 50cc57182903..a71cb84a05c3 100644 --- a/pkgs/applications/networking/browsers/firefox-bin/default.nix +++ b/pkgs/applications/networking/browsers/firefox-bin/default.nix @@ -188,7 +188,7 @@ stdenv.mkDerivation { ln -s ${policiesJson} "$out/lib/firefox-bin-${version}/distribution/policies.json"; ''; - passthru.applicationName = "firefox"; + passthru.binaryName = "firefox"; passthru.libName = "firefox-bin-${version}"; passthru.execdir = "/bin"; passthru.ffmpegSupport = true; diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 0500f6e8d4b9..6b853d44a918 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -58,10 +58,6 @@ , safeBrowsingSupport ? false , drmSupport ? false -# macOS dependencies -, xcbuild, CoreMedia, ExceptionHandling, Kerberos, AVFoundation, MediaToolbox -, CoreLocation, Foundation, AddressBook, libobjc, cups, rsync - ## other # As stated by Sylvestre Ledru (@sylvestre) on Nov 22, 2017 at @@ -90,31 +86,14 @@ assert stdenv.cc.libc or null != null; assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "pipewireSupport requires both wayland and webrtc support."; -assert ltoSupport -> stdenv.isDarwin -> throw "LTO is broken on Darwin (see PR#19312)."; let flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")]; - default-toolkit = if stdenv.isDarwin then "cairo-cocoa" - else "cairo-gtk3${lib.optionalString waylandSupport "-wayland"}"; - - binaryNameCapitalized = lib.toUpper (lib.substring 0 1 binaryName) + lib.substring 1 (-1) binaryName; - - applicationName = if stdenv.isDarwin then binaryNameCapitalized else binaryName; - - execdir = if stdenv.isDarwin - then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS" - else "/bin"; - inherit (rustPackages) rustc cargo; - # Darwin's stdenv provides the default llvmPackages version, match that since - # clang LTO on Darwin is broken so the stdenv is not being changed. # Target the LLVM version that rustc -Vv reports it is built with for LTO. - llvmPackages0 = - if stdenv.isDarwin - then buildPackages.llvmPackages - else rustc.llvmPackages; + llvmPackages0 = rustc.llvmPackages; # Force the use of lld and other llvm tools for LTO llvmPackages = llvmPackages0.override { @@ -122,8 +101,6 @@ let bootBintools = null; }; - # 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. buildStdenv = if ltoSupport # LTO requires LLVM bintools including ld.lld and llvm-ar. then overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override { @@ -187,10 +164,7 @@ buildStdenv.mkDerivation ({ ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed ++ lib.optional gssSupport libkrb5 ++ lib.optionals waylandSupport [ libxkbcommon libdrm ] - ++ lib.optional jemallocSupport jemalloc - ++ lib.optionals buildStdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos - AVFoundation MediaToolbox CoreLocation - Foundation libobjc AddressBook cups ]; + ++ lib.optional jemallocSupport jemalloc; MACH_USE_SYSTEM_PYTHON = "1"; @@ -212,7 +186,6 @@ buildStdenv.mkDerivation ({ wrapGAppsHook rustPlatform.bindgenHook ] - ++ lib.optionals buildStdenv.isDarwin [ xcbuild rsync ] ++ extraNativeBuildInputs; separateDebugInfo = enableDebugSymbols; @@ -261,22 +234,18 @@ buildStdenv.mkDerivation ({ "--enable-system-pixman" "--disable-tests" "--disable-updater" - "--enable-default-toolkit=${default-toolkit}" + "--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}" "--with-libclang-path=${llvmPackages.libclang.lib}/lib" "--with-system-nspr" "--with-system-nss" "--with-system-webp" ] - ++ lib.optional (buildStdenv.isDarwin) "--disable-xcode-checks" ++ lib.optional (!ltoSupport) "--with-clang-path=${llvmPackages.clang}/bin/clang" # 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 # elf-hack is broken when using clang+lld: # https://bugzilla.mozilla.org/show_bug.cgi?id=1482204 - ++ lib.optional ltoSupport "--enable-lto=cross" # Cross-language LTO. + ++ lib.optionals ltoSupport [ "--enable-lto=cross" "--enable-linker=lld" ] ++ lib.optional (ltoSupport && (buildStdenv.isAarch32 || buildStdenv.isi686 || buildStdenv.isx86_64)) "--disable-elf-hack" - ++ lib.optional (ltoSupport && !buildStdenv.isDarwin) "--enable-linker=lld" ++ lib.optional (lib.versionAtLeast version "95") "--with-wasi-sysroot=${wasiSysRoot}" ++ flag alsaSupport "alsa" @@ -309,11 +278,6 @@ buildStdenv.mkDerivation ({ enableParallelBuilding = true; doCheck = false; # "--disable-tests" above - installPhase = if buildStdenv.isDarwin then '' - mkdir -p $out/Applications - cp -LR dist/${binaryNameCapitalized}.app $out/Applications - '' else null; - postInstall = lib.optionalString buildStdenv.isLinux '' # Remove SDK cruft. FIXME: move to a separate output? rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-* @@ -361,19 +325,18 @@ buildStdenv.mkDerivation ({ doInstallCheck = true; installCheckPhase = '' # Some basic testing - "$out${execdir}/${applicationName}" --version + "$out/bin/${binaryName}" --version ''; passthru = { inherit updateScript; inherit version; inherit alsaSupport; + inherit binaryName; inherit pipewireSupport; inherit nspr; inherit ffmpegSupport; inherit gssSupport; - inherit execdir; - inherit applicationName; inherit tests; inherit gtk3; inherit wasiSysRoot; diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 7cc570eb0fb6..e87eb4b94df6 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -20,7 +20,7 @@ browser: let wrapper = - { applicationName ? browser.applicationName or (lib.getName browser) + { applicationName ? browser.binaryName or (lib.getName browser) , pname ? applicationName , version ? lib.getVersion browser , desktopName ? # applicationName with first letter capitalized @@ -179,14 +179,10 @@ let buildInputs = [ browser.gtk3 ]; - buildCommand = lib.optionalString stdenv.isDarwin '' - mkdir -p $out/Applications - cp -R --no-preserve=mode,ownership ${browser}/Applications/${applicationName}.app $out/Applications - rm -f $out${browser.execdir or "/bin"}/${applicationName} - '' + '' - if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ] + buildCommand = '' + if [ ! -x "${browser}/bin/${applicationName}" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" + echo "cannot find executable file \`${browser}/bin/${applicationName}'" exit 1 fi @@ -223,12 +219,12 @@ let # create the wrapper - executablePrefix="$out${browser.execdir or "/bin"}" + executablePrefix="$out/bin" executablePath="$executablePrefix/${applicationName}" if [ ! -x "$executablePath" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" + echo "cannot find executable file \`${browser}/bin/${applicationName}'" exit 1 fi @@ -243,18 +239,18 @@ let oldExe="$(readlink -v --canonicalize-existing "$executablePath")" fi - if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ] + if [ ! -x "${browser}/bin/${applicationName}" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" + echo "cannot find executable file \`${browser}/bin/${applicationName}'" exit 1 fi makeWrapper "$oldExe" \ - "$out${browser.execdir or "/bin"}/${applicationName}${nameSuffix}" \ + "$out/bin/${applicationName}${nameSuffix}" \ --prefix LD_LIBRARY_PATH ':' "$libs" \ --suffix-each GTK_PATH ':' "$gtk_modules" \ --prefix PATH ':' "${xdg-utils}/bin" \ - --suffix PATH ':' "$out${browser.execdir or "/bin"}" \ + --suffix PATH ':' "$out/bin" \ --set MOZ_APP_LAUNCHER "${applicationName}${nameSuffix}" \ --set MOZ_SYSTEM_DIR "$out/lib/mozilla" \ --set MOZ_LEGACY_PROFILES 1 \ @@ -278,7 +274,7 @@ let mkdir -p "$out/share/icons/hicolor/''${res}x''${res}/apps" icon=$( find "${browser}/lib/" -name "default''${res}.png" ) if [ -e "$icon" ]; then ln -s "$icon" \ - "$out/share/icons/hicolor/''${res}x''${res}/apps/${applicationName}.png" + "$out/share/icons/hicolor/''${res}x''${res}/apps/${icon}.png" fi done fi diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5ee3327e03c..7b5d1181d950 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25972,10 +25972,6 @@ with pkgs; callPackage = newScope { inherit (rustPackages) cargo rustc; gnused = gnused_422; - inherit (darwin.apple_sdk.frameworks) CoreMedia ExceptionHandling - Kerberos AVFoundation MediaToolbox - CoreLocation Foundation AddressBook; - inherit (darwin) libobjc; }; }); @@ -29461,10 +29457,6 @@ with pkgs; callPackage = newScope { inherit (rustPackages) cargo rustc; gnused = gnused_422; - inherit (darwin.apple_sdk.frameworks) CoreMedia ExceptionHandling - Kerberos AVFoundation MediaToolbox - CoreLocation Foundation AddressBook; - inherit (darwin) libobjc; }; });