Merge pull request #151627 from lovesegfault/thunderbird-bin-fix-pciutils

thunderbird-bin: bring in-line with firefox-bin
This commit is contained in:
Bernardo Meurer 2021-12-21 22:02:01 +00:00 committed by GitHub
commit 9e1b85b91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 63 deletions

View File

@ -2,34 +2,25 @@
#
# To update `thunderbird-bin`'s `release_sources.nix`, run from the nixpkgs root:
#
# nix-shell maintainers/scripts/update.nix --argstr package pkgs.firefox-bin-unwrapped
{ stdenv, lib, fetchurl, config, makeWrapper
# nix-shell maintainers/scripts/update.nix --argstr package pkgs.thunderbird-bin-unwrapped
{ lib, stdenv, fetchurl, config, wrapGAppsHook
, alsa-lib
, at-spi2-atk
, atk
, cairo
, coreutils
, cups
, curl
, dbus
, cups
, dbus-glib
, dbus
, fontconfig
, freetype
, gdk-pixbuf
, glib
, glibc
, gnome
, gnugrep
, gnupg
, gnused
, gpgme
, gtk2
, gtk3
, libkrb5
, libcanberra
, libGL
, libGLU
, libX11
, libXScrnSaver
, libxcb
, libXcomposite
, libXcursor
@ -39,24 +30,43 @@
, libXi
, libXinerama
, libXrender
, libXScrnSaver
, libXrandr
, libXt
, libXtst
, libcanberra
, libnotify
, adwaita-icon-theme
, libGLU, libGL
, nspr
, nss
, pango
, runtimeShell
, pipewire
, pciutils
, libheimdal
, libpulseaudio
, systemd
, writeScript
, xdg-utils
, writeText
, xidel
, coreutils
, gnused
, gnugrep
, gnupg
, ffmpeg
, runtimeShell
, mesa # thunderbird wants gbm for drm+dmabuf
, systemLocale ? config.i18n.defaultLocale or "en_US"
}:
# imports `version` and `sources`
with (import ./release_sources.nix);
let
arch = if stdenv.hostPlatform.system == "i686-linux"
then "linux-i686"
else "linux-x86_64";
inherit (import ./release_sources.nix) version sources;
mozillaPlatforms = {
i686-linux = "linux-i686";
x86_64-linux = "linux-x86_64";
};
arch = mozillaPlatforms.${stdenv.hostPlatform.system};
isPrefixOf = prefix: string:
builtins.substring 0 (builtins.stringLength prefix) string == prefix;
@ -64,11 +74,17 @@ let
sourceMatches = locale: source:
(isPrefixOf source.locale locale) && source.arch == arch;
systemLocale = config.i18n.defaultLocale or "en-US";
policies = { DisableAppUpdate = true; } // config.thunderbird.policies or { };
policiesJson = writeText "thunderbird-policies.json" (builtins.toJSON { inherit policies; });
defaultSource = lib.findFirst (sourceMatches "en-US") {} sources;
source = lib.findFirst (sourceMatches systemLocale) defaultSource sources;
mozLocale =
if systemLocale == "ca_ES@valencia"
then "ca-valencia"
else lib.replaceStrings ["_"] ["-"] systemLocale;
source = lib.findFirst (sourceMatches mozLocale) defaultSource sources;
in
stdenv.mkDerivation {
@ -83,11 +99,10 @@ stdenv.mkDerivation {
libPath = lib.makeLibraryPath
[ stdenv.cc.cc
alsa-lib
at-spi2-atk
atk
cairo
cups
curl
cups
dbus-glib
dbus
fontconfig
@ -98,34 +113,55 @@ stdenv.mkDerivation {
gtk2
gtk3
libkrb5
mesa
libX11
libXScrnSaver
libXcomposite
libXcursor
libxcb
libXdamage
libXext
libXfixes
libXi
libXinerama
libXrender
libXrandr
libXt
libxcb
libXtst
libcanberra
libnotify
libGLU libGL
nspr
nss
pango
pipewire
pciutils
libheimdal
libpulseaudio
systemd
ffmpeg
] + ":" + lib.makeSearchPathOutput "lib" "lib64" [
stdenv.cc.cc
];
buildInputs = [ gtk3 gnome.adwaita-icon-theme ];
inherit gtk3;
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ wrapGAppsHook ];
buildInputs = [ gtk3 adwaita-icon-theme ];
# "strip" after "patchelf" may break binaries.
# See: https://github.com/NixOS/patchelf/issues/10
dontStrip = true;
dontPatchELF = true;
patchPhase = ''
# Don't download updates from Mozilla directly
echo 'pref("app.update.auto", "false");' >> defaults/pref/channel-prefs.js
'';
# See "Note on GPG support" in `../thunderbird/default.nix` for explanations
# on adding `gnupg` and `gpgme` into PATH/LD_LIBRARY_PATH.
installPhase =
''
mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}"
@ -135,41 +171,27 @@ stdenv.mkDerivation {
ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/"
for executable in \
thunderbird crashreporter thunderbird-bin plugin-container updater
thunderbird thunderbird-bin plugin-container \
updater crashreporter webapprt-stub
do
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
"$out/usr/lib/thunderbird-bin-${version}/$executable"
if [ -e "$out/usr/lib/thunderbird-bin-${version}/$executable" ]; then
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
"$out/usr/lib/thunderbird-bin-${version}/$executable"
fi
done
find . -executable -type f -exec \
patchelf --set-rpath "$libPath" \
"$out/usr/lib/thunderbird-bin-${version}/{}" \;
# Create a desktop item.
mkdir -p $out/share/applications
cat > $out/share/applications/thunderbird.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=$out/bin/thunderbird
Icon=$out/usr/lib/thunderbird-bin-${version}/chrome/icons/default/default256.png
Name=Thunderbird
GenericName=Mail Reader
Categories=Application;Network;
EOF
# wrapThunderbird expects "$out/lib" instead of "$out/usr/lib"
ln -s "$out/usr/lib" "$out/lib"
# SNAP_NAME: https://github.com/NixOS/nixpkgs/pull/61980
# MOZ_LEGACY_PROFILES and MOZ_ALLOW_DOWNGRADE:
# commit 87e261843c4236c541ee0113988286f77d2fa1ee
wrapProgram "$out/bin/thunderbird" \
--argv0 "$out/bin/.thunderbird-wrapped" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:" \
--suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS" \
--set SNAP_NAME "thunderbird" \
--set MOZ_LEGACY_PROFILES 1 \
--set MOZ_ALLOW_DOWNGRADE 1 \
--prefix PATH : "${lib.getBin gnupg}/bin" \
--prefix PATH : "${lib.getBin xdg-utils}/bin" \
--prefix LD_LIBRARY_PATH : "${lib.getLib gpgme}/lib"
gappsWrapperArgs+=(--argv0 "$out/bin/.thunderbird-wrapped")
# See: https://github.com/mozilla/policy-templates/blob/master/README.md
mkdir -p "$out/lib/thunderbird-bin-${version}/distribution";
ln -s ${policiesJson} "$out/lib/thunderbird-bin-${version}/distribution/policies.json";
'';
passthru.updateScript = import ./../../browsers/firefox-bin/update.nix {
@ -180,12 +202,13 @@ stdenv.mkDerivation {
basePath = "pkgs/applications/networking/mailreaders/thunderbird-bin";
baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
};
meta = with lib; {
description = "Mozilla Thunderbird, a full-featured email client (binary package)";
homepage = "http://www.mozilla.org/thunderbird/";
license = licenses.mpl20;
maintainers = with lib.maintainers; [ ];
platforms = platforms.linux;
maintainers = with lib.maintainers; [ lovesegfault ];
platforms = builtins.attrNames mozillaPlatforms;
hydraPlatforms = [ ];
};
}

View File

@ -28799,10 +28799,19 @@ with pkgs;
thunderbird = wrapThunderbird thunderbird-unwrapped { };
thunderbird-wayland = wrapThunderbird thunderbird-unwrapped { forceWayland = true; };
thunderbolt = callPackage ../os-specific/linux/thunderbolt {};
thunderbird-bin = thunderbird-bin-91;
thunderbird-bin-91 = callPackage ../applications/networking/mailreaders/thunderbird-bin { };
thunderbird-bin-unwrapped = thunderbird-bin-91-unwrapped;
thunderbird-bin-91 = wrapThunderbird thunderbird-bin-91-unwrapped {
applicationName = "thunderbird";
pname = "thunderbird-bin";
desktopName = "Thunderbird";
};
thunderbird-bin-91-unwrapped = callPackage ../applications/networking/mailreaders/thunderbird-bin {
inherit (gnome) adwaita-icon-theme;
};
thunderbolt = callPackage ../os-specific/linux/thunderbolt {};
ticpp = callPackage ../development/libraries/ticpp { };