Merge pull request #24961 from layus/thunderbird-default-mail-client

Thunderbird: Fix default mail client detection
This commit is contained in:
Nikolay Amiantov 2017-04-23 15:54:56 +03:00 committed by GitHub
commit 9f6baaa89a

View File

@ -6,7 +6,7 @@
, cairo, gstreamer, gst-plugins-base, icu, libpng, jemalloc
, autoconf213, which, m4
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
, enableGTK3 ? false, gtk3, wrapGAppsHook
, enableGTK3 ? false, gtk3, wrapGAppsHook, makeWrapper
, enableCalendar ? true
, debugBuild ? false
, # If you want the resulting program to call itself "Thunderbird" instead
@ -15,9 +15,12 @@
# Mozilla Foundation, see
# http://www.mozilla.org/foundation/trademarks/.
enableOfficialBranding ? false
, makeDesktopItem
}:
stdenv.mkDerivation rec {
let
wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
in stdenv.mkDerivation rec {
name = "thunderbird-${version}";
version = "52.0.1";
@ -46,8 +49,8 @@ stdenv.mkDerivation rec {
]
++ lib.optional enableGTK3 gtk3;
# from firefox + m4
nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python ] ++ lib.optional enableGTK3 wrapGAppsHook;
# from firefox + m4 + wrapperTool
nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python wrapperTool ];
configureFlags =
[ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
@ -100,13 +103,61 @@ stdenv.mkDerivation rec {
paxmark m ../objdir/dist/bin/xpcshell
'';
dontWrapGApps = true; # we do it ourselves
postInstall =
''
# For grsecurity kernels
paxmark m $out/lib/thunderbird-[0-9]*/thunderbird
# Needed to find Mozilla runtime
gappsWrapperArgs+=(--argv0 "$out/bin/.thunderbird-wrapped")
# 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-${version}/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-${version}/chrome/icons/default/default256.png";
genericName = "Main 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 =