Archived
1
0
Fork 0

gnu: icedove: Use gexps.

* gnu/packages/gnuzilla.scm (icedove) [arguments]: Use gexps, adjusting phases
as needed.
This commit is contained in:
Maxim Cournoyer 2022-10-10 20:17:04 -04:00
parent f81abf3898
commit 64e8ed1061
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -1250,214 +1250,214 @@ standards of the IceCat project.")
`((cpe-name . "thunderbird_esr"))) `((cpe-name . "thunderbird_esr")))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:tests? #f ; no check target (list
#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' #:tests? #f ;no check target
#:modules ((guix build utils) ;find-files #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
#:modules `((guix build utils) ;find-files
(sxml simple) (sxml simple)
(ice-9 regex) (ice-9 regex)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'prepare-thunderbird-sources (add-after 'unpack 'prepare-thunderbird-sources
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(mkdir "comm") (mkdir "comm")
(copy-recursively (assoc-ref inputs "thunderbird-sources") (copy-recursively (assoc-ref inputs "thunderbird-sources")
"comm") "comm")
(delete-file "sourcestamp.txt"))) (delete-file "sourcestamp.txt")))
(add-after 'patch-source-shebangs 'patch-cargo-checksums (add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda _ (lambda _
(use-modules (guix build cargo-utils)) (use-modules (guix build cargo-utils))
(let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934\
(for-each (lambda (file) ca495991b7852b855"))
(format #t "patching checksums in ~a~%" file) (for-each (lambda (file)
(substitute* file (format #t "patching checksums in ~a~%" file)
(("^checksum = \".*\"") (substitute* file
(string-append "checksum = \"" null-hash "\"")))) (("^checksum = \".*\"")
(find-files "." "Cargo.lock$")) (string-append "checksum = \"" null-hash "\""))))
(for-each generate-all-checksums (find-files "." "Cargo.lock$"))
'("third_party/rust" (for-each generate-all-checksums
"toolkit/library/rust"))))) '("third_party/rust"
(add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag "toolkit/library/rust")))))
(add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
(lambda _ (lambda _
;; Remove --frozen flag from cargo invokation, otherwise it'll ;; Remove --frozen flag from cargo invokation, otherwise it'll
;; complain that it's not able to change Cargo.lock. ;; complain that it's not able to change Cargo.lock.
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373 ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
(substitute* "build/RunCbindgen.py" (substitute* "build/RunCbindgen.py"
(("\"--frozen\",") "")))) (("\"--frozen\",") ""))))
;; Fixes issue where each installation directory generates its own profile. ;; Fixes issue where each installation directory generates its own
;; See e.g. https://trac.torproject.org/projects/tor/ticket/31457 ;; profile (see:
(add-after 'patch-source-shebangs 'fix-profile-setting ;; https://trac.torproject.org/projects/tor/ticket/31457).
(lambda _ (add-after 'patch-source-shebangs 'fix-profile-setting
(substitute* "comm/mail/moz.configure" (lambda _
(("MOZ_DEDICATED_PROFILES, True") (substitute* "comm/mail/moz.configure"
"MOZ_DEDICATED_PROFILES, False")))) (("MOZ_DEDICATED_PROFILES, True")
(add-after 'prepare-thunderbird-sources 'rename-to-icedove "MOZ_DEDICATED_PROFILES, False"))))
(lambda _ (add-after 'prepare-thunderbird-sources 'rename-to-icedove
(substitute* "comm/mail/confvars.sh" (lambda _
(("MOZ_APP_NAME=thunderbird") (substitute* "comm/mail/confvars.sh"
"MOZ_APP_NAME=icedove") (("MOZ_APP_NAME=thunderbird")
(("MOZ_UPDATER=1") "MOZ_APP_NAME=icedove")
"MOZ_UPDATER=0")) (("MOZ_UPDATER=1")
;; Remove branding to comply with Mozilla's trademark policy "MOZ_UPDATER=0"))
(with-directory-excursion "comm/mail/branding/nightly" ;; Remove branding to comply with Mozilla's trademark policy
(delete-file "content/about-wordmark.svg") (with-directory-excursion "comm/mail/branding/nightly"
(call-with-output-file "content/about-wordmark.svg" (delete-file "content/about-wordmark.svg")
(lambda (port) (call-with-output-file "content/about-wordmark.svg"
(sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg") (lambda (port)
(viewBox "0 0 789.1 90.78") (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
(width "333") (viewBox "0 0 789.1 90.78")
(height "48") (width "333")
(fill "#fff")) (height "48")
(text (@ (x "400") (y "70") (fill "#fff"))
(text-anchor "middle") (text (@ (x "400") (y "70")
(font-size "90")) (text-anchor "middle")
"Icedove Daily")) (font-size "90"))
port))) "Icedove Daily"))
(substitute* '("locales/en-US/brand.properties" port)))
"locales/en-US/brand.ftl" (substitute* '("locales/en-US/brand.properties"
"locales/en-US/brand.dtd" "locales/en-US/brand.ftl"
"configure.sh") "locales/en-US/brand.dtd"
(("Thunderbird") "Icedove") "configure.sh")
(("mozilla.org") "guix.gnu.org"))) (("Thunderbird") "Icedove")
;; Remove other mentions of Thunderbird in user-visible text. (("mozilla.org") "guix.gnu.org")))
(with-directory-excursion "comm/mail/base/content" ;; Remove other mentions of Thunderbird in user-visible text.
(substitute* '("overrides/app-license-name.html") (with-directory-excursion "comm/mail/base/content"
(("Thunderbird") "Icedove"))) (substitute* '("overrides/app-license-name.html")
(with-directory-excursion "comm/mail/components/" (("Thunderbird") "Icedove")))
(substitute* '("MailGlue.jsm" (with-directory-excursion "comm/mail/components/"
"extensions/schemas/addressBook.json" (substitute* '("MailGlue.jsm"
"extensions/schemas/tabs.json" "extensions/schemas/addressBook.json"
"extensions/schemas/cloudFile.json" "extensions/schemas/tabs.json"
"extensions/schemas/chrome_settings_overrides.json" "extensions/schemas/cloudFile.json"
"extensions/schemas/windows.json" "extensions/schemas/chrome_settings_overrides.json"
"extensions/parent/ext-mail.js" "extensions/schemas/windows.json"
"im/messages/mail/Info.plist" "extensions/parent/ext-mail.js"
"enterprisepolicies/moz.build" "im/messages/mail/Info.plist"
"enterprisepolicies/helpers/moz.build" "enterprisepolicies/moz.build"
"enterprisepolicies/schemas/moz.build") "enterprisepolicies/helpers/moz.build"
(("Thunderbird") "Icedove"))) "enterprisepolicies/schemas/moz.build")
(substitute* '("comm/mailnews/base/prefs/content/accountUtils.js" (("Thunderbird") "Icedove")))
"comm/mail/base/content/customizeToolbar.js" (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
"comm/suite/components/customizeToolbar.js") "comm/mail/base/content/customizeToolbar.js"
(("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e) "comm/suite/components/customizeToolbar.js")
(format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e))) (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
(format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
;; Override addon URLs and settings ;; Override addon URLs and settings
(substitute* "comm/mail/app/profile/all-thunderbird.js" (substitute* "comm/mail/app/profile/all-thunderbird.js"
(("(pref\\(\"extensions.webservice.discoverURL\").*" _ m) (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
(string-append m ", \"https://directory.fsf.org/wiki/Icedove\");")) (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
(("(pref\\(\"extensions.getAddons.search.url\").*" _ m) (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
(string-append m ", \"https://guix.gnu.org/packages\");")) (string-append m ", \"https://guix.gnu.org/packages\");"))
(("(pref\\(\"extensions.update.enabled\").*" _ m) (("(pref\\(\"extensions.update.enabled\").*" _ m)
(string-append m ", false);")) (string-append m ", false);"))
(("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m) (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
(string-append m ", false);")) (string-append m ", false);"))
(("(pref\\(\"lightweightThemes.update.enabled\").*" _ m) (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
(string-append m ", false);"))))) (string-append m ", false);")))))
(add-after 'build 'neutralize-store-references (add-after 'build 'neutralize-store-references
(lambda _ (lambda _
;; Mangle the store references to compilers & other build tools in ;; Mangle the store references to compilers & other build tools in
;; about:buildconfig, reducing Icedove's closure significant. ;; about:buildconfig, reducing Icedove's closure significant.
;; The resulting files are saved in lib/thunderbird/omni.ja ;; The resulting files are saved in lib/thunderbird/omni.ja
(substitute* (substitute*
;; Use find because the path "obj-x86_64-pc-linux-gnu" contains ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
;; the architecture and the system -> more complicated. ;; the architecture and the system -> more complicated.
(find-files "." "buildconfig.html") (find-files "." "buildconfig.html")
(((format #f "(~a/)([0-9a-df-np-sv-z]{32})" (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
(regexp-quote (%store-directory))) (regexp-quote (%store-directory)))
_ store hash) _ store hash)
(string-append store (string-append store
(string-take hash 8) (string-take hash 8)
"<!-- Guix: not a runtime dependency -->" "<!-- Guix: not a runtime dependency -->"
(string-drop hash 8)))))) (string-drop hash 8))))))
(delete 'bootstrap) (delete 'bootstrap)
(replace 'configure (replace 'configure
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys) (lambda* (#:key inputs configure-flags #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((bash (which "bash"))
(bash (which "bash")) (abs-srcdir (getcwd))
(abs-srcdir (getcwd)) (srcdir (string-append "../" (basename abs-srcdir)))
(srcdir (string-append "../" (basename abs-srcdir))) (flags `(,(string-append "--prefix=" #$output)
(flags `(,(string-append "--prefix=" out) ,@configure-flags))
,@configure-flags)) (mozconfig (string-append (getcwd) "/.mozconfig")))
(mozconfig (string-append (getcwd) "/.mozconfig"))) (setenv "SHELL" bash)
(setenv "SHELL" bash) (setenv "CONFIG_SHELL" bash)
(setenv "CONFIG_SHELL" bash) (setenv "QA_CONFIGURE_OPTIONS" ".*")
(setenv "QA_CONFIGURE_OPTIONS" ".*") (setenv "MOZBUILD_STATE_PATH"
(setenv "MOZBUILD_STATE_PATH" (string-append (getcwd) "/mach_state"))
(string-append (getcwd) "/mach_state")) (setenv "MOZCONFIG"
(setenv "MOZCONFIG" (string-append (getcwd) "/.mozconfig"))
(string-append (getcwd) "/.mozconfig"))
(setenv "AR" "llvm-ar") (setenv "AR" "llvm-ar")
(setenv "NM" "llvm-nm") (setenv "NM" "llvm-nm")
(setenv "CC" "clang") (setenv "CC" "clang")
(setenv "CXX" "clang++") (setenv "CXX" "clang++")
(setenv "MOZ_NOSPAM" "1") (setenv "MOZ_NOSPAM" "1")
(setenv "MACH_USE_SYSTEM_PYTHON" "1") (setenv "MACH_USE_SYSTEM_PYTHON" "1")
(setenv "PYTHON" (setenv "PYTHON"
(search-input-file inputs "/bin/python")) (search-input-file inputs "/bin/python"))
(setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp (setenv "MOZ_BUILD_DATE" #$%icedove-build-id) ; avoid timestamp
(setenv "MOZ_APP_NAME" "icedove") (setenv "MOZ_APP_NAME" "icedove")
(setenv "LDFLAGS" (string-append "-Wl,-rpath=" (setenv "LDFLAGS" (string-append "-Wl,-rpath=" #$output
(assoc-ref outputs "out") "/lib/icedove"))
"/lib/icedove")) (mkdir-p (string-append (getcwd) "/builddir"))
(mkdir-p (string-append (getcwd) "/builddir")) (with-output-to-file mozconfig
(with-output-to-file mozconfig (lambda ()
(lambda () (display
(display (string-append
(string-append "ac_add_options --disable-crashreporter\n"
"ac_add_options --disable-crashreporter\n" "ac_add_options --disable-debug\n"
"ac_add_options --disable-debug\n" "ac_add_options --disable-debug-symbols\n"
"ac_add_options --disable-debug-symbols\n" "ac_add_options --disable-elf-hack\n"
"ac_add_options --disable-elf-hack\n" "ac_add_options --disable-jit\n"
"ac_add_options --disable-jit\n" "ac_add_options --disable-necko-wifi\n"
"ac_add_options --disable-necko-wifi\n" "ac_add_options --disable-official-branding\n"
"ac_add_options --disable-official-branding\n" "ac_add_options --disable-tests\n"
"ac_add_options --disable-tests\n" "ac_add_options --disable-updater\n"
"ac_add_options --disable-updater\n" "ac_add_options --disable-webrtc\n"
"ac_add_options --disable-webrtc\n" "ac_add_options --enable-application=comm/mail\n"
"ac_add_options --enable-application=comm/mail\n" "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
"ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n" "ac_add_options --enable-optimize\n"
"ac_add_options --enable-optimize\n" "ac_add_options --enable-pulseaudio\n"
"ac_add_options --enable-pulseaudio\n" "ac_add_options --enable-release\n"
"ac_add_options --enable-release\n" "ac_add_options --enable-strip\n"
"ac_add_options --enable-strip\n" "ac_add_options --enable-system-ffi\n"
"ac_add_options --enable-system-ffi\n" "ac_add_options --enable-system-pixman\n"
"ac_add_options --enable-system-pixman\n" "ac_add_options --prefix=" #$output "\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-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n" "ac_add_options --with-distribution-id=org.gnu\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-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n" "ac_add_options --with-system-bz2\n"
"ac_add_options --with-system-bz2\n" "ac_add_options --with-system-icu\n"
"ac_add_options --with-system-icu\n" "ac_add_options --with-system-jpeg\n"
"ac_add_options --with-system-jpeg\n" "ac_add_options --with-system-libevent\n"
"ac_add_options --with-system-libevent\n" "ac_add_options --with-system-nspr\n"
"ac_add_options --with-system-nspr\n" ;"ac_add_options --with-system-nss\n"
;"ac_add_options --with-system-nss\n" "ac_add_options --with-system-zlib\n"
"ac_add_options --with-system-zlib\n" "ac_add_options --without-wasm-sandboxed-libraries\n"
"ac_add_options --without-wasm-sandboxed-libraries\n" "mk_add_options MOZ_MAKE_FLAGS=-j"
"mk_add_options MOZ_MAKE_FLAGS=-j" (number->string (parallel-job-count)) "\n"))))
(number->string (parallel-job-count)) "\n")))) (display (getcwd))
(display (getcwd)) (newline)
(newline) (display "mach configure")
(display "mach configure") (invoke "./mach" "configure"))))
(invoke "./mach" "configure")))) (replace 'build
(replace 'build (lambda _ (invoke "./mach" "build")))
(lambda _ (invoke "./mach" "build"))) (replace 'install
(replace 'install (lambda _ (invoke "./mach" "install")))
(lambda _ (invoke "./mach" "install"))) ;; Thunderbird doesn't provide any .desktop file.
;; Thunderbird doesn't provide any .desktop file. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575 (add-after 'install 'install-desktop-file
(add-after 'install 'install-desktop-file (lambda _
(lambda* (#:key outputs #:allow-other-keys) (let ((apps (string-append #$output "/share/applications")))
(let* ((out (assoc-ref outputs "out")) (mkdir-p apps)
(apps (string-append out "/share/applications"))) (with-output-to-file (string-append apps "/icedove.desktop")
(mkdir-p apps) (lambda _
(with-output-to-file (string-append apps "/icedove.desktop") (format #t
(lambda _ "[Desktop Entry]~@
(format #t
"[Desktop Entry]~@
Name=Icedove~@ Name=Icedove~@
Exec=~a/bin/icedove~@ Exec=~a/bin/icedove~@
Icon=icedove~@ Icon=icedove~@
@ -1471,20 +1471,19 @@ standards of the IceCat project.")
[Desktop Action ComposeMessage]~@ [Desktop Action ComposeMessage]~@
Name=Write new message~@ Name=Write new message~@
Exec=~@*~a/bin/icedove -compose~%" Exec=~@*~a/bin/icedove -compose~%"
out)))))) #$output))))))
(add-after 'install 'wrap-program (add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((lib (string-append #$output "/lib"))
(lib (string-append out "/lib")) (gtk #$(this-package-input "gtk+"))
(gtk (assoc-ref inputs "gtk+")) (gtk-share (string-append gtk "/share"))
(gtk-share (string-append gtk "/share")) (pulseaudio #$(this-package-input "pulseaudio"))
(pulseaudio (assoc-ref inputs "pulseaudio")) (pulseaudio-lib (string-append pulseaudio "/lib"))
(pulseaudio-lib (string-append pulseaudio "/lib")) (eudev #$(this-package-input "eudev"))
(eudev (assoc-ref inputs "eudev")) (eudev-lib (string-append eudev "/lib")))
(eudev-lib (string-append eudev "/lib"))) (wrap-program (car (find-files lib "^icedove$"))
(wrap-program (car (find-files lib "^icedove$")) `("XDG_DATA_DIRS" prefix (,gtk-share))
`("XDG_DATA_DIRS" prefix (,gtk-share)) `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))))))))
`("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))))))))
(inputs (inputs
(list alsa-lib (list alsa-lib
bzip2 bzip2