Subject: Re: [PATCH 1/1] gnu: Add icedove.

From: Nikita Gillmann <[email-masked]>
Date: Wed, 29 Apr 2020 13:12:01 +0200

Hi,

I admit I forgot I did this in 2017 and 2018?

Editorial remarks from the semi-retirement machine wise (I get back when
I can afford more computers again): can you change my name line to

Nikita <[email-masked]>

in this file? I will eventually send one for the files I authored in the
past + the .mailmap

If the mononym doesn't work out for Guix, use my fullname (Nikita
Gillmann), the mononym I use within NetBSD and GNUnet and it's okay.

Thanks, and thanks for apparently finishing this :)

Jonathan Brielmaier transcribed 15K bytes:
> * gnu/packages/icedove.scm: New module.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Register it.
> 
> Co-authored-by: ng0 <[email-masked]>
> Co-authored-by: Adrian Malacoda <[email-masked]>
> ---
>  gnu/local.mk             |   1 +
>  gnu/packages/icedove.scm | 322 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 323 insertions(+)
>  create mode 100644 gnu/packages/icedove.scm
> 
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 4af79f0caf..3c09649111 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -264,6 +264,7 @@ GNU_SYSTEM_MODULES =				\
>    %D%/packages/hyperledger.scm			\
>    %D%/packages/i2p.scm				\
>    %D%/packages/ibus.scm				\
> +  %D%/packages/icedove.scm				\
>    %D%/packages/icu4c.scm			\
>    %D%/packages/idris.scm			\
>    %D%/packages/idutils.scm			\
> diff --git a/gnu/packages/icedove.scm b/gnu/packages/icedove.scm
> new file mode 100644
> index 0000000000..5e699898ac
> --- /dev/null
> +++ b/gnu/packages/icedove.scm
> @@ -0,0 +1,322 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright (C) 2017, 2018 ng0 <[email-masked]>
> +;;; Copyright (C) 2019, 2020 Adrian Malacoda <[email-masked]>
> +;;; Copyright (C) 2020 Jonathan Brielmaier <[email-masked]>
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages icedove)
> +  #:use-module (guix download)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix packages)
> +  #:use-module (guix utils)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (guix build-system cargo)
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages autotools)
> +  #:use-module (gnu packages assembly)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages commencement)
> +  #:use-module (gnu packages compression)
> +  #:use-module (gnu packages crates-io)
> +  #:use-module (gnu packages cups)
> +  #:use-module (gnu packages databases)
> +  #:use-module (gnu packages fontutils)
> +  #:use-module (gnu packages gcc)
> +  #:use-module (gnu packages gl)
> +  #:use-module (gnu packages glib)
> +  #:use-module (gnu packages gnome)
> +  #:use-module (gnu packages gtk)
> +  #:use-module (gnu packages icu4c)
> +  #:use-module (gnu packages image)
> +  #:use-module (gnu packages kerberos)
> +  #:use-module (gnu packages libcanberra)
> +  #:use-module (gnu packages libevent)
> +  #:use-module (gnu packages libffi)
> +  #:use-module (gnu packages libreoffice)  ;for hunspell
> +  #:use-module (gnu packages linux)
> +  #:use-module (gnu packages llvm)
> +  #:use-module (gnu packages node)
> +  #:use-module (gnu packages nss)
> +  #:use-module (gnu packages perl)
> +  #:use-module (gnu packages pkg-config)
> +  #:use-module (gnu packages pulseaudio)
> +  #:use-module (gnu packages python)
> +  #:use-module (gnu packages readline)
> +  #:use-module (gnu packages rust)
> +  #:use-module (gnu packages rust-apps)
> +  #:use-module (gnu packages sqlite)
> +  #:use-module (gnu packages video)
> +  #:use-module (gnu packages xdisorg)
> +  #:use-module (gnu packages xorg))
> +
> +(define %icedove-build-id "20200428000000")
> +
> +(define-public icedove
> +  (package
> +    (name "icedove")
> +    (version "68.7.0")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append "https://archive.mozilla.org/pub/"
> +                           "thunderbird/releases/"
> +                           version "/source/thunderbird-" version
> +                           ".source.tar.xz"))
> +       (sha256
> +        (base32
> +         "112by5xzy9f28fj35yz644vby3c957apj5by2xm8b3qxxqpzsbmw"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f                      ; no check target
> +       ;; XXX: There are RUNPATH issues such as
> +       ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
> +       ;; which is not in its RUNPATH, but they appear to be harmless in
> +       ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
> +       #:validate-runpath? #f
> +
> +       #:imported-modules ,%cargo-utils-modules ;for `generate-checksums'
> +
> +       #:modules ((guix build utils) ;find-files
> +                  (ice-9 regex)
> +                  ,@%gnu-build-system-modules)
> +
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'remove-bundled-libraries
> +           (lambda _
> +             ;; Remove bundled libraries that we don't use.
> +             (for-each (lambda (file)
> +                         (format #t "deleting '~a'...~%" file)
> +                         (delete-file-recursively file))
> +                       '(;; UNBUNDLE-ME! icu
> +                         ;; UNBUNDLE-ME! nss
> +                         "modules/zlib"))
> +             #t))
> +         (add-before 'configure 'augment-CPLUS_INCLUDE_PATH
> +           (lambda* (#:key build inputs #:allow-other-keys)
> +             ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work
> +             ;; around a problem that otherwise occurs when attempting to
> +             ;; build Stylo, which requires Rust and Clang.  Without these
> +             ;; additional entries, errors occur during the build indicating
> +             ;; that the <cstddef> and "c++config.h" headers cannot be found.
> +             ;; Note that the 'build' keyword argument contains the GNU
> +             ;; triplet, e.g. "x86_64-unknown-linux-gnu".
> +             (let ((gcc (assoc-ref inputs "gcc")))
> +               (setenv "CPLUS_INCLUDE_PATH"
> +                       (string-append gcc "/include/c++" ":"
> +                                      gcc "/include/c++/" build)))
> +             #t))
> +
> +         (add-after 'patch-source-shebangs 'patch-cargo-checksums
> +           (lambda _
> +             (use-modules (guix build cargo-utils))
> +             (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
> +               (substitute* '("Cargo.lock" "gfx/wr/Cargo.lock")
> +                 (("(\"checksum .* = )\".*\"" all name)
> +                  (string-append name "\"" null-hash "\"")))
> +               (for-each
> +                (lambda (filename)
> +                  (delete-file filename)
> +                  (let ((dir (dirname filename)))
> +                    (display (string-append
> +                              "patch-cargo-checksums: generate-checksums for "
> +                              dir "\n"))
> +                    (generate-checksums dir)))
> +                (find-files "third_party/rust" ".cargo-checksum.json")))
> +             #t))
> +
> +         ; Fixes issue where each installation directory generates its own profile.
> +         ; See e.g. https://trac.torproject.org/projects/tor/ticket/31457
> +         (add-after 'patch-source-shebangs 'fix-profile-setting
> +           (lambda _
> +             (let ((mozconfigure "comm/mail/moz.configure"))
> +               (substitute* mozconfigure
> +                 (("'MOZ_DEDICATED_PROFILES', True")
> +                  "'MOZ_DEDICATED_PROFILES', False")))))
> +
> +         (add-after 'build 'neutralise-store-references
> +           (lambda _
> +             ;; Mangle the store references to compilers & other build tools in
> +             ;; about:buildconfig, reducing Icedove's closure significant.
> +             ;; The resulting files are saved in lib/thunderbird/omni.ja
> +             (substitute*
> +                 ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
> +                 ;; the architecture and the system -> more complicated.
> +                 (find-files "." "buildconfig.html")
> +               (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
> +                         (regexp-quote (%store-directory)))
> +                 _ store hash)
> +                (string-append store
> +                               (string-take hash 8)
> +                               "<!-- Guix: not a runtime dependency -->"
> +                               (string-drop hash 8))))
> +             #t))
> +         (replace 'configure
> +           (lambda* (#:key outputs configure-flags #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (bash (which "bash"))
> +                    (abs-srcdir (getcwd))
> +                    (srcdir (string-append "../" (basename abs-srcdir)))
> +                    (flags `(,(string-append "--prefix=" out)
> +                             ,@configure-flags))
> +                    (mozconfig (string-append (getcwd) "/.mozconfig")))
> +               (setenv "SHELL" bash)
> +               (setenv "AUTOCONF"
> +                       (string-append (assoc-ref %build-inputs
> +                                                 "autoconf")
> +                                      "/bin/autoconf"))
> +               (setenv "CONFIG_SHELL" bash)
> +               (setenv "QA_CONFIGURE_OPTIONS" ".*")
> +               (setenv "MOZBUILD_STATE_PATH"
> +                       (string-append (getcwd) "/mach_state"))
> +               (setenv "MOZCONFIG"
> +                       (string-append (getcwd) "/.mozconfig"))
> +               (setenv "CC" "gcc")
> +               (setenv "MOZ_NOSPAM" "1")
> +               (setenv "PYTHON"
> +                       (string-append (assoc-ref %build-inputs
> +                                                 "python2")
> +                                      "/bin/python"))
> +               (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
> +               ;; (setenv "builddir" (string-append (getcwd) "/build"))
> +               ;; (mkdir-p (getenv "MOZBUILD_STATE_PATH"))
> +               (mkdir-p (string-append (getcwd) "/builddir"))
> +               (with-output-to-file mozconfig
> +                 (lambda ()
> +                   (display
> +                    (string-append
> +                     "ac_add_options --disable-crashreporter\n"
> +                     "ac_add_options --disable-debug\n"
> +                     "ac_add_options --disable-debug-symbols\n"
> +                     "ac_add_options --disable-elf-hack\n"
> +                     "ac_add_options --disable-gconf\n"
> +                     "ac_add_options --disable-ion\n"
> +                     "ac_add_options --disable-necko-wifi\n"
> +                     "ac_add_options --disable-official-branding\n"
> +                     "ac_add_options --disable-tests\n"
> +                     "ac_add_options --disable-updater\n"
> +                     "ac_add_options --disable-webrtc\n"
> +                     "ac_add_options --enable-alsa\n"
> +                     "ac_add_options --enable-application=comm/mail\n"
> +                     "ac_add_options --enable-calendar\n"
> +                     "ac_add_options --enable-content-sandbox\n"
> +                     "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
> +                     "ac_add_options --enable-optimize\n"
> +                     "ac_add_options --enable-pulseaudio\n"
> +                     "ac_add_options --enable-release\n"
> +                     "ac_add_options --enable-startup-notification\n"
> +                     "ac_add_options --enable-strip\n"
> +                     "ac_add_options --enable-system-ffi\n"
> +                     "ac_add_options --enable-system-pixman\n"
> +                     "ac_add_options --enable-system-sqlite\n"
> +                     "ac_add_options --prefix=" out "\n"
> +                     "ac_add_options --with-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n"
> +                     "ac_add_options --with-distribution-id=org.gnu\n"
> +                     "ac_add_options --with-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n"
> +                     "ac_add_options --with-system-bz2\n"
> +                     "ac_add_options --with-system-icu\n"
> +                     "ac_add_options --with-system-jpeg\n"
> +                     "ac_add_options --with-system-libevent\n"
> +                     "ac_add_options --with-system-nspr\n"
> +                     "ac_add_options --with-system-nss\n"
> +                     "ac_add_options --with-system-zlib\n"
> +                     "ac_add_options --with-user-appdir=\\.thunderbird\n"))))
> +               (display (getcwd))
> +               (newline)
> +               (display "mach configure")
> +               (delete-file-recursively "obj-x86_64-pc-linux-gnu")
> +               (zero? (system* "./mach" "configure")))))
> +
> +         (replace 'build
> +           (lambda _
> +             (zero? (system* "./mach" "build"))))
> +
> +         (replace 'install
> +           (lambda _
> +             (zero? (system* "./mach" "install"))))
> +
> +         (add-after 'install 'wrap-program
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (lib (string-append out "/lib"))
> +                    (gtk (assoc-ref inputs "gtk+"))
> +                    (gtk-share (string-append gtk "/share"))
> +                    (pulseaudio (assoc-ref inputs "pulseaudio"))
> +                    (pulseaudio-lib (string-append pulseaudio "/lib")))
> +               (wrap-program (car (find-files lib "^thunderbird$"))
> +                 `("XDG_DATA_DIRS" prefix (,gtk-share))
> +                 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
> +               #t))))))
> +    (inputs
> +     `(("alsa-lib" ,alsa-lib)
> +       ("bzip2" ,bzip2)
> +       ("cairo" ,cairo)
> +       ("cups" ,cups)
> +       ("dbus-glib" ,dbus-glib)
> +       ("ffmpeg" ,ffmpeg)
> +       ("freetype" ,freetype)
> +       ("gdk-pixbuf" ,gdk-pixbuf)
> +       ("glib" ,glib)
> +       ("gtk+" ,gtk+)
> +       ("gtk+-2" ,gtk+-2)
> +       ("hunspell" ,hunspell)
> +       ("icu4c" ,icu4c)
> +       ("libcanberra" ,libcanberra)
> +       ("libevent" ,libevent)
> +       ("libffi" ,libffi)
> +       ("libgnome" ,libgnome)
> +       ("libjpeg-turbo" ,libjpeg-turbo)
> +       ("libpng-apng" ,libpng-apng)
> +       ("libvpx" ,libvpx)
> +       ("libxcomposite" ,libxcomposite)
> +       ("libxft" ,libxft)
> +       ("libxinerama" ,libxinerama)
> +       ("libxscrnsaver" ,libxscrnsaver)
> +       ("libxt" ,libxt)
> +       ("mesa" ,mesa)
> +       ("mit-krb5" ,mit-krb5)
> +       ("nspr" ,nspr)
> +       ("nss" ,nss)
> +       ("pango" ,pango)
> +       ("pixman" ,pixman)
> +       ("pulseaudio" ,pulseaudio)
> +       ("sqlite" ,sqlite)
> +       ("startup-notification" ,startup-notification)
> +       ("unzip" ,unzip)
> +       ("zip" ,zip)
> +       ("zlib" ,zlib)))
> +    (native-inputs
> +     `(("autoconf" ,autoconf-2.13)
> +       ("cargo" ,rust "cargo")
> +       ("clang" ,clang)
> +       ("llvm" ,llvm)
> +       ("nasm" ,nasm)
> +       ("node" ,node)
> +       ("perl" ,perl)
> +       ("pkg-config" ,pkg-config)
> +       ("python" ,python)
> +       ("python2" ,python-2.7)
> +       ("python2-pysqlite" ,python2-pysqlite)
> +       ("rust" ,rust)
> +       ("rust-cbindgen" ,rust-cbindgen)
> +       ("which" ,which)
> +       ("yasm" ,yasm)))
> +    (home-page "https://www.thunderbird.net")
> +    (synopsis "Trademarkless version of Mozilla Thunderbird")
> +    (description
> +     "Full-featured email client built from Thunderbird source tree.  It
> +supports email, news feeds, chat, calendar and contacts.")
> +    (license license:mpl2.0))) ;and others, see toolkit/content/license.html
> --
> 2.26.1
>