firefox: misc cleanups

Move more dependencies to nativeBuildInputs.
Use wrapGAppsHook.
Add checkInstallPhase.
This commit is contained in:
Nikolay Amiantov 2017-04-09 20:17:40 +03:00
parent 11d76ef891
commit 56ca347872

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, pkgconfig, gtk2, gtk3, pango, perl, python, zip, libIDL
{ lib, stdenv, fetchurl, pkgconfig, gtk2, pango, perl, python, zip, libIDL
, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
, yasm, mesa, sqlite, unzip, makeWrapper
@ -6,10 +6,10 @@
, cairo, gstreamer, gst-plugins-base, icu, libpng, jemalloc, libpulseaudio
, autoconf213, which
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
, enableGTK3 ? false
, enableGTK3 ? false, gtk3, wrapGAppsHook
, debugBuild ? false
, # If you want the resulting program to call itself "Firefox" instead
# of "Shiretoko" or whatever, enable this option. However, those
# of "Nightly" or whatever, enable this option. However, those
# binaries may not be distributed without permission from the
# Mozilla Foundation, see
# http://www.mozilla.org/foundation/trademarks/.
@ -35,12 +35,12 @@ common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec {
patches = lib.optional debugBuild ./fix-debug.patch;
buildInputs =
[ pkgconfig gtk2 perl zip libIDL libjpeg zlib bzip2
python dbus dbus_glib pango freetype fontconfig xorg.libXi
[ gtk2 zip libIDL libjpeg zlib bzip2
dbus dbus_glib pango freetype fontconfig xorg.libXi
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
alsaLib nspr nss libnotify xorg.pixman yasm mesa
xorg.libXScrnSaver xorg.scrnsaverproto
xorg.libXext xorg.xextproto sqlite unzip makeWrapper
xorg.libXext xorg.xextproto sqlite unzip
hunspell libevent libstartup_notification libvpx /* cairo */
icu libpng jemalloc
libpulseaudio # only headers are needed
@ -48,7 +48,7 @@ common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec {
++ lib.optional enableGTK3 gtk3
++ lib.optionals (!passthru.ffmpegSupport) [ gstreamer gst-plugins-base ];
nativeBuildInputs = [ autoconf213 which gnused ];
nativeBuildInputs = [ autoconf213 which gnused pkgconfig perl python ] ++ lib.optional enableGTK3 wrapGAppsHook;
configureFlags =
[ "--enable-application=browser"
@ -75,10 +75,9 @@ common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec {
"--disable-updater"
"--enable-jemalloc"
"--disable-gconf"
"--enable-default-toolkit=cairo-gtk2"
"--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
"--with-google-api-keyfile=ga"
]
++ lib.optional enableGTK3 "--enable-default-toolkit=cairo-gtk3"
++ (if debugBuild then [ "--enable-debug" "--enable-profiling" ]
else [ "--disable-debug" "--enable-release"
"--enable-optimize"
@ -112,17 +111,9 @@ common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec {
# Remove SDK cruft. FIXME: move to a separate output?
rm -rf $out/share/idl $out/include $out/lib/firefox-devel-*
'' + lib.optionalString enableGTK3
# argv[0] must point to firefox itself
''
wrapProgram "$out/bin/firefox" \
--argv0 "$out/bin/.firefox-wrapped" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:" \
--suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS"
'' +
# some basic testing
''
"$out/bin/firefox" --version
# Needed to find Mozilla runtime
gappsWrapperArgs+=(--argv0 "$out/bin/.firefox-wrapped")
'';
postFixup =
@ -133,6 +124,13 @@ common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec {
"$out"/lib/firefox-*/libxul.so
'';
doInstallCheck = true;
installCheckPhase =
''
# Some basic testing
"$out/bin/firefox" --version
'';
meta = {
description = "A web browser" + lib.optionalString (pname == "firefox-esr") " (Extended Support Release)";
homepage = http://www.mozilla.com/en-US/firefox/;