@@ -0,0 +1,108 @@
1+{ lib, stdenv, fetchurl, pkgconfig, gtk, pango, perl, python, zip, libIDL
2+, libjpeg, zlib, dbus, dbus_glib, bzip2, xlibs
3+, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
4+, yasm, mesa, sqlite, unzip, makeWrapper, pysqlite
5+, hunspell, libevent, libstartup_notification, libvpx
6+, cairo, gstreamer, gst_plugins_base, icu
7+, debugBuild ? false
8+, # If you want the resulting program to call itself "Firefox" instead
9+ # of "Shiretoko" or whatever, enable this option. However, those
10+ # binaries may not be distributed without permission from the
11+ # Mozilla Foundation, see
12+ # http://www.mozilla.org/foundation/trademarks/.
13+ enableOfficialBranding ? false
14+}:
15+
16+assert stdenv.gcc ? libc && stdenv.gcc.libc != null;
17+
18+let version = "33.1.1"; in
19+
20+stdenv.mkDerivation rec {
21+ name = "firefox-${version}";
22+
23+ src = fetchurl {
24+ url = "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${version}/source/firefox-${version}.source.tar.bz2";
25+ sha1 = "1e9e3176e7d221c4f2ce479f37ee7c432236a0ec";
26+ };
27+
28+ buildInputs =
29+ [ pkgconfig gtk perl zip libIDL libjpeg zlib bzip2
30+ python dbus dbus_glib pango freetype fontconfig xlibs.libXi
31+ xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt file
32+ alsaLib nspr nss libnotify xlibs.pixman yasm mesa
33+ xlibs.libXScrnSaver xlibs.scrnsaverproto pysqlite
34+ xlibs.libXext xlibs.xextproto sqlite unzip makeWrapper
35+ hunspell libevent libstartup_notification libvpx cairo
36+ gstreamer gst_plugins_base icu
37+ ];
38+
39+ configureFlags =
40+ [ "--enable-application=browser"
41+ "--disable-javaxpcom"
42+ "--with-system-jpeg"
43+ "--with-system-zlib"
44+ "--with-system-bz2"
45+ "--with-system-nspr"
46+ "--with-system-nss"
47+ "--with-system-libevent"
48+ "--with-system-libvpx"
49+ # "--with-system-png" # needs APNG support
50+ # "--with-system-icu" # causes ‘ar: invalid option -- 'L'’ in Firefox 28.0
51+ "--enable-system-ffi"
52+ "--enable-system-hunspell"
53+ "--enable-system-pixman"
54+ "--enable-system-sqlite"
55+ "--enable-system-cairo"
56+ "--enable-gstreamer"
57+ "--enable-startup-notification"
58+ # "--enable-content-sandbox" # available since 26.0, but not much info available
59+ # "--enable-content-sandbox-reporter" # keeping disabled for now
60+ "--disable-crashreporter"
61+ "--disable-tests"
62+ "--disable-necko-wifi" # maybe we want to enable this at some point
63+ "--disable-installer"
64+ "--disable-updater"
65+ "--disable-pulseaudio"
66+ ]
67+ ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
68+ else [ "--disable-debug" "--enable-release"
69+ "--enable-optimize${lib.optionalString (stdenv.system == "i686-linux") "=-O1"}"
70+ "--enable-strip" ])
71+ ++ lib.optional enableOfficialBranding "--enable-official-branding";
72+
73+ enableParallelBuilding = true;
74+
75+ preConfigure =
76+ ''
77+ mkdir ../objdir
78+ cd ../objdir
79+ configureScript=../mozilla-release/configure
80+ '';
81+
82+ preInstall =
83+ ''
84+ # The following is needed for startup cache creation on grsecurity kernels.
85+ paxmark m ../objdir/dist/bin/xpcshell
86+ '';
87+
88+ postInstall =
89+ ''
90+ # For grsecurity kernels
91+ paxmark m $out/lib/${name}/{firefox,firefox-bin,plugin-container}
92+
93+ # Remove SDK cruft. FIXME: move to a separate output?
94+ rm -rf $out/share/idl $out/include $out/lib/firefox-devel-*
95+ '';
96+
97+ meta = {
98+ description = "Web browser";
99+ homepage = http://www.mozilla.com/en-US/firefox/;
100+ maintainers = with lib.maintainers; [ eelco ];
101+ platforms = lib.platforms.linux;
102+ };
103+
104+ passthru = {
105+ inherit gtk nspr version;
106+ isFirefox3Like = true;
107+ };
108+}