Skip to content

Commit 7aca46f

Browse files
committedJun 13, 2017
thunderbird: 45.8.0 -> 52.1.1
... via picking the state in nixpkgs master. Fixes #26490. I saw no reason to omit any of the changes we've done in master. I'm testing it, though just briefly ATM. It still uses gtk2 by default.
1 parent d10fe64 commit 7aca46f

File tree

1 file changed

+124
-77
lines changed
  • pkgs/applications/networking/mailreaders/thunderbird

1 file changed

+124
-77
lines changed
 

‎pkgs/applications/networking/mailreaders/thunderbird/default.nix

+124-77
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,179 @@
1-
{ stdenv, lib, fetchurl, pkgconfig, which, m4, gtk2, pango, perl, python2, zip, libIDL
2-
, libjpeg, libpng, zlib, dbus, dbus_glib, bzip2, xorg
3-
, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
4-
, yasm, mesa, sqlite, unzip, makeWrapper
5-
, hunspell, libevent, libstartup_notification, libvpx
6-
, 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
78
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
9+
, enableGTK3 ? false, gtk3, gnome3, wrapGAppsHook, makeWrapper
10+
, enableCalendar ? true
811
, debugBuild ? false
9-
, # If you want the resulting program to call itself "Thunderbird"
10-
# instead of "Earlybird", enable this option. However, those
12+
, # If you want the resulting program to call itself "Thunderbird" instead
13+
# of "Earlybird" or whatever, enable this option. However, those
1114
# binaries may not be distributed without permission from the
1215
# Mozilla Foundation, see
1316
# http://www.mozilla.org/foundation/trademarks/.
1417
enableOfficialBranding ? false
18+
, makeDesktopItem
1519
}:
1620

