about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/firefox/common.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-07-11 17:01:35 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2018-08-11 22:54:48 -0500
commit4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3 (patch)
treeb6b7fe9ddd2b8114527d3ebfa9c65a0f839d5969 /pkgs/applications/networking/browsers/firefox/common.nix
parent72a1bc9a28d2a8e2c6e26a551932c4a054a525be (diff)
downloadnixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar.gz
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar.bz2
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar.lz
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar.xz
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.tar.zst
nixlib-4b71fe6d863e6b774b56c3a06d8ec2bcb8763df3.zip
firefox: cleanup expression
- Add a few more macOS frameworks needed
- Fix RUST_BINDGEN handling. We need to pass all of NIX_CFLAGS_COMPILE
  to rust bindgen
Diffstat (limited to 'pkgs/applications/networking/browsers/firefox/common.nix')
-rw-r--r--pkgs/applications/networking/browsers/firefox/common.nix32
1 files changed, 24 insertions, 8 deletions
diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix
index ec9ca9bf2a43..0724bc3a6809 100644
--- a/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/pkgs/applications/networking/browsers/firefox/common.nix
@@ -40,7 +40,8 @@
 , drmSupport ? false
 
 # macOS dependencies
-, xcbuild, CoreMedia
+, xcbuild, CoreMedia, ExceptionHandling, Kerberos, AVFoundation, MediaToolbox
+, CoreLocation, Foundation, libobjc
 
 ## other
 
@@ -97,9 +98,20 @@ stdenv.mkDerivation (rec {
   ++ lib.optionals ffmpegSupport [ gstreamer gst-plugins-base ]
   ++ lib.optional  gtk3Support gtk3
   ++ 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";
+  ++ lib.optionals stdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
+                                     AVFoundation MediaToolbox CoreLocation
+                                     Foundation libobjc ];
+
+  NIX_CFLAGS_COMPILE = [ "-I${nspr.dev}/include/nspr"
+                         "-I${nss.dev}/include/nss"
+                         "-I${glib.dev}/include/gio-unix-2.0" ]
+                      ++ lib.optional stdenv.isDarwin [
+                         "-isystem ${llvmPackages.libcxx}/include/c++/v1"
+                         "-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_10" ];
+
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace js/src/jsmath.cpp --replace 'defined(HAVE___SINCOS)' 0
+  '';
 
   nativeBuildInputs =
     [ autoconf213 which gnused pkgconfig perl python2 cargo rustc ]
@@ -120,10 +132,14 @@ stdenv.mkDerivation (rec {
     make -f client.mk configure-files
     configureScript="$(realpath ./configure)"
   '') + ''
-    cxxLib=$( echo -n ${gcc}/include/c++/* )
-    archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
-
-    test -f layout/style/ServoBindings.toml && sed -i -e '/"-DRUST_BINDGEN"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml
+    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.
+    echo "ac_add_options BINDGEN_CFLAGS='$(< ${stdenv.cc}/nix-support/libc-cflags) $(< ${stdenv.cc}/nix-support/cc-cflags) ${stdenv.cc.default_cxx_stdlib_compile} -idirafter ${llvmPackages.clang.cc}/lib/clang/${lib.getVersion llvmPackages.clang}/include $NIX_CFLAGS_COMPILE'" >> $MOZCONFIG
   '' + lib.optionalString googleAPISupport ''
     # Google API key used by Chromium and Firefox.
     # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,