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