firefox: common: cleanup configure phase

This commit is contained in:
Jan Malakhovski 2018-02-01 00:00:00 +00:00
parent a2cf5577c2
commit 97c43bf285

View file

@ -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 <<END_MOZCONFIG
${lib.concatStringsSep "\n" (map (flag: "ac_add_options ${flag}") configureFlags)}
${lib.optionalString googleAPISupport "ac_add_options --with-google-api-keyfile=$TMPDIR/ga"}
END_MOZCONFIG
test -f layout/style/ServoBindings.toml && sed -i -e '/"-DMOZ_STYLO"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml
'' + lib.optionalString googleAPISupport ''
# Google API key used by Chromium and Firefox.
# Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
# please get your own set of keys.
echo "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI" > $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")
'';