@@ -1,28 +1,27 @@
1−{ stdenv, lib, fetchurl, pkgconfig, autoconf213, which, m4, gtk2, pango
2−, perl, python2, zip
3−, libIDL , libjpeg, libpng, zlib, dbus, dbus_glib, bzip2, xorg
4−, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
5−, yasm, mesa, sqlite, unzip, makeWrapper
6−, hunspell, libevent, libstartup_notification, libvpx
7−, cairo, gstreamer, gst-plugins-base, icu
1+{ lib, stdenv, fetchurl, pkgconfig, gtk2, pango, perl, python, zip, libIDL
2+, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
3+, freetype, fontconfig, file, nspr, nss, libnotify
4+, yasm, mesa, sqlite, unzip
5+, hunspell, libevent, libstartup_notification
6+, cairo, gstreamer, gst-plugins-base, icu, libpng, jemalloc
7+, autoconf213, which, m4
88, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
9+, enableGTK3 ? false, gtk3, wrapGAppsHook
910, debugBuild ? false
10−, # If you want the resulting program to call itself "Thunderbird"
11− # instead of "Earlybird", enable this option. However, those
11+, # If you want the resulting program to call itself "Thunderbird" instead
12+ # of "Earlybird" or whatever, enable this option. However, those
1213 # binaries may not be distributed without permission from the
1314 # Mozilla Foundation, see
1415 # http://www.mozilla.org/foundation/trademarks/.
1516 enableOfficialBranding ? false
1617}:
1718
18−let version = "52.0"; in
19−let verName = "${version}"; in
20−
2119stdenv.mkDerivation rec {
22− name = "thunderbird-${verName}";
20+ name = "thunderbird-${version}";
21+ version = "52.0";
2322
2423 src = fetchurl {
25− url = "mirror://mozilla/thunderbird/releases/${verName}/source/thunderbird-${verName}.source.tar.xz";
24+ url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
2625 sha512 = "215de8ae386f6f12d7a4338bb03bac956410be0dd4de5cca218e12241e3948c8c2540756e149bfde597cd10e399b4cb4db86619a2aa50a368ba323b413c1f93c";
2726 };
2827
@@ -33,97 +32,95 @@ stdenv.mkDerivation rec {
3332 done
3433 '';
3534
36− buildInputs = # from firefox30Pkgs.xulrunner, without gstreamer and libvpx
37− [ pkgconfig autoconf213 which libpng gtk2 perl zip libIDL libjpeg zlib bzip2
38− python2 dbus dbus_glib pango freetype fontconfig xorg.libXi
35+ # from firefox, but without sound libraries
36+ buildInputs =
37+ [ gtk2 zip libIDL libjpeg zlib bzip2
38+ dbus dbus_glib pango freetype fontconfig xorg.libXi
3939 xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
40− alsaLib nspr nss libnotify xorg.pixman yasm mesa
40+ nspr nss libnotify xorg.pixman yasm mesa
4141 xorg.libXScrnSaver xorg.scrnsaverproto
42− xorg.libXext xorg.xextproto sqlite unzip makeWrapper
43− hunspell libevent libstartup_notification cairo icu
44− ] ++ [ m4 ];
42+ xorg.libXext xorg.xextproto sqlite unzip
43+ hunspell libevent libstartup_notification /* cairo */
44+ icu libpng jemalloc
45+ ]
46+ ++ lib.optional enableGTK3 gtk3;
47+
48+ # from firefox + m4
49+ nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python ] ++ lib.optional enableGTK3 wrapGAppsHook;
50+
51+ configureFlags =
52+ [ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
53+ "--enable-application=mail"
54+ "--disable-alsa"
55+ "--disable-pulseaudio"
4556
46− configurePhase = let configureFlags = [ "--enable-application=mail" ]
47− # from firefox30Pkgs.commonConfigureFlags, but without gstreamer and libvpx
48− ++ [
4957 "--with-system-jpeg"
5058 "--with-system-zlib"
5159 "--with-system-bz2"
5260 "--with-system-nspr"
5361 "--with-system-nss"
5462 "--with-system-libevent"
55− #"--with-system-libvpx"
56− "--with-system-png"
63+ "--with-system-png" # needs APNG support
5764 "--with-system-icu"
5865 "--enable-system-ffi"
5966 "--enable-system-hunspell"
6067 "--enable-system-pixman"
6168 "--enable-system-sqlite"
62− "--enable-system-cairo"
63− "--disable-gconf"
69+ #"--enable-system-cairo"
6470 "--enable-startup-notification"
65− # "--enable-content-sandbox" # available since 26.0, but not much info available
66− # "--enable-content-sandbox-reporter" # keeping disabled for now
71+ "--enable-content-sandbox" # available since 26.0, but not much info available
6772 "--disable-crashreporter"
6873 "--disable-tests"
6974 "--disable-necko-wifi" # maybe we want to enable this at some point
7075 "--disable-updater"
71− "--disable-pulseaudio"
72− "--enable-default-toolkit=cairo-gtk2"
73− ] ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
76+ "--enable-jemalloc"
77+ "--disable-gconf"
78+ "--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
79+ ]
80+ ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
7481 else [ "--disable-debug" "--enable-release"
7582 "--disable-debug-symbols"
7683 "--enable-optimize" "--enable-strip" ])
77− ++ [
78− #"--enable-stdcxx-compat" # Avoid dependency on libstdc++ 4.7
79− ]
80− ++ stdenv.lib.optional enableOfficialBranding "--enable-official-branding";
81− in ''
82− mkdir -p objdir/mozilla
83− cd objdir
84− echo '${stdenv.lib.concatMapStrings (s : "ac_add_options ${s}\n") configureFlags}' > .mozconfig
85− echo 'ac_add_options --prefix="'"$out"'"' >> .mozconfig
86− # From version 38, we need to specify the source directory to build
87− # Thunderbird. Refer to mozilla/configure and search a line with
88− # "checking for application to build" and "# Support comm-central".
89− echo 'ac_add_options --with-external-source-dir="'`realpath ..`'"' >> .mozconfig
90− echo 'mk_add_options MOZ_MAKE_FLAGS="-j'"$NIX_BUILD_CORES"'"' >> .mozconfig
91− echo 'mk_add_options MOZ_OBJDIR="'`pwd`'"' >> .mozconfig
92−
93− export MOZCONFIG=`realpath ./.mozconfig`
94−
95− patchShebangs ../mozilla/mach
96− ../mozilla/mach configure
97− '';
84+ ++ lib.optional enableOfficialBranding "--enable-official-branding";
9885
9986 enableParallelBuilding = true;
100− requiredSystemFeatures = [ "big-parallel" ];
10187
102− buildPhase = "../mozilla/mach build";
88+ preConfigure =
89+ ''
90+ configureScript="$(realpath ./configure)"
91+ mkdir ../objdir
92+ cd ../objdir
93+ '';
94+
95+ preInstall =
96+ ''
97+ # The following is needed for startup cache creation on grsecurity kernels.
98+ paxmark m ../objdir/dist/bin/xpcshell
99+ '';
103100
104− installPhase =
101+ postInstall =
105102 ''
106− ../mozilla/mach install
107−
108− rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
109−
110− # Create a desktop item.
111− mkdir -p $out/share/applications
112− cat > $out/share/applications/thunderbird.desktop <<EOF
113− [Desktop Entry]
114− Type=Application
115− Exec=$out/bin/thunderbird
116− Icon=$out/lib/thunderbird-${version}/chrome/icons/default/default256.png
117− Name=Thunderbird
118− GenericName=Mail Reader
119− Categories=Application;Network;
120− EOF
103+ # For grsecurity kernels
104+ paxmark m $out/lib/thunderbird-[0-9]*/thunderbird
105+
106+ # Needed to find Mozilla runtime
107+ gappsWrapperArgs+=(--argv0 "$out/bin/.thunderbird-wrapped")
121108 '';
122109
123− postFixup =
124− ''
125− paxmark m $out/lib/thunderbird-${version}/thunderbird
126− '';
110+ postFixup =
111+ # Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
112+ ''
113+ patchelf --set-rpath "${lib.getLib libnotify
114+ }/lib:$(patchelf --print-rpath "$out"/lib/thunderbird-*/libxul.so)" \
115+ "$out"/lib/thunderbird-*/libxul.so
116+ '';
117+
118+ doInstallCheck = true;
119+ installCheckPhase =
120+ ''
121+ # Some basic testing
122+ "$out/bin/thunderbird" --version
123+ '';
127124
128125 meta = with stdenv.lib; {
129126 description = "A full-featured e-mail client";