From 97c43bf285c16b84991d170d6b7c7e989d207077 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Thu, 1 Feb 2018 00:00:00 +0000 Subject: [PATCH] firefox: common: cleanup configure phase --- .../networking/browsers/firefox/common.nix | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 75153a9febda..69e935d78762 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -100,29 +100,25 @@ stdenv.mkDerivation (rec { rm -f configure rm -f js/src/configure rm -f .mozconfig* + '' + (if lib.versionAtLeast version "58" + # this will run autoconf213 + then '' + configureScript="$(realpath ./mach) configure" + '' else '' + make -f client.mk configure-files + configureScript="$(realpath ./configure)" + '') + '' + cxxLib=$( echo -n ${gcc}/include/c++/* ) + archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine ) - '' + lib.optionalString (stdenv.lib.versionAtLeast version "58.0.0") '' - cat >.mozconfig < $TMPDIR/ga configureFlagsArray+=("--with-google-api-keyfile=$TMPDIR/ga") - '' + '' - # this will run autoconf213 - ${if (stdenv.lib.versionAtLeast version "58.0.0") then "./mach configure" else "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 '/"-DMOZ_STYLO"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml - + '' + lib.optionalString (lib.versionOlder version "58") '' cd obj-* ''; @@ -150,12 +146,12 @@ stdenv.mkDerivation (rec { "--disable-gconf" "--enable-default-toolkit=cairo-gtk${if gtk3Support then "3" else "2"}" ] - ++ lib.optionals (stdenv.lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [ + ++ lib.optionals (lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [ # on i686-linux: --with-libclang-path is not available in this configuration "--with-libclang-path=${llvmPackages.libclang}/lib" "--with-clang-path=${llvmPackages.clang}/bin/clang" ] - ++ lib.optionals (stdenv.lib.versionAtLeast version "57") [ + ++ lib.optionals (lib.versionAtLeast version "57") [ "--enable-webrender=build" ] @@ -196,6 +192,16 @@ stdenv.mkDerivation (rec { ++ lib.optional enableOfficialBranding "--enable-official-branding" ++ extraConfigureFlags; + # Before 58 we have to run `make -f client.mk configure-files` at + # the top level, and then run `./configure` in the obj-* dir (see + # above), but in 58 we have to instead run `./mach configure` at the + # top level and then run `make` in obj-*. (We can also run the + # `make` at the top level in 58, but then we would have to `cd` to + # `make install` anyway. This is ugly, but simple.) + postConfigure = lib.optionalString (lib.versionAtLeast version "58") '' + cd obj-* + ''; + preBuild = lib.optionalString (enableOfficialBranding && isTorBrowserLike) '' buildFlagsArray=("MOZ_APP_DISPLAYNAME=Tor Browser") '';