From 711d674e1322a8ccdbf985322468da87a141bc9c Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 13 Jul 2021 19:04:57 +0200 Subject: [PATCH 1/3] firefox: rename some attributes in packaging This should not change the derivation, but the new attribute names make more sense once we package something that is not Firefox using this expression. --- .../networking/browsers/firefox/common.nix | 44 ++++++------- .../networking/browsers/firefox/packages.nix | 15 ++--- .../networking/browsers/firefox/wrapper.nix | 64 +++++++++---------- pkgs/top-level/all-packages.nix | 6 +- 4 files changed, 63 insertions(+), 66 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 514447931f38..10d9d55e9ece 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -1,4 +1,5 @@ -{ pname, ffversion, meta, updateScript ? null +{ pname, version, meta, updateScript ? null +, binaryName ? "firefox", application ? "browser" , src, unpackPhase ? null, patches ? [] , extraNativeBuildInputs ? [], extraConfigureFlags ? [], extraMakeFlags ? [], tests ? [] }: @@ -81,17 +82,16 @@ let default-toolkit = if stdenv.isDarwin then "cairo-cocoa" else "cairo-gtk3${lib.optionalString waylandSupport "-wayland"}"; - binaryName = "firefox"; binaryNameCapitalized = lib.toUpper (lib.substring 0 1 binaryName) + lib.substring 1 (-1) binaryName; - browserName = if stdenv.isDarwin then binaryNameCapitalized else binaryName; + applicationName = if stdenv.isDarwin then binaryNameCapitalized else binaryName; execdir = if stdenv.isDarwin then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS" else "/bin"; # 78 ESR won't build with rustc 1.47 - inherit (if lib.versionAtLeast ffversion "82" then rustPackages else rustPackages_1_45) + inherit (if lib.versionAtLeast version "82" then rustPackages else rustPackages_1_45) rustc cargo; # Darwin's stdenv provides the default llvmPackages version, match that since @@ -118,7 +118,7 @@ let # Disable p11-kit support in nss until our cacert packages has caught up exposing CKA_NSS_MOZILLA_CA_POLICY # https://github.com/NixOS/nixpkgs/issues/126065 - nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss.override { useP11kit = false; }; + nss_pkg = if lib.versionOlder version "83" then nss_3_53 else nss.override { useP11kit = false; }; # --enable-release adds -ffunction-sections & LTO that require a big amount of # RAM and the 32-bit memory space cannot handle that linking @@ -129,26 +129,26 @@ let in buildStdenv.mkDerivation ({ - name = "${pname}-unwrapped-${ffversion}"; - version = ffversion; + name = "${pname}-unwrapped-${version}"; + inherit version; inherit src unpackPhase meta; patches = [ ] ++ - lib.optional (lib.versionOlder ffversion "86") ./env_var_for_system_dir-ff85.patch ++ - lib.optional (lib.versionAtLeast ffversion "86") ./env_var_for_system_dir-ff86.patch ++ - lib.optional (lib.versionOlder ffversion "83") ./no-buildconfig-ffx76.patch ++ - lib.optional (lib.versionAtLeast ffversion "90") ./no-buildconfig-ffx90.patch ++ - lib.optional (ltoSupport && lib.versionOlder ffversion "84") ./lto-dependentlibs-generation-ffx83.patch ++ - lib.optional (ltoSupport && lib.versionAtLeast ffversion "84" && lib.versionOlder ffversion "86") + lib.optional (lib.versionOlder version "86") ./env_var_for_system_dir-ff85.patch ++ + lib.optional (lib.versionAtLeast version "86") ./env_var_for_system_dir-ff86.patch ++ + lib.optional (lib.versionOlder version "83") ./no-buildconfig-ffx76.patch ++ + lib.optional (lib.versionAtLeast version "90") ./no-buildconfig-ffx90.patch ++ + lib.optional (ltoSupport && lib.versionOlder version "84") ./lto-dependentlibs-generation-ffx83.patch ++ + lib.optional (ltoSupport && lib.versionAtLeast version "84" && lib.versionOlder version "86") (fetchpatch { url = "https://hg.mozilla.org/mozilla-central/raw-rev/fdff20c37be3"; sha256 = "135n9brliqy42lj3nqgb9d9if7x6x9nvvn0z4anbyf89bikixw48"; }) # This patch adds pipewire support for the ESR release - ++ lib.optional (pipewireSupport && lib.versionOlder ffversion "83") + ++ lib.optional (pipewireSupport && lib.versionOlder version "83") (fetchpatch { # https://src.fedoraproject.org/rpms/firefox/blob/master/f/firefox-pipewire-0-3.patch url = "https://src.fedoraproject.org/rpms/firefox/raw/e99b683a352cf5b2c9ff198756859bae408b5d9d/f/firefox-pipewire-0-3.patch"; @@ -185,11 +185,11 @@ buildStdenv.mkDerivation ({ ++ lib.optional gssSupport libkrb5 ++ lib.optionals waylandSupport [ libxkbcommon libdrm ] ++ lib.optional pipewireSupport pipewire - ++ lib.optional (lib.versionAtLeast ffversion "82") gnum4 + ++ lib.optional (lib.versionAtLeast version "82") gnum4 ++ lib.optionals buildStdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos AVFoundation MediaToolbox CoreLocation Foundation libobjc AddressBook cups ] - ++ lib.optional (lib.versionOlder ffversion "90") gtk2; + ++ lib.optional (lib.versionOlder version "90") gtk2; NIX_LDFLAGS = lib.optionalString ltoSupport '' -rpath ${llvmPackages.libunwind.out}/lib @@ -201,14 +201,14 @@ buildStdenv.mkDerivation ({ rm -rf obj-x86_64-pc-linux-gnu substituteInPlace toolkit/xre/glxtest.cpp \ --replace 'dlopen("libpci.so' 'dlopen("${pciutils}/lib/libpci.so' - '' + lib.optionalString (pipewireSupport && lib.versionOlder ffversion "83") '' + '' + lib.optionalString (pipewireSupport && lib.versionOlder version "83") '' # substitute the /usr/include/ lines for the libraries that pipewire provides. # The patch we pick from fedora only contains the generated moz.build files # which hardcode the dependency paths instead of running pkg_config. substituteInPlace \ media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build \ --replace /usr/include ${pipewire.dev}/include - '' + lib.optionalString (lib.versionAtLeast ffversion "80" && lib.versionOlder ffversion "81") '' + '' + lib.optionalString (lib.versionAtLeast version "80" && lib.versionOlder version "81") '' substituteInPlace dom/system/IOUtils.h \ --replace '#include "nspr/prio.h"' '#include "prio.h"' @@ -276,7 +276,7 @@ buildStdenv.mkDerivation ({ ''; configureFlags = [ - "--enable-application=browser" + "--enable-application=${application}" "--with-system-jpeg" "--with-system-zlib" "--with-system-libevent" @@ -357,19 +357,19 @@ buildStdenv.mkDerivation ({ doInstallCheck = true; installCheckPhase = '' # Some basic testing - "$out${execdir}/${browserName}" --version + "$out${execdir}/${applicationName}" --version ''; passthru = { inherit updateScript; - version = ffversion; + inherit version; inherit alsaSupport; inherit pipewireSupport; inherit nspr; inherit ffmpegSupport; inherit gssSupport; inherit execdir; - inherit browserName; + inherit applicationName; inherit tests; inherit gtk3; }; diff --git a/pkgs/applications/networking/browsers/firefox/packages.nix b/pkgs/applications/networking/browsers/firefox/packages.nix index 33186ccba471..5d033fbf9351 100644 --- a/pkgs/applications/networking/browsers/firefox/packages.nix +++ b/pkgs/applications/networking/browsers/firefox/packages.nix @@ -7,9 +7,9 @@ in rec { firefox = common rec { pname = "firefox"; - ffversion = "91.0"; + version = "91.0"; src = fetchurl { - url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz"; + url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; sha512 = "a02486a3996570e0cc815e92c98890bca1d27ce0018c2ee3d4bff9a6e54dbc8f5926fea8b5864f208e15389d631685b2add1e4e9e51146e40224d16d5c02f730"; }; @@ -27,15 +27,14 @@ rec { tests = [ nixosTests.firefox ]; updateScript = callPackage ./update.nix { attrPath = "firefox-unwrapped"; - versionKey = "ffversion"; }; }; firefox-esr-91 = common rec { pname = "firefox-esr"; - ffversion = "91.0esr"; + version = "91.0esr"; src = fetchurl { - url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz"; + url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; sha512 = "e518e1536094a1da44eb45b3b0f3adc1b5532f17da2dbcc994715419ec4fcec40574fdf633349a8e5de6382942f5706757a35f1b96b11de4754855b9cf7946ae"; }; @@ -53,15 +52,14 @@ rec { updateScript = callPackage ./update.nix { attrPath = "firefox-esr-91-unwrapped"; versionSuffix = "esr"; - versionKey = "ffversion"; }; }; firefox-esr-78 = common rec { pname = "firefox-esr"; - ffversion = "78.12.0esr"; + version = "78.12.0esr"; src = fetchurl { - url = "mirror://mozilla/firefox/releases/${ffversion}/source/firefox-${ffversion}.source.tar.xz"; + url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; sha512 = "646eb803e0d0e541773e3111708c7eaa85e784e4bae6e4a77dcecdc617ee29e2e349c9ef16ae7e663311734dd7491aebd904359124dda62672dbc18bfb608f0a"; }; @@ -79,7 +77,6 @@ rec { updateScript = callPackage ./update.nix { attrPath = "firefox-esr-78-unwrapped"; versionSuffix = "esr"; - versionKey = "ffversion"; }; }; } diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index c868369b603b..0ef5233ff6b8 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -20,18 +20,18 @@ browser: let wrapper = - { browserName ? browser.browserName or (lib.getName browser) - , pname ? browserName + { applicationName ? browser.applicationName or (lib.getName browser) + , pname ? applicationName , version ? lib.getVersion browser - , desktopName ? # browserName with first letter capitalized - (lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName) + , desktopName ? # applicationName with first letter capitalized + (lib.toUpper (lib.substring 0 1 applicationName) + lib.substring 1 (-1) applicationName) , nameSuffix ? "" - , icon ? browserName + , icon ? applicationName , extraNativeMessagingHosts ? [] , pkcs11Modules ? [] , forceWayland ? false , useGlvnd ? true - , cfg ? config.${browserName} or {} + , cfg ? config.${applicationName} or {} ## Following options are needed for extra prefs & policies # For more information about anti tracking (german website) @@ -40,7 +40,7 @@ let # For more information about policies visit # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled , extraPolicies ? {} - , firefoxLibName ? "firefox" # Important for tor package or the like + , libName ? "firefox" # Important for tor package or the like , nixExtensions ? null }: @@ -162,15 +162,15 @@ let "jre" ]; pluginsError = - "Your configuration mentions ${lib.concatMapStringsSep ", " (p: browserName + "." + p) configPlugins}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins)."; + "Your configuration mentions ${lib.concatMapStringsSep ", " (p: applicationName + "." + p) configPlugins}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins)."; in if configPlugins != [] then throw pluginsError else (stdenv.mkDerivation { inherit pname version; desktopItem = makeDesktopItem { - name = browserName; - exec = "${browserName}${nameSuffix} %U"; + name = applicationName; + exec = "${applicationName}${nameSuffix} %U"; inherit icon; comment = ""; desktopName = "${desktopName}${nameSuffix}${lib.optionalString forceWayland " (Wayland)"}"; @@ -193,12 +193,12 @@ let buildCommand = lib.optionalString stdenv.isDarwin '' mkdir -p $out/Applications - cp -R --no-preserve=mode,ownership ${browser}/Applications/${browserName}.app $out/Applications - rm -f $out${browser.execdir or "/bin"}/${browserName} + cp -R --no-preserve=mode,ownership ${browser}/Applications/${applicationName}.app $out/Applications + rm -f $out${browser.execdir or "/bin"}/${applicationName} '' + '' - if [ ! -x "${browser}${browser.execdir or "/bin"}/${browserName}" ] + if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'" + echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" exit 1 fi @@ -213,9 +213,9 @@ let cd "${browser}" find . -type d -exec mkdir -p "$out"/{} \; - find . -type f \( -not -name "${browserName}" \) -exec ln -sT "${browser}"/{} "$out"/{} \; + find . -type f \( -not -name "${applicationName}" \) -exec ln -sT "${browser}"/{} "$out"/{} \; - find . -type f -name "${browserName}" -print0 | while read -d $'\0' f; do + find . -type f -name "${applicationName}" -print0 | while read -d $'\0' f; do cp -P --no-preserve=mode,ownership "${browser}/$f" "$out/$f" chmod a+rwx "$out/$f" done @@ -236,11 +236,11 @@ let # create the wrapper executablePrefix="$out${browser.execdir or "/bin"}" - executablePath="$executablePrefix/${browserName}" + executablePath="$executablePrefix/${applicationName}" if [ ! -x "$executablePath" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'" + echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" exit 1 fi @@ -249,25 +249,25 @@ let # Careful here, the file at executablePath may already be # a wrapper. That is why we postfix it with -old instead # of -wrapped. - oldExe="$executablePrefix"/".${browserName}"-old + oldExe="$executablePrefix"/".${applicationName}"-old mv "$executablePath" "$oldExe" else oldExe="$(readlink -v --canonicalize-existing "$executablePath")" fi - if [ ! -x "${browser}${browser.execdir or "/bin"}/${browserName}" ] + if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ] then - echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'" + echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'" exit 1 fi makeWrapper "$oldExe" \ - "$out${browser.execdir or "/bin"}/${browserName}${nameSuffix}" \ + "$out${browser.execdir or "/bin"}/${applicationName}${nameSuffix}" \ --prefix LD_LIBRARY_PATH ':' "$libs" \ --suffix-each GTK_PATH ':' "$gtk_modules" \ --prefix PATH ':' "${xdg-utils}/bin" \ --suffix PATH ':' "$out${browser.execdir or "/bin"}" \ - --set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \ + --set MOZ_APP_LAUNCHER "${applicationName}${nameSuffix}" \ --set MOZ_SYSTEM_DIR "$out/lib/mozilla" \ --set MOZ_LEGACY_PROFILES 1 \ --set MOZ_ALLOW_DOWNGRADE 1 \ @@ -290,7 +290,7 @@ let mkdir -p "$out/share/icons/hicolor/''${res}x''${res}/apps" icon=( "${browser}/lib/"*"/browser/chrome/icons/default/default''${res}.png" ) if [ -e "$icon" ]; then ln -s "$icon" \ - "$out/share/icons/hicolor/''${res}x''${res}/apps/${browserName}.png" + "$out/share/icons/hicolor/''${res}x''${res}/apps/${applicationName}.png" fi done fi @@ -314,24 +314,24 @@ let # # ######################### # user customization - mkdir -p $out/lib/${firefoxLibName} + mkdir -p $out/lib/${libName} # creating policies.json - mkdir -p "$out/lib/${firefoxLibName}/distribution" + mkdir -p "$out/lib/${libName}/distribution" - POL_PATH="$out/lib/${firefoxLibName}/distribution/policies.json" + POL_PATH="$out/lib/${libName}/distribution/policies.json" rm -f "$POL_PATH" cat ${policiesJson} >> "$POL_PATH" # preparing for autoconfig - mkdir -p "$out/lib/${firefoxLibName}/defaults/pref" + mkdir -p "$out/lib/${libName}/defaults/pref" - echo 'pref("general.config.filename", "mozilla.cfg");' > "$out/lib/${firefoxLibName}/defaults/pref/autoconfig.js" - echo 'pref("general.config.obscure_value", 0);' >> "$out/lib/${firefoxLibName}/defaults/pref/autoconfig.js" + echo 'pref("general.config.filename", "mozilla.cfg");' > "$out/lib/${libName}/defaults/pref/autoconfig.js" + echo 'pref("general.config.obscure_value", 0);' >> "$out/lib/${libName}/defaults/pref/autoconfig.js" - cat > "$out/lib/${firefoxLibName}/mozilla.cfg" < ${mozillaCfg} + cat > "$out/lib/${libName}/mozilla.cfg" < ${mozillaCfg} - mkdir -p $out/lib/${firefoxLibName}/distribution/extensions + mkdir -p $out/lib/${libName}/distribution/extensions ############################# # # diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cff389cf951b..9d18dbbabb19 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24486,7 +24486,7 @@ with pkgs; }; firefox-bin = wrapFirefox firefox-bin-unwrapped { - browserName = "firefox"; + applicationName = "firefox"; pname = "firefox-bin"; desktopName = "Firefox"; }; @@ -24497,7 +24497,7 @@ with pkgs; }; firefox-beta-bin = res.wrapFirefox firefox-beta-bin-unwrapped { - browserName = "firefox"; + applicationName = "firefox"; pname = "firefox-beta-bin"; desktopName = "Firefox Beta"; }; @@ -24508,7 +24508,7 @@ with pkgs; }; firefox-devedition-bin = res.wrapFirefox firefox-devedition-bin-unwrapped { - browserName = "firefox"; + applicationName = "firefox"; nameSuffix = "-devedition"; pname = "firefox-devedition-bin"; desktopName = "Firefox DevEdition"; From 8b1c14045d51873023a101aa1376f5e238114c4a Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 13 Jul 2021 19:13:53 +0200 Subject: [PATCH 2/3] thunderbird: use firefox expression --- .../mailreaders/thunderbird/default.nix | 357 ------------------ .../thunderbird/no-buildconfig-78.patch | 13 + .../thunderbird/no-buildconfig.patch | 37 -- .../mailreaders/thunderbird/packages.nix | 38 ++ .../mailreaders/thunderbird/wrapper.nix | 23 ++ pkgs/top-level/all-packages.nix | 25 +- pkgs/top-level/release.nix | 2 +- 7 files changed, 90 insertions(+), 405 deletions(-) delete mode 100644 pkgs/applications/networking/mailreaders/thunderbird/default.nix create mode 100644 pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-78.patch delete mode 100644 pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig.patch create mode 100644 pkgs/applications/networking/mailreaders/thunderbird/packages.nix create mode 100644 pkgs/applications/networking/mailreaders/thunderbird/wrapper.nix diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix deleted file mode 100644 index a5a8ab861edd..000000000000 --- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix +++ /dev/null @@ -1,357 +0,0 @@ -{ autoconf213 -, bzip2 -, cargo -, common-updater-scripts -, copyDesktopItems -, coreutils -, curl -, dbus -, dbus-glib -, fetchpatch -, fetchurl -, file -, fontconfig -, freetype -, glib -, gnugrep -, gnupg -, gnused -, gpgme -, icu -, jemalloc -, lib -, libevent -, libGL -, libGLU -, libjpeg -, libnotify -, libpng -, libstartup_notification -, libvpx -, libwebp -, llvmPackages -, m4 -, makeDesktopItem -, nasm -, nodejs -, nspr -, nss_3_53 -, pango -, perl -, pkg-config -, python2 -, python3 -, runtimeShell -, rust-cbindgen -, rustc -, sqlite -, stdenv -, systemd -, unzip -, which -, writeScript -, xdg-utils -, xidel -, xorg -, yasm -, zip -, zlib - -, debugBuild ? false - -, alsaSupport ? stdenv.isLinux, alsa-lib -, pulseaudioSupport ? stdenv.isLinux, libpulseaudio -, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook -, waylandSupport ? true, libdrm -, libxkbcommon, calendarSupport ? true - -# Use official trademarked branding. Permission obtained at: -# https://github.com/NixOS/nixpkgs/pull/94880#issuecomment-675907971 -, enableOfficialBranding ? true -}: - -assert waylandSupport -> gtk3Support == true; - -stdenv.mkDerivation rec { - pname = "thunderbird"; - version = "78.13.0"; - - src = fetchurl { - url = - "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz"; - sha512 = - "daee9ea9e57bdfce231a35029807f279a06f8790d71efc8998c78eb42d99a93cf98623170947df99202da038f949ba9111a7ff7adbd43c161794deb6791370a0"; - }; - - nativeBuildInputs = [ - autoconf213 - cargo - copyDesktopItems - gnused - llvmPackages.llvm - m4 - nasm - nodejs - perl - pkg-config - python2 - python3 - rust-cbindgen - rustc - which - yasm - unzip - ] ++ lib.optional gtk3Support wrapGAppsHook; - - buildInputs = [ - bzip2 - dbus - dbus-glib - file - fontconfig - freetype - glib - gtk2 - icu - jemalloc - libGL - libGLU - libevent - libjpeg - libnotify - libpng - libstartup_notification - libvpx - libwebp - nspr - nss_3_53 - pango - perl - sqlite - xorg.libX11 - xorg.libXScrnSaver - xorg.libXcursor - xorg.libXext - xorg.libXft - xorg.libXi - xorg.libXrender - xorg.libXt - xorg.pixman - xorg.xorgproto - xorg.libXdamage - zip - zlib - ] ++ lib.optional alsaSupport alsa-lib - ++ lib.optional gtk3Support gtk3 - ++ lib.optional pulseaudioSupport libpulseaudio - ++ lib.optionals waylandSupport [ libxkbcommon libdrm ]; - - NIX_CFLAGS_COMPILE =[ - "-I${glib.dev}/include/gio-unix-2.0" - "-I${nss_3_53.dev}/include/nss" - ]; - - patches = [ - ./no-buildconfig.patch - ]; - - postPatch = '' - rm -rf obj-x86_64-pc-linux-gnu - ''; - - hardeningDisable = [ "format" ]; - - preConfigure = '' - # remove distributed configuration files - rm -f configure - rm -f js/src/configure - rm -f .mozconfig* - - configureScript="$(realpath ./mach) configure" - # AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286 - unset AS - - export MOZCONFIG=$(pwd)/mozconfig - - # Set C flags for Rust's bindgen program. Unlike ordinary C - # compilation, bindgen does not invoke $CC directly. Instead it - # uses LLVM's libclang. To make sure all necessary flags are - # included we need to look in a few places. - # TODO: generalize this process for other use-cases. - - BINDGEN_CFLAGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \ - $(< ${stdenv.cc}/nix-support/libc-cflags) \ - $(< ${stdenv.cc}/nix-support/cc-cflags) \ - $(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \ - ${ - lib.optionalString stdenv.cc.isClang - "-idirafter ${stdenv.cc.cc}/lib/clang/${ - lib.getVersion stdenv.cc.cc - }/include" - } \ - ${ - lib.optionalString stdenv.cc.isGNU - "-isystem ${stdenv.cc.cc}/include/c++/${ - lib.getVersion stdenv.cc.cc - } -isystem ${stdenv.cc.cc}/include/c++/${ - lib.getVersion stdenv.cc.cc - }/${stdenv.hostPlatform.config}" - } \ - $NIX_CFLAGS_COMPILE" - - echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG - ''; - - configureFlags = let - toolkitSlug = if gtk3Support then - "3${lib.optionalString waylandSupport "-wayland"}" - else - "2"; - toolkitValue = "cairo-gtk${toolkitSlug}"; - in [ - "--enable-application=comm/mail" - - "--with-system-icu" - "--with-system-jpeg" - "--with-system-libevent" - "--with-system-nspr" - "--with-system-nss" - "--with-system-png" # needs APNG support - "--with-system-zlib" - "--with-system-webp" - "--with-system-libvpx" - - "--enable-rust-simd" - "--enable-crashreporter" - "--enable-default-toolkit=${toolkitValue}" - "--enable-js-shell" - "--enable-necko-wifi" - "--enable-system-ffi" - "--enable-system-pixman" - - "--disable-tests" - "--disable-updater" - "--enable-jemalloc" - ] ++ (if debugBuild then [ - "--enable-debug" - "--enable-profiling" - ] else [ - "--disable-debug" - "--enable-release" - "--disable-debug-symbols" - "--enable-optimize" - "--enable-strip" - ]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [ - # on i686-linux: --with-libclang-path is not available in this configuration - "--with-libclang-path=${llvmPackages.libclang.lib}/lib" - "--with-clang-path=${llvmPackages.clang}/bin/clang" - ] ++ lib.optional alsaSupport "--enable-alsa" - ++ lib.optional calendarSupport "--enable-calendar" - ++ lib.optional enableOfficialBranding "--enable-official-branding" - ++ lib.optional pulseaudioSupport "--enable-pulseaudio"; - - enableParallelBuilding = true; - - postConfigure = '' - cd obj-* - ''; - - makeFlags = lib.optionals enableOfficialBranding [ - "MOZILLA_OFFICIAL=1" - "BUILD_OFFICIAL=1" - ]; - - doCheck = false; - - desktopItems = [ - (makeDesktopItem { - categories = lib.concatStringsSep ";" [ "Application" "Network" ]; - desktopName = "Thunderbird"; - genericName = "Mail Reader"; - name = "thunderbird"; - exec = "thunderbird %U"; - icon = "thunderbird"; - mimeType = lib.concatStringsSep ";" [ - # Email - "x-scheme-handler/mailto" - "message/rfc822" - # Feeds - "x-scheme-handler/feed" - "application/rss+xml" - "application/x-extension-rss" - # Newsgroups - "x-scheme-handler/news" - "x-scheme-handler/snews" - "x-scheme-handler/nntp" - ]; - }) - ]; - - postInstall = '' - # TODO: Move to a dev output? - rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl - install -Dm 444 $out/lib/thunderbird/chrome/icons/default/default256.png $out/share/icons/hicolor/256x256/apps/thunderbird.png - ''; - - # Note on GPG support: - # Thunderbird's native GPG support does not yet support smartcards. - # The official upstream recommendation is to configure fall back to gnupg - # using the Thunderbird config `mail.openpgp.allow_external_gnupg` - # and GPG keys set up; instructions with pictures at: - # https://anweshadas.in/how-to-use-yubikey-or-any-gpg-smartcard-in-thunderbird-78/ - # For that to work out of the box, it requires `gnupg` on PATH and - # `gpgme` in `LD_LIBRARY_PATH`; we do this below. - - preFixup = '' - # Needed to find Mozilla runtime - gappsWrapperArgs+=( - --argv0 "$out/bin/thunderbird" - --set MOZ_APP_LAUNCHER thunderbird - # https://github.com/NixOS/nixpkgs/pull/61980 - --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" - ) - ''; - - # FIXME: The XUL portion of this can probably be removed as soon as we - # package a Thunderbird >=71.0 since XUL shouldn't be anymore (in use)? - postFixup = '' - local xul="$out/lib/thunderbird/libxul.so" - patchelf --set-rpath "${libnotify}/lib:${lib.getLib systemd}/lib:$(patchelf --print-rpath $xul)" $xul - ''; - - doInstallCheck = true; - installCheckPhase = '' - "$out/bin/thunderbird" --version - ''; - - disallowedRequisites = [ - stdenv.cc - ]; - - passthru.updateScript = import ./../../browsers/firefox/update.nix { - attrPath = "thunderbird-78"; - baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/"; - inherit writeScript lib common-updater-scripts xidel coreutils gnused - gnugrep gnupg curl runtimeShell; - }; - - requiredSystemFeatures = [ "big-parallel" ]; - - meta = with lib; { - description = "A full-featured e-mail client"; - homepage = "https://www.thunderbird.net"; - maintainers = with maintainers; [ - eelco - lovesegfault - pierron - vcunat - ]; - platforms = platforms.linux; - license = licenses.mpl20; - }; -} diff --git a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-78.patch b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-78.patch new file mode 100644 index 000000000000..98b40d83d62b --- /dev/null +++ b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-78.patch @@ -0,0 +1,13 @@ +Remove about:buildconfig. If used as-is, it would add unnecessary runtime dependencies. +--- a/comm/mail/base/jar.mn ++++ b/comm/mail/base/jar.mn +@@ -119,9 +119,7 @@ + % override chrome://mozapps/content/profile/profileDowngrade.js chrome://messenger/content/profileDowngrade.js + % override chrome://mozapps/content/profile/profileDowngrade.xhtml chrome://messenger/content/profileDowngrade.xhtml + +-* content/messenger/buildconfig.html (content/buildconfig.html) + content/messenger/buildconfig.css (content/buildconfig.css) +-% override chrome://global/content/buildconfig.html chrome://messenger/content/buildconfig.html + % override chrome://global/content/buildconfig.css chrome://messenger/content/buildconfig.css + + # L10n resources and overrides. diff --git a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig.patch b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig.patch deleted file mode 100644 index d413a06475d7..000000000000 --- a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig.patch +++ /dev/null @@ -1,37 +0,0 @@ -Remove about:buildconfig. If used as-is, it would add unnecessary runtime dependencies. -diff -ru -x '*~' a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp ---- a/docshell/base/nsAboutRedirector.cpp -+++ b/docshell/base/nsAboutRedirector.cpp -@@ -63,8 +63,6 @@ - {"about", "chrome://global/content/aboutAbout.html", 0}, - {"addons", "chrome://mozapps/content/extensions/extensions.xhtml", - nsIAboutModule::ALLOW_SCRIPT}, -- {"buildconfig", "chrome://global/content/buildconfig.html", -- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT}, - {"checkerboard", "chrome://global/content/aboutCheckerboard.html", - nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::ALLOW_SCRIPT}, -diff -ru -x '*~' a/toolkit/content/jar.mn b/toolkit/content/jar.mn ---- a/toolkit/content/jar.mn -+++ b/toolkit/content/jar.mn -@@ -35,7 +35,6 @@ - content/global/plugins.js - content/global/browser-child.js - content/global/browser-content.js --* content/global/buildconfig.html - content/global/buildconfig.css - content/global/contentAreaUtils.js - content/global/datepicker.xhtml -diff -ru -x '*~' a/comm/mail/base/jar.mn b/comm/mail/base/jar.mn ---- a/comm/mail/base/jar.mn -+++ b/comm/mail/base/jar.mn -@@ -119,9 +119,7 @@ - % override chrome://mozapps/content/profile/profileDowngrade.js chrome://messenger/content/profileDowngrade.js - % override chrome://mozapps/content/profile/profileDowngrade.xhtml chrome://messenger/content/profileDowngrade.xhtml - --* content/messenger/buildconfig.html (content/buildconfig.html) - content/messenger/buildconfig.css (content/buildconfig.css) --% override chrome://global/content/buildconfig.html chrome://messenger/content/buildconfig.html - % override chrome://global/content/buildconfig.css chrome://messenger/content/buildconfig.css - - # L10n resources and overrides. diff --git a/pkgs/applications/networking/mailreaders/thunderbird/packages.nix b/pkgs/applications/networking/mailreaders/thunderbird/packages.nix new file mode 100644 index 000000000000..c367a9303b59 --- /dev/null +++ b/pkgs/applications/networking/mailreaders/thunderbird/packages.nix @@ -0,0 +1,38 @@ +{ stdenv, lib, callPackage, fetchurl, fetchpatch, nixosTests }: + +let + common = opts: callPackage (import ../../browsers/firefox/common.nix opts) { + webrtcSupport = false; + geolocationSupport = false; + }; +in + +rec { + thunderbird = common rec { + pname = "thunderbird"; + version = "78.13.0"; + application = "comm/mail"; + binaryName = pname; + src = fetchurl { + url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz"; + sha512 = "daee9ea9e57bdfce231a35029807f279a06f8790d71efc8998c78eb42d99a93cf98623170947df99202da038f949ba9111a7ff7adbd43c161794deb6791370a0"; + }; + patches = [ + ./no-buildconfig-78.patch + ]; + + meta = with lib; { + description = "A full-featured e-mail client"; + homepage = "https://thunderbird.net/"; + maintainers = with maintainers; [ eelco lovesegfault pierron vcunat ]; + platforms = platforms.unix; + badPlatforms = platforms.darwin; + broken = stdenv.buildPlatform.is32bit; # since Firefox 60, build on 32-bit platforms fails with "out of memory". + # not in `badPlatforms` because cross-compilation on 64-bit machine might work. + license = licenses.mpl20; + }; + updateScript = callPackage ./update.nix { + attrPath = "thunderbird-78-unwrapped"; + }; + }; +} diff --git a/pkgs/applications/networking/mailreaders/thunderbird/wrapper.nix b/pkgs/applications/networking/mailreaders/thunderbird/wrapper.nix new file mode 100644 index 000000000000..0761232cc519 --- /dev/null +++ b/pkgs/applications/networking/mailreaders/thunderbird/wrapper.nix @@ -0,0 +1,23 @@ +{ lib, wrapFirefox, gpgme, gnupg }: + +browser: +args: + +(wrapFirefox browser ({ + libName = "thunderbird"; +} // args)) + +.overrideAttrs (old: { + # Thunderbird's native GPG support does not yet support smartcards. + # The official upstream recommendation is to configure fall back to gnupg + # using the Thunderbird config `mail.openpgp.allow_external_gnupg` + # and GPG keys set up; instructions with pictures at: + # https://anweshadas.in/how-to-use-yubikey-or-any-gpg-smartcard-in-thunderbird-78/ + # For that to work out of the box, it requires `gnupg` on PATH and + # `gpgme` in `LD_LIBRARY_PATH`; we do this below. + buildCommand = old.buildCommand + '' + wrapProgram $out/bin/thunderbird \ + --prefix LD_LIBRARY_PATH ':' "${lib.makeLibraryPath [ gpgme ]}" \ + --prefix PATH ':' "${lib.makeBinPath [ gnupg ]}" + ''; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9d18dbbabb19..ae4090c808c6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27646,17 +27646,20 @@ with pkgs; thonny = callPackage ../applications/editors/thonny { }; - thunderbird = thunderbird-78; + thunderbirdPackages = recurseIntoAttrs (callPackage ../applications/networking/mailreaders/thunderbird/packages.nix { + callPackage = pkgs.newScope { + inherit (rustPackages) cargo rustc; + libpng = libpng_apng; + gnused = gnused_422; + inherit (darwin.apple_sdk.frameworks) CoreMedia ExceptionHandling + Kerberos AVFoundation MediaToolbox + CoreLocation Foundation AddressBook; + inherit (darwin) libobjc; + }; + }); - thunderbird-78 = callPackage ../applications/networking/mailreaders/thunderbird { - # Using older Rust for workaround: - # https://bugzilla.mozilla.org/show_bug.cgi?id=1663715 - inherit (rustPackages_1_45) cargo rustc; - libpng = libpng_apng; - icu = icu67; - libvpx = libvpx_1_8; - gtk3Support = true; - }; + thunderbird-unwrapped = thunderbirdPackages.thunderbird; + thunderbird = wrapThunderbird thunderbird-unwrapped { }; thunderbolt = callPackage ../os-specific/linux/thunderbolt {}; @@ -28276,6 +28279,8 @@ with pkgs; wrapFirefox = callPackage ../applications/networking/browsers/firefox/wrapper.nix { }; + wrapThunderbird = callPackage ../applications/networking/mailreaders/thunderbird/wrapper.nix { }; + wp-cli = callPackage ../development/tools/wp-cli { }; retroArchCores = diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index dfb3b639b278..571d345d21e5 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -104,7 +104,7 @@ let jobs.nix-info.x86_64-linux jobs.nix-info-tested.x86_64-linux # Ensure that X11/GTK are in order. - jobs.thunderbird.x86_64-linux + jobs.thunderbird-unwrapped.x86_64-linux jobs.cachix.x86_64-linux /* From fb9860709c256a2bc348cb31cd61e64c4f2cfc97 Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 13 Jul 2021 19:15:12 +0200 Subject: [PATCH 3/3] thunderbird: 78.13.0 -> 91.0 --- .../thunderbird/no-buildconfig-90.patch | 13 +++++++++ .../mailreaders/thunderbird/packages.nix | 28 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 ++ 3 files changed, 44 insertions(+) create mode 100644 pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-90.patch diff --git a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-90.patch b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-90.patch new file mode 100644 index 000000000000..c4e29f6355cf --- /dev/null +++ b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-90.patch @@ -0,0 +1,13 @@ +Remove about:buildconfig. If used as-is, it would add unnecessary runtime dependencies. +--- a/comm/mail/base/jar.mn ++++ b/comm/mail/base/jar.mn +@@ -119,9 +119,6 @@ messenger.jar: + % override chrome://mozapps/content/profile/profileDowngrade.js chrome://messenger/content/profileDowngrade.js + % override chrome://mozapps/content/profile/profileDowngrade.xhtml chrome://messenger/content/profileDowngrade.xhtml + +-* content/messenger/buildconfig.html (content/buildconfig.html) +-% override chrome://global/content/buildconfig.html chrome://messenger/content/buildconfig.html +- + # L10n resources and overrides. + % override chrome://mozapps/locale/profile/profileDowngrade.dtd chrome://messenger/locale/profileDowngrade.dtd + % override chrome://global/locale/netError.dtd chrome://messenger/locale/netError.dtd diff --git a/pkgs/applications/networking/mailreaders/thunderbird/packages.nix b/pkgs/applications/networking/mailreaders/thunderbird/packages.nix index c367a9303b59..1f94b3eb977c 100644 --- a/pkgs/applications/networking/mailreaders/thunderbird/packages.nix +++ b/pkgs/applications/networking/mailreaders/thunderbird/packages.nix @@ -9,6 +9,34 @@ in rec { thunderbird = common rec { + pname = "thunderbird"; + version = "91.0"; + application = "comm/mail"; + binaryName = pname; + src = fetchurl { + url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz"; + sha512 = "f3fcaff97b37ef41850895e44fbd2f42b0f1cb982542861bef89ef7ee606c6332296d61f666106be9455078933a2844c46bf243b71cc4364d9ff457d9c808a7a"; + }; + patches = [ + ./no-buildconfig-90.patch + ]; + + meta = with lib; { + description = "A full-featured e-mail client"; + homepage = "https://thunderbird.net/"; + maintainers = with maintainers; [ eelco lovesegfault pierron vcunat ]; + platforms = platforms.unix; + badPlatforms = platforms.darwin; + broken = stdenv.buildPlatform.is32bit; # since Firefox 60, build on 32-bit platforms fails with "out of memory". + # not in `badPlatforms` because cross-compilation on 64-bit machine might work. + license = licenses.mpl20; + }; + updateScript = callPackage ./update.nix { + attrPath = "thunderbird-unwrapped"; + }; + }; + + thunderbird-78 = common rec { pname = "thunderbird"; version = "78.13.0"; application = "comm/mail"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ae4090c808c6..325fc9dd5457 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27659,7 +27659,10 @@ with pkgs; }); thunderbird-unwrapped = thunderbirdPackages.thunderbird; + thunderbird-78-unwrapped = thunderbirdPackages.thunderbird-78; thunderbird = wrapThunderbird thunderbird-unwrapped { }; + thunderbird-78 = wrapThunderbird thunderbird-78-unwrapped { }; + thunderbird-wayland = wrapThunderbird thunderbird-unwrapped { forceWayland = true; }; thunderbolt = callPackage ../os-specific/linux/thunderbolt {};