2016-09-11 23:24:51 +02:00
|
|
|
{ lib, stdenv, fetchurl, pkgconfig, gtk2, gtk3, pango, perl, python, zip, libIDL
|
2015-09-15 11:26:18 +02:00
|
|
|
, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
|
2013-06-06 13:07:54 +02:00
|
|
|
, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
|
2016-10-18 09:07:34 +02:00
|
|
|
, yasm, mesa, sqlite, unzip, makeWrapper
|
2013-06-11 11:52:15 +02:00
|
|
|
, hunspell, libevent, libstartup_notification, libvpx
|
2016-05-18 23:07:49 +02:00
|
|
|
, cairo, gstreamer, gst_plugins_base, icu, libpng, jemalloc, libpulseaudio
|
2016-06-08 16:45:52 +02:00
|
|
|
, autoconf213, which
|
2015-09-25 13:37:37 +02:00
|
|
|
, enableGTK3 ? false
|
2013-10-06 06:07:42 +02:00
|
|
|
, debugBuild ? false
|
2013-06-06 13:07:54 +02:00
|
|
|
, # If you want the resulting program to call itself "Firefox" instead
|
|
|
|
# of "Shiretoko" 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/.
|
|
|
|
enableOfficialBranding ? false
|
|
|
|
}:
|
|
|
|
|
2014-12-17 19:11:30 +01:00
|
|
|
assert stdenv.cc ? libc && stdenv.cc.libc != null;
|
2013-06-06 13:07:54 +02:00
|
|
|
|
2015-09-03 10:54:13 +02:00
|
|
|
let
|
2013-06-06 13:07:54 +02:00
|
|
|
|
2016-04-13 12:57:53 +02:00
|
|
|
common = { pname, version, sha512 }: stdenv.mkDerivation rec {
|
2016-01-10 14:56:17 +01:00
|
|
|
name = "${pname}-unwrapped-${version}";
|
2013-06-06 13:07:54 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-09-22 20:03:52 +02:00
|
|
|
url =
|
|
|
|
let ext = if lib.versionAtLeast version "41.0" then "xz" else "bz2";
|
2016-05-09 15:49:44 +02:00
|
|
|
in "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.${ext}";
|
2016-04-13 12:57:53 +02:00
|
|
|
inherit sha512;
|
2013-06-06 13:07:54 +02:00
|
|
|
};
|
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
buildInputs =
|
2016-09-11 23:24:51 +02:00
|
|
|
[ pkgconfig gtk2 perl zip libIDL libjpeg zlib bzip2
|
2015-09-15 11:26:18 +02:00
|
|
|
python 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
|
2016-10-18 09:07:34 +02:00
|
|
|
xorg.libXScrnSaver xorg.scrnsaverproto
|
2015-09-15 11:26:18 +02:00
|
|
|
xorg.libXext xorg.xextproto sqlite unzip makeWrapper
|
2016-05-17 01:05:46 +02:00
|
|
|
hunspell libevent libstartup_notification libvpx /* cairo */
|
2016-05-15 00:05:46 +02:00
|
|
|
icu libpng jemalloc
|
2015-05-31 13:40:26 +02:00
|
|
|
libpulseaudio # only headers are needed
|
2015-05-07 13:28:36 +02:00
|
|
|
]
|
2016-05-18 23:07:49 +02:00
|
|
|
++ lib.optional enableGTK3 gtk3
|
|
|
|
++ lib.optionals (!passthru.ffmpegSupport) [ gstreamer gst_plugins_base ];
|
2014-07-23 15:31:49 +02:00
|
|
|
|
2016-06-08 16:45:52 +02:00
|
|
|
nativeBuildInputs = [autoconf213 which];
|
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
configureFlags =
|
|
|
|
[ "--enable-application=browser"
|
|
|
|
"--with-system-jpeg"
|
2013-06-06 13:07:54 +02:00
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-bz2"
|
|
|
|
"--with-system-nspr"
|
|
|
|
"--with-system-nss"
|
2013-06-11 11:52:15 +02:00
|
|
|
"--with-system-libevent"
|
2016-05-17 01:05:46 +02:00
|
|
|
"--with-system-libvpx"
|
2015-08-06 08:26:31 +02:00
|
|
|
"--with-system-png" # needs APNG support
|
|
|
|
"--with-system-icu"
|
2013-06-11 11:52:15 +02:00
|
|
|
"--enable-system-ffi"
|
|
|
|
"--enable-system-hunspell"
|
|
|
|
"--enable-system-pixman"
|
2013-06-06 13:07:54 +02:00
|
|
|
"--enable-system-sqlite"
|
2015-08-27 11:17:08 +02:00
|
|
|
#"--enable-system-cairo"
|
2013-12-23 10:12:09 +01:00
|
|
|
"--enable-startup-notification"
|
2015-08-06 08:26:31 +02:00
|
|
|
"--enable-content-sandbox" # available since 26.0, but not much info available
|
2013-06-06 13:07:54 +02:00
|
|
|
"--disable-crashreporter"
|
|
|
|
"--disable-tests"
|
|
|
|
"--disable-necko-wifi" # maybe we want to enable this at some point
|
|
|
|
"--disable-updater"
|
2015-08-06 08:26:31 +02:00
|
|
|
"--enable-jemalloc"
|
2015-09-22 20:03:52 +02:00
|
|
|
"--disable-gconf"
|
2016-04-28 10:33:54 +02:00
|
|
|
"--enable-default-toolkit=cairo-gtk2"
|
2016-11-15 13:26:16 +01:00
|
|
|
"--with-google-api-keyfile=ga"
|
2014-07-23 15:31:49 +02:00
|
|
|
]
|
2015-05-07 13:28:36 +02:00
|
|
|
++ lib.optional enableGTK3 "--enable-default-toolkit=cairo-gtk3"
|
2015-08-06 08:26:31 +02:00
|
|
|
++ (if debugBuild then [ "--enable-debug" "--enable-profiling" ]
|
2014-07-23 15:31:49 +02:00
|
|
|
else [ "--disable-debug" "--enable-release"
|
2016-03-16 10:00:52 +01:00
|
|
|
"--enable-optimize"
|
2014-09-07 00:46:25 +02:00
|
|
|
"--enable-strip" ])
|
2014-07-23 15:31:49 +02:00
|
|
|
++ lib.optional enableOfficialBranding "--enable-official-branding";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
''
|
2016-03-26 08:26:45 +01:00
|
|
|
configureScript="$(realpath ./configure)"
|
2014-07-23 15:31:49 +02:00
|
|
|
mkdir ../objdir
|
|
|
|
cd ../objdir
|
2016-11-15 13:26:16 +01:00
|
|
|
|
|
|
|
# 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" >ga
|
2014-07-23 15:31:49 +02:00
|
|
|
'';
|
2013-06-06 13:07:54 +02:00
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
preInstall =
|
|
|
|
''
|
|
|
|
# The following is needed for startup cache creation on grsecurity kernels.
|
2014-01-30 15:28:38 +01:00
|
|
|
paxmark m ../objdir/dist/bin/xpcshell
|
|
|
|
'';
|
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
postInstall =
|
|
|
|
''
|
2014-01-30 15:28:38 +01:00
|
|
|
# For grsecurity kernels
|
2016-06-29 17:23:03 +02:00
|
|
|
paxmark m $out/lib/firefox-[0-9]*/{firefox,firefox-bin,plugin-container}
|
2013-06-06 13:07:54 +02:00
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
# Remove SDK cruft. FIXME: move to a separate output?
|
|
|
|
rm -rf $out/share/idl $out/include $out/lib/firefox-devel-*
|
2015-06-18 14:45:43 +02:00
|
|
|
'' + lib.optionalString enableGTK3
|
2015-09-01 14:30:35 +02:00
|
|
|
# argv[0] must point to firefox itself
|
2015-06-18 14:45:43 +02:00
|
|
|
''
|
|
|
|
wrapProgram "$out/bin/firefox" \
|
2015-09-01 14:30:35 +02:00
|
|
|
--argv0 "$out/bin/.firefox-wrapped" \
|
2015-06-18 14:45:43 +02:00
|
|
|
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:" \
|
|
|
|
--suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS"
|
2015-09-01 14:30:35 +02:00
|
|
|
'' +
|
|
|
|
# some basic testing
|
|
|
|
''
|
|
|
|
"$out/bin/firefox" --version
|
2014-07-23 15:31:49 +02:00
|
|
|
'';
|
2013-06-06 13:07:54 +02:00
|
|
|
|
2016-09-18 23:19:51 +02:00
|
|
|
postFixup =
|
|
|
|
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
|
|
|
|
''
|
|
|
|
patchelf --set-rpath "${lib.getLib libnotify
|
|
|
|
}/lib:$(patchelf --print-rpath "$out"/lib/firefox-*/libxul.so)" \
|
|
|
|
"$out"/lib/firefox-*/libxul.so
|
|
|
|
'';
|
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
meta = {
|
2015-09-03 10:54:13 +02:00
|
|
|
description = "A web browser" + lib.optionalString (pname == "firefox-esr") " (Extended Support Release)";
|
2014-07-23 15:31:49 +02:00
|
|
|
homepage = http://www.mozilla.com/en-US/firefox/;
|
2014-11-29 02:14:36 +01:00
|
|
|
maintainers = with lib.maintainers; [ eelco ];
|
2014-07-23 15:31:49 +02:00
|
|
|
platforms = lib.platforms.linux;
|
2013-06-06 13:07:54 +02:00
|
|
|
};
|
|
|
|
|
2014-07-23 15:31:49 +02:00
|
|
|
passthru = {
|
2016-09-11 23:24:51 +02:00
|
|
|
inherit nspr version;
|
|
|
|
gtk = gtk2;
|
2014-07-23 15:31:49 +02:00
|
|
|
isFirefox3Like = true;
|
2016-05-18 23:07:49 +02:00
|
|
|
browserName = "firefox";
|
|
|
|
ffmpegSupport = lib.versionAtLeast version "46.0";
|
2013-06-06 13:07:54 +02:00
|
|
|
};
|
2015-09-03 10:54:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
2016-01-10 12:17:39 +01:00
|
|
|
firefox-unwrapped = common {
|
2015-09-03 10:54:13 +02:00
|
|
|
pname = "firefox";
|
2016-12-14 01:03:56 +01:00
|
|
|
version = "50.1.0";
|
|
|
|
sha512 = "2jwpk3aymkcq9f4xhzc31sb1c90vy3dvyqq2hvw97vk9dw7rgvv2cki10ns5cshbc4k57yd3j8nm7ppy2kw6na6771mj6sbijdjw39p";
|
2015-09-03 10:54:13 +02:00
|
|
|
};
|
|
|
|
|
2016-01-10 12:17:39 +01:00
|
|
|
firefox-esr-unwrapped = common {
|
2015-09-03 10:54:13 +02:00
|
|
|
pname = "firefox-esr";
|
2016-12-14 01:03:56 +01:00
|
|
|
version = "45.6.0esr";
|
|
|
|
sha512 = "086ci461hmz6kdn0ly9dlc723gc117si4a11a1c51gh79hczhahdaxg5s4r3k59rb43gpwxrlvm4wx1aka36bsihnh8a4caxnp72v5r";
|
2015-09-03 10:54:13 +02:00
|
|
|
};
|
|
|
|
|
2013-06-06 13:07:54 +02:00
|
|
|
}
|