git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #75328 from lovesegfault/thunderbird-rewrite

thunderbird: rewrite (68.2.2 -> 68.3.0)

commitf7e5482e55a5263f4fd13b9451485775d42ff457 authorworldofpeace <worldofpeace@protonmail.ch> dateThu 12 Dec 2019, 05:25 (7 years ago) parentbf8f92e8b8458a
2 files changed+315−189
pkgs/applications/networking/mailreaders/thunderbird/default.nix+314−188 pkgs/top-level/all-packages.nix+1−1
pkgs/applications/networking/mailreaders/thunderbird/default.nix+314−188
@@ -1,213 +1,339 @@
1−{ lib, stdenv, fetchurl, pkgconfig, gtk2, pango, perl, python2, python3, nodejs
2−, libIDL, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
3−, freetype, fontconfig, file, nspr, nss, libnotify
4−, yasm, libGLU, libGL, sqlite, zip, unzip
5−, libevent, libstartup_notification
6−, icu, libpng, jemalloc
7−, autoconf213, which, m4, fetchpatch
8−, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
1+{ autoconf213
2+, bzip2
3+, cargo
4+, common-updater-scripts
5+, coreutils
6+, curl
7+, dbus
8+, dbus-glib
9+, fetchurl
10+, file
11+, fontconfig
12+, freetype
13+, glib
14+, gnugrep
15+, gnused
16+, icu
17+, jemalloc
18+, lib
19+, libGL
20+, libGLU
21+, libIDL
22+, libevent
23+, libjpeg
24+, libnotify
25+, libpng
26+, libstartup_notification
27+, libvpx
28+, libwebp
29+, llvmPackages
30+, m4
31+, makeDesktopItem
32+, nasm
33+, nodejs
34+, nspr
35+, nss
36+, pango
37+, perl
38+, pkgconfig
39+, python2
40+, python3
941, runtimeShell
10−, cargo, rustc, rust-cbindgen, llvmPackages, nasm
11−, enableGTK3 ? false, gtk3, gnome3, wrapGAppsHook, makeWrapper
12−, enableCalendar ? true
42+, rust-cbindgen
43+, rustc
44+, sqlite
45+, stdenv
46+, unzip
47+, which
48+, writeScript
49+, xidel
50+, xorg
51+, yasm
52+, zip
53+, zlib
54+
1355, debugBuild ? false
56+
57+, alsaSupport ? stdenv.isLinux, alsaLib
58+, pulseaudioSupport ? stdenv.isLinux, libpulseaudio
59+, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
60+, waylandSupport ? true
61+, libxkbcommon, calendarSupport ? true
62+
1463, # If you want the resulting program to call itself "Thunderbird" instead
15− # of "Earlybird" or whatever, enable this option. However, those
16− # binaries may not be distributed without permission from the
17− # Mozilla Foundation, see
18− # http://www.mozilla.org/foundation/trademarks/.
19− enableOfficialBranding ? false
20−, makeDesktopItem
64+# of "Earlybird" or whatever, enable this option. However, those
65+# binaries may not be distributed without permission from the
66+# Mozilla Foundation, see
67+# http://www.mozilla.org/foundation/trademarks/.
68+enableOfficialBranding ? false
2169}:
2270
23−let
24− wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
25− gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
26−in stdenv.mkDerivation rec {
71+assert waylandSupport -> gtk3Support == true;
72+
73+stdenv.mkDerivation rec {
2774 pname = "thunderbird";
28− version = "68.2.2";
75+ version = "68.3.0";
2976
3077 src = fetchurl {
31− url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
32− sha512 = "3mvanjfc35f14lsfa4zjlhsvwij1n9dz9xmisd5s376r5wp9y33sva5ly914b2hmdl85ypdwv90zyi6whj7jb2f2xmqk480havxgjcn";
78+ url =
79+ "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
80+ sha512 =
81+ "3aqr3dj5laws516k6jf8f35a1964p0s75sp682yy87xnzgd8m1iha55z79dcavis2ma9hiyacjnznjz04qhqd4q8swjgfg7lj8lyiwl";
3382 };
3483
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
39− xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
40− nspr nss libnotify xorg.pixman yasm libGLU libGL
41− xorg.libXScrnSaver xorg.xorgproto
42− xorg.libXext sqlite unzip
43− libevent libstartup_notification /* cairo */
44− icu libpng jemalloc nasm
45− ]
46− ++ lib.optionals enableGTK3 [ gtk3 gnome3.adwaita-icon-theme ];
47−
48− # from firefox + m4 + wrapperTool
49− # llvm is for llvm-objdump
50− nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python2 python3 nodejs wrapperTool cargo rustc rust-cbindgen llvmPackages.llvm ];
84+ nativeBuildInputs = [
85+ autoconf213
86+ cargo
87+ gnused
88+ llvmPackages.llvm
89+ m4
90+ nasm
91+ nodejs
92+ perl
93+ pkgconfig
94+ python2
95+ python3
96+ rust-cbindgen
97+ rustc
98+ which
99+ yasm
100+ ] ++ lib.optional gtk3Support wrapGAppsHook;
101+
102+ buildInputs = [
103+ bzip2
104+ dbus
105+ dbus-glib
106+ file
107+ fontconfig
108+ freetype
109+ glib
110+ gtk2
111+ icu
112+ jemalloc
113+ libGL
114+ libGLU
115+ libIDL
116+ libevent
117+ libjpeg
118+ libnotify
119+ libpng
120+ libstartup_notification
121+ libvpx
122+ libwebp
123+ nspr
124+ nss
125+ pango
126+ perl
127+ sqlite
128+ unzip
129+ xorg.libX11
130+ xorg.libXScrnSaver
131+ xorg.libXcursor
132+ xorg.libXext
133+ xorg.libXft
134+ xorg.libXi
135+ xorg.libXrender
136+ xorg.libXt
137+ xorg.pixman
138+ xorg.xorgproto
139+ zip
140+ zlib
141+ ] ++ lib.optional alsaSupport alsaLib
142+ ++ lib.optional gtk3Support gtk3
143+ ++ lib.optional pulseaudioSupport libpulseaudio
144+ ++ lib.optional waylandSupport libxkbcommon;
145+
146+ NIX_CFLAGS_COMPILE =[
147+ "-I${glib.dev}/include/gio-unix-2.0"
148+ "-I${nss.dev}/include/nss"
149+ ];
51150
52151 patches = [
53− # Remove buildconfig.html to prevent a dependency on clang etc.
54152 ./no-buildconfig.patch
55− ]
56− ++ lib.optional (lib.versionOlder version "69")
57− (fetchpatch { # https://bugzilla.mozilla.org/show_bug.cgi?id=1500436#c29
58− name = "write_error-parallel_make.diff";
59− url = "https://hg.mozilla.org/mozilla-central/raw-diff/562655fe/python/mozbuild/mozbuild/action/node.py";
60− sha256 = "11d7rgzinb4mwl7yzhidjkajynmxgmffr4l9isgskfapyax9p88y";
61− });
62−
63− configureFlags =
64− [ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
65− "--enable-application=comm/mail"
66− "--disable-alsa"
67− "--disable-pulseaudio"
68−
69− "--with-system-jpeg"
70− "--with-system-zlib"
71− "--with-system-bz2"
72− "--with-system-nspr"
73− "--with-system-nss"
74− "--with-system-libevent"
75− "--with-system-png" # needs APNG support
76− "--with-system-icu"
77− #"--enable-rust-simd" # not supported since rustc 1.32.0 -> 1.33.0; TODO: probably OK since 68.0.0
78− "--enable-system-ffi"
79− "--enable-system-pixman"
80− "--enable-system-sqlite"
81− #"--enable-system-cairo"
82− "--enable-startup-notification"
83− "--disable-crashreporter"
84− "--disable-tests"
85− "--disable-necko-wifi" # maybe we want to enable this at some point
86− "--disable-updater"
87− "--enable-jemalloc"
88− "--disable-gconf"
89− "--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
90− "--enable-js-shell"
91− ]
92− ++ lib.optional enableCalendar "--enable-calendar"
93− ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
94− else [ "--disable-debug" "--enable-release"
95− "--disable-debug-symbols"
96− "--enable-optimize" "--enable-strip" ])
97− ++ lib.optional enableOfficialBranding "--enable-official-branding"
98− ++ lib.optionals (lib.versionAtLeast version "56" && !stdenv.hostPlatform.isi686) [
99− # on i686-linux: --with-libclang-path is not available in this configuration
100− "--with-libclang-path=${llvmPackages.libclang}/lib"
101− "--with-clang-path=${llvmPackages.clang}/bin/clang"
102− ];
153+ ];
103154
104− enableParallelBuilding = true;
155+ postPatch = ''
156+ rm -rf obj-x86_64-pc-linux-gnu
157+ '';
105158
106− preConfigure =
107− ''
108− cxxLib=$( echo -n ${gcc}/include/c++/* )
109− archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
110−
111− test -f layout/style/ServoBindings.toml && sed -i -e '/"-DRUST_BINDGEN"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml
112−
113− configureScript="$(realpath ./configure)"
114− mkdir ../objdir
115− cd ../objdir
116−
117− # AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286
118− unset AS
119− '';
120−
121− dontWrapGApps = true; # we do it ourselves
122− postInstall =
123− ''
124− # TODO: Move to a dev output?
125− rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
126−
127− # $binary is a symlink to $target.
128− # We wrap $target by replacing the $binary symlink.
129− local target="$out/lib/thunderbird/thunderbird"
130− local binary="$out/bin/thunderbird"
131−
132− # Wrap correctly, this is needed to
133− # 1) find Mozilla runtime, because argv0 must be the real thing,
134− # or a symlink thereto. It cannot be the wrapper itself
135− # 2) detect itself as the default mailreader across builds
136− gappsWrapperArgs+=(
137− --argv0 "$target"
138− --set MOZ_APP_LAUNCHER thunderbird
139− # See commit 87e261843c4236c541ee0113988286f77d2fa1ee
140− --set MOZ_LEGACY_PROFILES 1
141− --set MOZ_ALLOW_DOWNGRADE 1
142− # https://github.com/NixOS/nixpkgs/pull/61980
143− --set SNAP_NAME "thunderbird"
144− )
159+ preConfigure = ''
160+ # remove distributed configuration files
161+ rm -f configure
162+ rm -f js/src/configure
163+ rm -f .mozconfig*
164+
165+ configureScript="$(realpath ./mach) configure"
166+ # AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286
167+ unset AS
168+
169+ export MOZCONFIG=$(pwd)/mozconfig
170+
171+ # Set C flags for Rust's bindgen program. Unlike ordinary C
172+ # compilation, bindgen does not invoke $CC directly. Instead it
173+ # uses LLVM's libclang. To make sure all necessary flags are
174+ # included we need to look in a few places.
175+ # TODO: generalize this process for other use-cases.
176+
177+ BINDGEN_CFLAGS="$(< ${stdenv.cc}/nix-support/libc-cflags) \
178+ $(< ${stdenv.cc}/nix-support/cc-cflags) \
179+ ${stdenv.cc.default_cxx_stdlib_compile} \
180+ ${
181+ lib.optionalString stdenv.cc.isClang
182+ "-idirafter ${stdenv.cc.cc}/lib/clang/${
183+ lib.getVersion stdenv.cc.cc
184+ }/include"
185+ } \
145186 ${
146− # We wrap manually because wrapGAppsHook does not detect the symlink
147− # To mimic wrapGAppsHook, we run it with dontWrapGApps, so
148− # gappsWrapperArgs gets defined correctly
149− lib.optionalString enableGTK3 "wrapGAppsHook"
150− }
151−
152− # "$binary" is a symlink, replace it by the wrapper
153− rm "$binary"
154− makeWrapper "$target" "$binary" "''${gappsWrapperArgs[@]}"
155−
156− ${ let desktopItem = makeDesktopItem {
157− name = "thunderbird";
158− exec = "thunderbird %U";
159− desktopName = "Thunderbird";
160− icon = "$out/lib/thunderbird/chrome/icons/default/default256.png";
161− genericName = "Mail Reader";
162− categories = "Application;Network";
163− mimeType = stdenv.lib.concatStringsSep ";" [
164− # Email
165− "x-scheme-handler/mailto"
166− "message/rfc822"
167− # Newsgroup
168− "x-scheme-handler/news"
169− "x-scheme-handler/snews"
170− "x-scheme-handler/nntp"
171− # Feed
172− "x-scheme-handler/feed"
173− "application/rss+xml"
174− "application/x-extension-rss"
175− ];
176− }; in desktopItem.buildCommand
177− }
178− '';
179−
180− postFixup =
181− # Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
182− ''
183− patchelf --set-rpath "${lib.getLib libnotify
184− }/lib:$(patchelf --print-rpath "$out"/lib/thunderbird*/libxul.so)" \
185− "$out"/lib/thunderbird*/libxul.so
186− '';
187+ lib.optionalString stdenv.cc.isGNU
188+ "-isystem ${stdenv.cc.cc}/include/c++/${
189+ lib.getVersion stdenv.cc.cc
190+ } -isystem ${stdenv.cc.cc}/include/c++/${
191+ lib.getVersion stdenv.cc.cc
192+ }/$(cc -dumpmachine)"
193+ } \
194+ $NIX_CFLAGS_COMPILE"
187195
188− doInstallCheck = true;
189− installCheckPhase =
190− ''
191− # Some basic testing
192− "$out/bin/thunderbird" --version
193− '';
196+ echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
197+ '';
194198
195− disallowedRequisites = [ stdenv.cc ];
199+ configureFlags = let
200+ toolkitSlug = if gtk3Support then
201+ "3${lib.optionalString waylandSupport "-wayland"}"
202+ else
203+ "2";
204+ toolkitValue = "cairo-gtk${toolkitSlug}";
205+ in [
206+ "--enable-application=comm/mail"
196207
197− meta = with stdenv.lib; {
198− description = "A full-featured e-mail client";
199− homepage = http://www.mozilla.org/thunderbird/;
200− license =
201− # Official branding implies thunderbird name and logo cannot be reuse,
202− # see http://www.mozilla.org/foundation/licensing.html
203− if enableOfficialBranding then licenses.proprietary else licenses.mpl11;
204− maintainers = [ maintainers.pierron maintainers.eelco ];
205− platforms = platforms.linux;
206− };
208+ "--with-system-bz2"
209+ "--with-system-icu"
210+ "--with-system-jpeg"
211+ "--with-system-libevent"
212+ "--with-system-nspr"
213+ "--with-system-nss"
214+ "--with-system-png" # needs APNG support
215+ "--with-system-icu"
216+ "--with-system-zlib"
217+ "--with-system-webp"
218+ "--with-system-libvpx"
219+
220+ "--enable-rust-simd"
221+ "--enable-crashreporter"
222+ "--enable-default-toolkit=${toolkitValue}"
223+ "--enable-js-shell"
224+ "--enable-necko-wifi"
225+ "--enable-startup-notification"
226+ "--enable-system-ffi"
227+ "--enable-system-pixman"
228+ "--enable-system-sqlite"
229+
230+ "--disable-gconf"
231+ "--disable-tests"
232+ "--disable-updater"
233+ "--enable-jemalloc"
234+ ] ++ (if debugBuild then [
235+ "--enable-debug"
236+ "--enable-profiling"
237+ ] else [
238+ "--disable-debug"
239+ "--enable-release"
240+ "--disable-debug-symbols"
241+ "--enable-optimize"
242+ "--enable-strip"
243+ ]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [
244+ # on i686-linux: --with-libclang-path is not available in this configuration
245+ "--with-libclang-path=${llvmPackages.libclang}/lib"
246+ "--with-clang-path=${llvmPackages.clang}/bin/clang"
247+ ] ++ lib.optional alsaSupport "--enable-alsa"
248+ ++ lib.optional calendarSupport "--enable-calendar"
249+ ++ lib.optional enableOfficialBranding "--enable-official-branding"
250+ ++ lib.optional pulseaudioSupport "--enable-pulseaudio";
251+
252+ enableParallelBuilding = true;
253+
254+ postConfigure = ''
255+ cd obj-*
256+ '';
257+
258+ makeFlags = lib.optionals enableOfficialBranding [
259+ "MOZILLA_OFFICIAL=1"
260+ "BUILD_OFFICIAL=1"
261+ ];
262+
263+ doCheck = false;
264+
265+ postInstall = let
266+ desktopItem = makeDesktopItem {
267+ categories = lib.concatStringsSep ";" [ "Application" "Network" ];
268+ desktopName = "Thunderbird";
269+ genericName = "Mail Reader";
270+ name = "thunderbird";
271+ exec = "thunderbird %U";
272+ icon = "$out/lib/thunderbird/chrome/icons/default/default256.png";
273+ mimeType = lib.concatStringsSep ";" [
274+ # Email
275+ "x-scheme-handler/mailto"
276+ "message/rfc822"
277+ # Feeds
278+ "x-scheme-handler/feed"
279+ "application/rss+xml"
280+ "application/x-extension-rss"
281+ # Newsgroups
282+ "x-scheme-handler/news"
283+ "x-scheme-handler/snews"
284+ "x-scheme-handler/nntp"
285+ ];
286+ };
287+ in ''
288+ # TODO: Move to a dev output?
289+ rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
290+
291+ ${desktopItem.buildCommand}
292+ '';
293+
294+ preFixup = ''
295+ # Needed to find Mozilla runtime
296+ gappsWrapperArgs+=(
297+ --argv0 "$out/bin/thunderbird"
298+ --set MOZ_APP_LAUNCHER thunderbird
299+ # https://github.com/NixOS/nixpkgs/pull/61980
300+ --set SNAP_NAME "thunderbird"
301+ --set MOZ_LEGACY_PROFILES 1
302+ --set MOZ_ALLOW_DOWNGRADE 1
303+ )
304+ '';
305+
306+ # FIXME: This can probably be removed as soon as we package a
307+ # Thunderbird >=71.0 since XUL shouldn't be anymore (in use)?
308+ postFixup = ''
309+ local xul="$out/lib/thunderbird/libxul.so"
310+ patchelf --set-rpath "${libnotify}/lib:$(patchelf --print-rpath $xul)" $xul
311+ '';
312+
313+ doInstallCheck = true;
314+ installCheckPhase = ''
315+ "$out/bin/thunderbird" --version
316+ '';
317+
318+ disallowedRequisites = [
319+ stdenv.cc
320+ ];
207321
208322 passthru.updateScript = import ./../../browsers/firefox/update.nix {
209323 attrPath = "thunderbird";
210324 baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
211− inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl runtimeShell;
325+ inherit writeScript lib common-updater-scripts xidel coreutils gnused
326+ gnugrep curl runtimeShell;
327+ };
328+
329+ meta = with stdenv.lib; {
330+ description = "A full-featured e-mail client";
331+ homepage = "https://www.thunderbird.net";
332+ maintainers = with maintainers; [
333+ eelco
334+ lovesegfault
335+ pierron
336+ ];
337+ platforms = platforms.linux;
212338 };
213339}
pkgs/top-level/all-packages.nix+1−1
@@ -21443,7 +21443,7 @@ in
2144321443 inherit (gnome2) libIDL;
2144421444 inherit (rustPackages_1_38_0) cargo rustc;
2144521445 libpng = libpng_apng;
21446− enableGTK3 = true;
21446+ gtk3Support = true;
2144721447 };
2144821448
2144921449 thunderbolt = callPackage ../os-specific/linux/thunderbolt {};