17-
let version = "45.8.0"; in
18-
let verName = "${version}"; in
19-
20-
stdenv.mkDerivation rec {
21-
name = "thunderbird-${verName}";
21+
let
22+
wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
23+
in stdenv.mkDerivation rec {
24+
name = "thunderbird-${version}";
25+
version = "52.1.1";
2226

2327
src = fetchurl {
24-
url = "mirror://mozilla/thunderbird/releases/${verName}/source/thunderbird-${verName}.source.tar.xz";
25-
sha512 = "f8ba08d874fb1a09ac9ba5d4d1f46cefe801783ba4bf82eee682ac2ecc4e231d07033a80e036ad04bda7780c093fb7bc3122a23dc6e19c12f18fb7168dc78deb";
28+
url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
29+
sha512 = "84b54ae4401c9728c38f32f58e0df24e049471b3613f9973981b305e0ed09b2e8c2c1b5a35d4fee85ce2cf1d6fa99e80418bc216ae0d35d40e9fdeef61a6c06e";
2630
};
2731

28-
patches = [ ./gcc6.patch ];
29-
3032
# New sed no longer tolerates this mistake.
3133
postPatch = ''
3234
for f in mozilla/{js/src,}/configure; do
3335
substituteInPlace "$f" --replace '[:space:]*' '[[:space:]]*'
3436
done
3537
'';
3638

37-
buildInputs = # from firefox30Pkgs.xulrunner, without gstreamer and libvpx
38-
[ pkgconfig which libpng gtk2 perl zip libIDL libjpeg zlib bzip2
39-
python2 dbus dbus_glib pango freetype fontconfig xorg.libXi
39+
# from firefox, but without sound libraries
40+
buildInputs =
41+
[ gtk2 zip libIDL libjpeg zlib bzip2
42+
dbus dbus_glib pango freetype fontconfig xorg.libXi
4043
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
41-
alsaLib nspr nss libnotify xorg.pixman yasm mesa
44+
nspr nss libnotify xorg.pixman yasm mesa
4245
xorg.libXScrnSaver xorg.scrnsaverproto
43-
xorg.libXext xorg.xextproto sqlite unzip makeWrapper
44-
hunspell libevent libstartup_notification cairo icu
45-
] ++ [ m4 ];
46+
xorg.libXext xorg.xextproto sqlite unzip
47+
hunspell libevent libstartup_notification /* cairo */
48+
icu libpng jemalloc
49+
]
50+
++ lib.optionals enableGTK3 [ gtk3 gnome3.defaultIconTheme ];
51+
52+
# from firefox + m4 + wrapperTool
53+
nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python wrapperTool ];
54+
55+
configureFlags =
56+
[ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
57+
"--enable-application=mail"
58+
"--disable-alsa"
59+
"--disable-pulseaudio"
4660

47-
configurePhase = let configureFlags = [ "--enable-application=mail" ]
48-
# from firefox30Pkgs.commonConfigureFlags, but without gstreamer and libvpx
49-
++ [
5061
"--with-system-jpeg"
5162
"--with-system-zlib"
5263
"--with-system-bz2"
5364
"--with-system-nspr"
5465
"--with-system-nss"
5566
"--with-system-libevent"
56-
#"--with-system-libvpx"
57-
"--with-system-png"
67+
"--with-system-png" # needs APNG support
5868
"--with-system-icu"
5969
"--enable-system-ffi"
6070
"--enable-system-hunspell"
6171
"--enable-system-pixman"
6272
"--enable-system-sqlite"
6373
#"--enable-system-cairo"
64-
"--disable-gconf"
65-
"--disable-gstreamer"
6674
"--enable-startup-notification"
67-
# "--enable-content-sandbox" # available since 26.0, but not much info available
68-
# "--enable-content-sandbox-reporter" # keeping disabled for now
75+
"--enable-content-sandbox" # available since 26.0, but not much info available
6976
"--disable-crashreporter"
7077
"--disable-tests"
7178
"--disable-necko-wifi" # maybe we want to enable this at some point
72-
"--disable-installer"
7379
"--disable-updater"
74-
"--disable-pulseaudio"
75-
] ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
80+
"--enable-jemalloc"
81+
"--disable-gconf"
82+
"--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
83+
]
84+
++ lib.optional enableCalendar "--enable-calendar"
85+
++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
7686
else [ "--disable-debug" "--enable-release"
7787
"--disable-debug-symbols"
7888
"--enable-optimize" "--enable-strip" ])
79-
++ [
80-
"--disable-javaxpcom"
81-
#"--enable-stdcxx-compat" # Avoid dependency on libstdc++ 4.7
82-
]
83-
++ stdenv.lib.optional enableOfficialBranding "--enable-official-branding";
84-
in ''
85-
mkdir -p objdir/mozilla
86-
cd objdir
87-
echo '${stdenv.lib.concatMapStrings (s : "ac_add_options ${s}\n") configureFlags}' > .mozconfig
88-
echo 'ac_add_options --prefix="'"$out"'"' >> .mozconfig
89-
# From version 38, we need to specify the source directory to build
90-
# Thunderbird. Refer to mozilla/configure and search a line with
91-
# "checking for application to build" and "# Support comm-central".
92-
echo 'ac_add_options --with-external-source-dir="'`realpath ..`'"' >> .mozconfig
93-
echo 'mk_add_options MOZ_MAKE_FLAGS="-j'"$NIX_BUILD_CORES"'"' >> .mozconfig
94-
echo 'mk_add_options MOZ_OBJDIR="'`pwd`'"' >> .mozconfig
95-
96-
export MOZCONFIG=`realpath ./.mozconfig`
97-
98-
patchShebangs ../mozilla/mach
99-
../mozilla/mach configure
100-
'';
89+
++ lib.optional enableOfficialBranding "--enable-official-branding";
10190

10291
enableParallelBuilding = true;
103-
requiredSystemFeatures = [ "big-parallel" ];
10492

105-
buildPhase = "../mozilla/mach build";
93+
preConfigure =
94+
''
95+
configureScript="$(realpath ./configure)"
96+
mkdir ../objdir
97+
cd ../objdir
98+
'';
99+
100+
preInstall =
101+
''
102+
# The following is needed for startup cache creation on grsecurity kernels.
103+
paxmark m ../objdir/dist/bin/xpcshell
104+
'';
106105

