firefox: build on darwin

Fixes #30285
This commit is contained in:
Matthew Bauer 2018-07-10 18:10:04 -04:00
parent a68e5e918e
commit 0edb441a0e
3 changed files with 17 additions and 7 deletions

View File

@ -16,7 +16,7 @@
## optional libraries ## optional libraries
, alsaSupport ? true, alsaLib , alsaSupport ? stdenv.isLinux, alsaLib
, pulseaudioSupport ? true, libpulseaudio , pulseaudioSupport ? true, libpulseaudio
, ffmpegSupport ? true, gstreamer, gst-plugins-base , ffmpegSupport ? true, gstreamer, gst-plugins-base
, gtk3Support ? !isTorBrowserLike, gtk2, gtk3, wrapGAppsHook , gtk3Support ? !isTorBrowserLike, gtk2, gtk3, wrapGAppsHook
@ -39,6 +39,9 @@
, safeBrowsingSupport ? false , safeBrowsingSupport ? false
, drmSupport ? false , drmSupport ? false
# macOS dependencies
, xcbuild, CoreMedia
## other ## other
# As stated by Sylvestre Ledru (@sylvestre) on Nov 22, 2017 at # As stated by Sylvestre Ledru (@sylvestre) on Nov 22, 2017 at
@ -60,13 +63,16 @@
# > the experience of Firefox users, you won't have any issues using the # > the experience of Firefox users, you won't have any issues using the
# > official branding. # > official branding.
, enableOfficialBranding ? true , enableOfficialBranding ? true
, gcc
}: }:
assert stdenv.cc.libc or null != null; assert stdenv.cc.libc or null != null;
let let
flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")]; flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
default-toolkit = if stdenv.isDarwin then "cairo-cocoa"
else "cairo-gtk${if gtk3Support then "3" else "2"}";
in in
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
@ -90,13 +96,16 @@ stdenv.mkDerivation (rec {
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ] ++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ]
++ lib.optional gtk3Support gtk3 ++ lib.optional gtk3Support gtk3
++ lib.optional gssSupport kerberos; ++ lib.optional gssSupport kerberos
++ lib.optionals stdenv.isDarwin [ CoreMedia ];
NIX_CFLAGS_COMPILE = "-I${nspr.dev}/include/nspr -I${nss.dev}/include/nss -I${glib.dev}/include/gio-unix-2.0"; NIX_CFLAGS_COMPILE = "-I${nspr.dev}/include/nspr -I${nss.dev}/include/nss -I${glib.dev}/include/gio-unix-2.0";
nativeBuildInputs = nativeBuildInputs =
[ autoconf213 which gnused pkgconfig perl python2 cargo rustc ] [ autoconf213 which gnused pkgconfig perl python2 cargo rustc ]
++ lib.optional gtk3Support wrapGAppsHook ++ extraNativeBuildInputs; ++ lib.optional gtk3Support wrapGAppsHook
++ lib.optional stdenv.isDarwin xcbuild
++ extraNativeBuildInputs;
preConfigure = '' preConfigure = ''
# remove distributed configuration files # remove distributed configuration files
@ -146,7 +155,8 @@ stdenv.mkDerivation (rec {
"--enable-jemalloc" "--enable-jemalloc"
"--disable-maintenance-service" "--disable-maintenance-service"
"--disable-gconf" "--disable-gconf"
"--enable-default-toolkit=cairo-gtk${if gtk3Support then "3" else "2"}" "--enable-default-toolkit=${default-toolkit}"
"--disable-xcode-checks"
] ]
++ lib.optional (lib.versionOlder version "61") "--enable-system-hunspell" ++ lib.optional (lib.versionOlder version "61") "--enable-system-hunspell"
++ lib.optionals (lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [ ++ lib.optionals (lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [

View File

@ -36,7 +36,7 @@ rec {
description = "A web browser built from Firefox source tree"; description = "A web browser built from Firefox source tree";
homepage = http://www.mozilla.com/en-US/firefox/; homepage = http://www.mozilla.com/en-US/firefox/;
maintainers = with lib.maintainers; [ eelco ]; maintainers = with lib.maintainers; [ eelco ];
platforms = lib.platforms.linux; platforms = lib.platforms.unix;
}; };
updateScript = callPackage ./update.nix { updateScript = callPackage ./update.nix {
attrPath = "firefox-unwrapped"; attrPath = "firefox-unwrapped";

View File

@ -43,7 +43,7 @@ while [ $# -gt 0 ]; do
-s | --switch) shift;; # noop -s | --switch) shift;; # noop
-r | --reset) ;; # noop -r | --reset) ;; # noop
-v | --version) echo xcode-select version ${xcodeSelectVersion} ;; -v | --version) echo xcode-select version ${xcodeSelectVersion} ;;
-p | --print-path) echo @DEVELOPER_DIR@ ;; -p | -print-path | --print-path) echo @DEVELOPER_DIR@ ;;
--install) ;; # noop --install) ;; # noop
esac esac
shift shift