2019-08-29 12:56:24 +01:00
|
|
|
{ lib, stdenv, fetchurl, pkgconfig, gtk2, pango, perl, python2, python3, nodejs
|
2018-10-03 01:13:57 +01:00
|
|
|
, libIDL, libjpeg, zlib, dbus, dbus-glib, bzip2, xorg
|
2017-04-09 18:15:06 +01:00
|
|
|
, freetype, fontconfig, file, nspr, nss, libnotify
|
2019-11-10 16:44:34 +00:00
|
|
|
, yasm, libGLU, libGL, sqlite, zip, unzip
|
2019-08-29 12:56:24 +01:00
|
|
|
, libevent, libstartup_notification
|
2018-07-21 01:44:44 +01:00
|
|
|
, icu, libpng, jemalloc
|
2019-08-29 12:56:24 +01:00
|
|
|
, autoconf213, which, m4, fetchpatch
|
|
|
|
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
|
|
|
|
, runtimeShell
|
|
|
|
, cargo, rustc, rust-cbindgen, llvmPackages, nasm
|
2017-05-04 21:53:45 +01:00
|
|
|
, enableGTK3 ? false, gtk3, gnome3, wrapGAppsHook, makeWrapper
|
2017-04-12 17:46:07 +01:00
|
|
|
, enableCalendar ? true
|
2014-07-22 21:18:24 +01:00
|
|
|
, debugBuild ? false
|
2017-04-09 18:15:06 +01:00
|
|
|
, # If you want the resulting program to call itself "Thunderbird" instead
|
|
|
|
# of "Earlybird" or whatever, enable this option. However, those
|
2012-03-21 01:26:21 +00:00
|
|
|
# binaries may not be distributed without permission from the
|
|
|
|
# Mozilla Foundation, see
|
|
|
|
# http://www.mozilla.org/foundation/trademarks/.
|
|
|
|
enableOfficialBranding ? false
|
2017-04-15 20:11:34 +01:00
|
|
|
, makeDesktopItem
|
2012-03-21 01:26:21 +00:00
|
|
|
}:
|
|
|
|
|
2017-04-16 08:57:02 +01:00
|
|
|
let
|
|
|
|
wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
|
2018-08-06 08:08:37 +01:00
|
|
|
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
2017-04-16 08:57:02 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "thunderbird";
|
2019-12-09 18:39:29 +00:00
|
|
|
version = "68.3.0";
|
2012-03-21 01:26:21 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-04-09 18:15:06 +01:00
|
|
|
url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
|
2019-12-09 18:39:29 +00:00
|
|
|
sha512 = "3aqr3dj5laws516k6jf8f35a1964p0s75sp682yy87xnzgd8m1iha55z79dcavis2ma9hiyacjnznjz04qhqd4q8swjgfg7lj8lyiwl";
|
2012-03-21 01:26:21 +00:00
|
|
|
};
|
|
|
|
|
2017-04-09 18:15:06 +01:00
|
|
|
# from firefox, but without sound libraries
|
|
|
|
buildInputs =
|
|
|
|
[ gtk2 zip libIDL libjpeg zlib bzip2
|
2018-02-25 02:23:58 +00:00
|
|
|
dbus dbus-glib pango freetype fontconfig xorg.libXi
|
2015-09-15 10:26:18 +01:00
|
|
|
xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
|
2019-11-10 16:44:34 +00:00
|
|
|
nspr nss libnotify xorg.pixman yasm libGLU libGL
|
2018-12-31 03:40:47 +00:00
|
|
|
xorg.libXScrnSaver xorg.xorgproto
|
|
|
|
xorg.libXext sqlite unzip
|
2019-08-29 12:56:24 +01:00
|
|
|
libevent libstartup_notification /* cairo */
|
|
|
|
icu libpng jemalloc nasm
|
2017-04-09 18:15:06 +01:00
|
|
|
]
|
2019-02-13 21:47:50 +00:00
|
|
|
++ lib.optionals enableGTK3 [ gtk3 gnome3.adwaita-icon-theme ];
|
2017-04-09 18:15:06 +01:00
|
|
|
|
2017-04-16 08:57:02 +01:00
|
|
|
# from firefox + m4 + wrapperTool
|
2019-08-29 12:56:24 +01:00
|
|
|
# llvm is for llvm-objdump
|
|
|
|
nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python2 python3 nodejs wrapperTool cargo rustc rust-cbindgen llvmPackages.llvm ];
|
2017-04-09 18:15:06 +01:00
|
|
|
|
2018-10-03 01:13:57 +01:00
|
|
|
patches = [
|
2018-10-08 15:30:19 +01:00
|
|
|
# Remove buildconfig.html to prevent a dependency on clang etc.
|
2019-01-30 14:16:37 +00:00
|
|
|
./no-buildconfig.patch
|
2019-08-29 12:56:24 +01:00
|
|
|
]
|
|
|
|
++ lib.optional (lib.versionOlder version "69")
|
|
|
|
(fetchpatch { # https://bugzilla.mozilla.org/show_bug.cgi?id=1500436#c29
|
|
|
|
name = "write_error-parallel_make.diff";
|
|
|
|
url = "https://hg.mozilla.org/mozilla-central/raw-diff/562655fe/python/mozbuild/mozbuild/action/node.py";
|
|
|
|
sha256 = "11d7rgzinb4mwl7yzhidjkajynmxgmffr4l9isgskfapyax9p88y";
|
|
|
|
});
|
2018-10-03 01:13:57 +01:00
|
|
|
|
2017-04-09 18:15:06 +01:00
|
|
|
configureFlags =
|
|
|
|
[ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio)
|
2018-08-06 08:08:37 +01:00
|
|
|
"--enable-application=comm/mail"
|
2017-04-09 18:15:06 +01:00
|
|
|
"--disable-alsa"
|
|
|
|
"--disable-pulseaudio"
|
2012-03-21 01:26:21 +00:00
|
|
|
|
|
|
|
"--with-system-jpeg"
|
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-bz2"
|
|
|
|
"--with-system-nspr"
|
2012-10-05 21:15:56 +01:00
|
|
|
"--with-system-nss"
|
2014-07-22 21:18:24 +01:00
|
|
|
"--with-system-libevent"
|
2017-04-09 18:15:06 +01:00
|
|
|
"--with-system-png" # needs APNG support
|
2014-07-22 21:18:24 +01:00
|
|
|
"--with-system-icu"
|
2019-04-06 12:09:05 +01:00
|
|
|
#"--enable-rust-simd" # not supported since rustc 1.32.0 -> 1.33.0; TODO: probably OK since 68.0.0
|
2014-07-22 21:18:24 +01:00
|
|
|
"--enable-system-ffi"
|
|
|
|
"--enable-system-pixman"
|
|
|
|
"--enable-system-sqlite"
|
2017-04-09 18:15:06 +01:00
|
|
|
#"--enable-system-cairo"
|
2014-07-22 21:18:24 +01:00
|
|
|
"--enable-startup-notification"
|
2012-03-21 01:26:21 +00:00
|
|
|
"--disable-crashreporter"
|
|
|
|
"--disable-tests"
|
2014-07-22 21:18:24 +01:00
|
|
|
"--disable-necko-wifi" # maybe we want to enable this at some point
|
|
|
|
"--disable-updater"
|
2017-04-09 18:15:06 +01:00
|
|
|
"--enable-jemalloc"
|
|
|
|
"--disable-gconf"
|
|
|
|
"--enable-default-toolkit=cairo-gtk${if enableGTK3 then "3" else "2"}"
|
2018-08-06 08:08:37 +01:00
|
|
|
"--enable-js-shell"
|
2017-04-09 18:15:06 +01:00
|
|
|
]
|
2017-04-12 17:46:07 +01:00
|
|
|
++ lib.optional enableCalendar "--enable-calendar"
|
2017-04-09 18:15:06 +01:00
|
|
|
++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
|
2014-07-22 21:18:24 +01:00
|
|
|
else [ "--disable-debug" "--enable-release"
|
2015-01-13 20:45:47 +00:00
|
|
|
"--disable-debug-symbols"
|
2014-07-22 21:18:24 +01:00
|
|
|
"--enable-optimize" "--enable-strip" ])
|
2018-08-06 08:08:37 +01:00
|
|
|
++ 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"
|
|
|
|
];
|
2012-03-21 01:26:21 +00:00
|
|
|
|
2015-05-21 13:00:42 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-04-09 18:15:06 +01:00
|
|
|
preConfigure =
|
|
|
|
''
|
2018-08-06 08:08:37 +01:00
|
|
|
cxxLib=$( echo -n ${gcc}/include/c++/* )
|
|
|
|
archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
|
2018-12-22 11:49:41 +00:00
|
|
|
|
2018-08-06 08:08:37 +01:00
|
|
|
test -f layout/style/ServoBindings.toml && sed -i -e '/"-DRUST_BINDGEN"/ a , "-cxx-isystem", "'$cxxLib'", "-isystem", "'$archLib'"' layout/style/ServoBindings.toml
|
|
|
|
|
2017-04-09 18:15:06 +01:00
|
|
|
configureScript="$(realpath ./configure)"
|
|
|
|
mkdir ../objdir
|
|
|
|
cd ../objdir
|
2019-08-29 12:56:24 +01:00
|
|
|
|
|
|
|
# AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286
|
|
|
|
unset AS
|
2017-04-09 18:15:06 +01:00
|
|
|
'';
|
|
|
|
|
2017-04-16 08:57:02 +01:00
|
|
|
dontWrapGApps = true; # we do it ourselves
|
2017-04-09 18:15:06 +01:00
|
|
|
postInstall =
|
2012-03-21 01:26:21 +00:00
|
|
|
''
|
2017-04-15 20:11:34 +01:00
|
|
|
# TODO: Move to a dev output?
|
|
|
|
rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
|
|
|
|
|
2017-04-16 08:57:02 +01:00
|
|
|
# $binary is a symlink to $target.
|
|
|
|
# We wrap $target by replacing the $binary symlink.
|
2018-08-06 08:08:37 +01:00
|
|
|
local target="$out/lib/thunderbird/thunderbird"
|
2017-04-16 08:57:02 +01:00
|
|
|
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
|
2019-10-23 01:23:20 +01:00
|
|
|
# See commit 87e261843c4236c541ee0113988286f77d2fa1ee
|
|
|
|
--set MOZ_LEGACY_PROFILES 1
|
|
|
|
--set MOZ_ALLOW_DOWNGRADE 1
|
2019-08-29 12:56:24 +01:00
|
|
|
# https://github.com/NixOS/nixpkgs/pull/61980
|
|
|
|
--set SNAP_NAME "thunderbird"
|
2017-04-16 08:57:02 +01:00
|
|
|
)
|
|
|
|
${
|
|
|
|
# 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[@]}"
|
|
|
|
|
2017-04-15 20:11:34 +01:00
|
|
|
${ let desktopItem = makeDesktopItem {
|
|
|
|
name = "thunderbird";
|
2017-04-16 08:57:02 +01:00
|
|
|
exec = "thunderbird %U";
|
2017-04-15 20:11:34 +01:00
|
|
|
desktopName = "Thunderbird";
|
2018-08-06 08:08:37 +01:00
|
|
|
icon = "$out/lib/thunderbird/chrome/icons/default/default256.png";
|
2018-03-07 20:09:25 +00:00
|
|
|
genericName = "Mail Reader";
|
2017-04-15 20:11:34 +01:00
|
|
|
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
|
|
|
|
}
|
2012-03-21 01:26:21 +00:00
|
|
|
'';
|
|
|
|
|
2017-04-09 18:15:06 +01:00
|
|
|
postFixup =
|
|
|
|
# Fix notifications. LibXUL uses dlopen for this, unfortunately; see #18712.
|
|
|
|
''
|
|
|
|
patchelf --set-rpath "${lib.getLib libnotify
|
2018-08-06 08:08:37 +01:00
|
|
|
}/lib:$(patchelf --print-rpath "$out"/lib/thunderbird*/libxul.so)" \
|
|
|
|
"$out"/lib/thunderbird*/libxul.so
|
2017-04-09 18:15:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase =
|
|
|
|
''
|
|
|
|
# Some basic testing
|
|
|
|
"$out/bin/thunderbird" --version
|
|
|
|
'';
|
2016-10-13 13:26:29 +01:00
|
|
|
|
2018-10-08 15:30:19 +01:00
|
|
|
disallowedRequisites = [ stdenv.cc ];
|
|
|
|
|
2012-03-21 01:26:21 +00:00
|
|
|
meta = with stdenv.lib; {
|
2014-07-22 21:18:24 +01:00
|
|
|
description = "A full-featured e-mail client";
|
2012-03-21 01:26:21 +00:00
|
|
|
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;
|
2013-05-17 13:55:06 +01:00
|
|
|
maintainers = [ maintainers.pierron maintainers.eelco ];
|
2012-10-05 21:15:56 +01:00
|
|
|
platforms = platforms.linux;
|
2012-03-21 01:26:21 +00:00
|
|
|
};
|
2016-12-25 08:35:20 +00:00
|
|
|
|
|
|
|
passthru.updateScript = import ./../../browsers/firefox/update.nix {
|
2017-01-04 22:38:55 +00:00
|
|
|
attrPath = "thunderbird";
|
2016-12-25 08:35:20 +00:00
|
|
|
baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
|
2019-06-18 12:08:32 +01:00
|
|
|
inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl runtimeShell;
|
2016-12-25 08:35:20 +00:00
|
|
|
};
|
2012-03-21 01:26:21 +00:00
|
|
|
}
|