107-
installPhase =
106+
dontWrapGApps = true; # we do it ourselves
107+
postInstall =
108108
''
109-
../mozilla/mach install
109+
# For grsecurity kernels
110+
paxmark m $out/lib/thunderbird-[0-9]*/thunderbird
110111
112+
# TODO: Move to a dev output?
111113
rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
112114
113-
# Create a desktop item.
114-
mkdir -p $out/share/applications
115-
cat > $out/share/applications/thunderbird.desktop <<EOF
116-
[Desktop Entry]
117-
Type=Application
118-
Exec=$out/bin/thunderbird
119-
Icon=$out/lib/thunderbird-${version}/chrome/icons/default/default256.png
120-
Name=Thunderbird
121-
GenericName=Mail Reader
122-
Categories=Application;Network;
123-
EOF
115+
# $binary is a symlink to $target.
116+
# We wrap $target by replacing the $binary symlink.
117+
local target="$out/lib/thunderbird-${version}/thunderbird"
118+
local binary="$out/bin/thunderbird"
119+
120+
# Wrap correctly, this is needed to
121+
# 1) find Mozilla runtime, because argv0 must be the real thing,
122+
# or a symlink thereto. It cannot be the wrapper itself
123+
# 2) detect itself as the default mailreader across builds
124+
gappsWrapperArgs+=(
125+
--argv0 "$target"
126+
--set MOZ_APP_LAUNCHER thunderbird
127+
)
128+
${
129+
# We wrap manually because wrapGAppsHook does not detect the symlink
130+
# To mimic wrapGAppsHook, we run it with dontWrapGApps, so
131+
# gappsWrapperArgs gets defined correctly
132+
lib.optionalString enableGTK3 "wrapGAppsHook"
133+
}
134+
135+
# "$binary" is a symlink, replace it by the wrapper
136+
rm "$binary"
137+
makeWrapper "$target" "$binary" "''${gappsWrapperArgs[@]}"
138+
139+
${ let desktopItem = makeDesktopItem {
140+
name = "thunderbird";
141+
exec = "thunderbird %U";
142+
desktopName = "Thunderbird";
143+
icon = "$out/lib/thunderbird-${version}/chrome/icons/default/default256.png";
144+
genericName = "Main Reader";
145+
categories = "Application;Network";
146+
mimeType = stdenv.lib.concatStringsSep ";" [
147+
# Email
148+
"x-scheme-handler/mailto"
149+
"message/rfc822"
150+
# Newsgroup
151+
"x-scheme-handler/news"
152+
"x-scheme-handler/snews"
153+
"x-scheme-handler/nntp"
154+
# Feed
155+
"x-scheme-handler/feed"
156+
"application/rss+xml"
157+
"application/x-extension-rss"
158+
];
159+
}; in desktopItem.buildCommand
160+
}
124161
'';
125162

126-
postFixup =
127-
''
128-
paxmark m $out/lib/thunderbird-${version}/thunderbird
129-
'';
163+
postFixup =
164+
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
165+
''
166+
patchelf --set-rpath "${lib.getLib libnotify
167+
}/lib:$(patchelf --print-rpath "$out"/lib/thunderbird-*/libxul.so)" \
168+
"$out"/lib/thunderbird-*/libxul.so
169+
'';
170+
171+
doInstallCheck = true;
172+
installCheckPhase =
173+
''
174+
# Some basic testing
175+
"$out/bin/thunderbird" --version
176+
'';
130177

131178
meta = with stdenv.lib; {
132179
description = "A full-featured e-mail client";

1 commit comments

Comments
 (1)

vcunat commented on Jun 13, 2017

@vcunat
MemberAuthor

To be clear, all changes to thunderbird directly were picked, except that it still defaults to gtk2.

Please sign in to comment.