1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
{ lib, stdenv, fetchurl, pkgconfig, gtk2, pango, perl, python, zip, fetchpatch
, libIDL, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
, freetype, fontconfig, file, nspr, nss, libnotify
, yasm, libGLU_combined, sqlite, unzip
, hunspell, libevent, libstartup_notification
, icu, libpng, jemalloc
, autoconf213, which, m4
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl, runtimeShell
, cargo, rustc, llvmPackages
, enableGTK3 ? false, gtk3, gnome3, wrapGAppsHook, makeWrapper
, enableCalendar ? true
, debugBuild ? false
, # If you want the resulting program to call itself "Thunderbird" instead
# of "Earlybird" 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
, makeDesktopItem
}:
let
wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
in stdenv.mkDerivation rec {
name = "thunderbird-${version}";
version = "60.7.1";
src = fetchurl {
url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
sha512 = "25dgbshgfmalxyah9rrgrxi4n0bmj0agcllz2hzv37w7makkl7qpf4wr859ykymmmvawcs8n747ppq9x73gn32bw88bjyxv2bn4l78q";
};
# from firefox, but without sound libraries
buildInputs =
[ gtk2 zip libIDL libjpeg zlib bzip2
dbus dbus-glib pango freetype fontconfig xorg.libXi
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
nspr nss libnotify xorg.pixman yasm libGLU_combined
xorg.libXScrnSaver xorg.xorgproto
xorg.libXext sqlite unzip
hunspell libevent libstartup_notification /* cairo */
icu libpng jemalloc
]
++ lib.optionals enableGTK3 [ gtk3 gnome3.adwaita-icon-theme ];
# from firefox + m4 + wrapperTool
nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python wrapperTool cargo rustc ];
patches = [
# Remove buildconfig.html to prevent a dependency on clang etc.
./no-buildconfig.patch
# Needed on older branches since rustc: 1.32.0 -> 1.33.0
(fetchurl {
name = "missing-documentation.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/deny_missing_docs.patch"
+ "?h=firefox-esr&id=03bdd01f9cf";
sha256 = "1i33n3fgwc8d0v7j4qn7lbdax0an6swar12gay3q2nwrhg3ic4fb";
})
];
configureFlags =
[ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
"--enable-application=comm/mail"
"--disable-alsa"
"--disable-pulseaudio"
"--with-system-jpeg"
"--with-system-zlib"
"--with-system-bz2"
"--with-system-nspr"
"--with-system-nss"
"--with-system-libevent"
"--with-system-png" # needs APNG support
"--with-system-icu"
#"--enable-rust-simd" # not supported since rustc 1.32.0 -> 1.33.0; TODO: probably OK since 68.0.0
"--enable-system-ffi"
"--enable-system-hunspell"
"--enable-system-pixman"
"--enable-system-sqlite"
#"--enable-system-cairo"
"--enable-startup-notification"
"--disable-crashreporter"
"--disable-tests"
"--disable-necko-wifi" # maybe we want to enable this at some point
"--disable-updater"
"--enable-jemalloc"
"--disable-gconf"
"--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
"--enable-js-shell"
]
++ lib.optional enableCalendar "--enable-calendar"
++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
else [ "--disable-debug" "--enable-release"
"--disable-debug-symbols"
"--enable-optimize" "--enable-strip" ])
++ lib.optional enableOfficialBranding "--enable-official-branding"
++ lib.optionals (lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [
# on i686-linux: --with-libclang-path is not available in this configuration
"--with-libclang-path=${llvmPackages.libclang}/lib"
"--with-clang-path=${llvmPackages.clang}/bin/clang"
];
enableParallelBuilding = true;
preConfigure =
''
cxxLib=$( echo -n ${gcc}/include/c++/* )
archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
test -f layout/style/ServoBindings.toml && sed -i -e '/"-DRUST_BINDGEN"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml
configureScript="$(realpath ./configure)"
mkdir ../objdir
cd ../objdir
'';
dontWrapGApps = true; # we do it ourselves
postInstall =
''
# TODO: Move to a dev output?
rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
# $binary is a symlink to $target.
# We wrap $target by replacing the $binary symlink.
local target="$out/lib/thunderbird/thunderbird"
local binary="$out/bin/thunderbird"
# Wrap correctly, this is needed to
# 1) find Mozilla runtime, because argv0 must be the real thing,
# or a symlink thereto. It cannot be the wrapper itself
# 2) detect itself as the default mailreader across builds
gappsWrapperArgs+=(
--argv0 "$target"
--set MOZ_APP_LAUNCHER thunderbird
)
${
# We wrap manually because wrapGAppsHook does not detect the symlink
# To mimic wrapGAppsHook, we run it with dontWrapGApps, so
# gappsWrapperArgs gets defined correctly
lib.optionalString enableGTK3 "wrapGAppsHook"
}
# "$binary" is a symlink, replace it by the wrapper
rm "$binary"
makeWrapper "$target" "$binary" "''${gappsWrapperArgs[@]}"
${ let desktopItem = makeDesktopItem {
name = "thunderbird";
exec = "thunderbird %U";
desktopName = "Thunderbird";
icon = "$out/lib/thunderbird/chrome/icons/default/default256.png";
genericName = "Mail Reader";
categories = "Application;Network";
mimeType = stdenv.lib.concatStringsSep ";" [
# Email
"x-scheme-handler/mailto"
"message/rfc822"
# Newsgroup
"x-scheme-handler/news"
"x-scheme-handler/snews"
"x-scheme-handler/nntp"
# Feed
"x-scheme-handler/feed"
"application/rss+xml"
"application/x-extension-rss"
];
}; in desktopItem.buildCommand
}
'';
postFixup =
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
''
patchelf --set-rpath "${lib.getLib libnotify
}/lib:$(patchelf --print-rpath "$out"/lib/thunderbird*/libxul.so)" \
"$out"/lib/thunderbird*/libxul.so
'';
doInstallCheck = true;
installCheckPhase =
''
# Some basic testing
"$out/bin/thunderbird" --version
'';
disallowedRequisites = [ stdenv.cc ];
meta = with stdenv.lib; {
description = "A full-featured e-mail client";
homepage = http://www.mozilla.org/thunderbird/;
license =
# Official branding implies thunderbird name and logo cannot be reuse,
# see http://www.mozilla.org/foundation/licensing.html
if enableOfficialBranding then licenses.proprietary else licenses.mpl11;
maintainers = [ maintainers.pierron maintainers.eelco ];
platforms = platforms.linux;
};
passthru.updateScript = import ./../../browsers/firefox/update.nix {
attrPath = "thunderbird";
baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
inherit stdenv writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl runtimeShell;
};
}
|