summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-09 22:19:55 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-10 09:21:45 -0500
commit3284873fb034aa705a137303f913e2d29a68217a (patch)
treec1269db7b9df5d192217b6385ce9ee75361889d1
parent3889d3eb857f0ebbf33414087908666b0cef356c (diff)
downloadguix-patches-icedove-l10n-builds.tar
guix-patches-icedove-l10n-builds.tar.gz
gnu: Add icedove-l10n.icedove-l10n-builds
* gnu/packages/gnuzilla.scm (icedove-l10n): New variable. (%icedove-locales): New variable.
-rw-r--r--gnu/packages/gnuzilla.scm109
1 files changed, 108 insertions, 1 deletions
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index d9a3decd8e..34ca392d01 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -17,7 +17,7 @@
;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Baptiste Strazzul <bstrazzull@hotmail.fr>
;;;
;;; This file is part of GNU Guix.
@@ -1498,6 +1498,113 @@ Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
(native-inputs '())
(inputs '())))
+(define %icedove-locales
+ (list "ach" "af" "an" "ar" "ast" "az" "be" "bg" "bn" "br" "bs" "ca" "cak"
+"ca-valencia" "cs" "cy" "da" "de" "dsb" "el" "en-CA" "en-GB" "eo" "es-AR"
+"es-CL" "es-ES" "es-MX" "et" "eu" "fa" "ff" "fi" "fr" "fy-NL" "ga-IE" "gd"
+"gl" "gn" "gu-IN" "he" "hi-IN" "hr" "hsb" "hu" "hy-AM" "ia" "id" "is" "it"
+"ja" "ja-JP-mac" "ka" "kab" "kk" "km" "kn" "ko" "lij" "lt" "lv" "mk" "mr" "ms"
+"my" "nb-NO" "ne-NP" "nl" "nn-NO" "oc" "pa-IN" "pl" "pt-BR" "pt-PT" "rm" "ro"
+"ru" "sco" "si" "sk" "sl" "son" "sq" "sr" "sv-SE" "szl" "ta" "te" "th" "tl"
+"tr" "trs" "uk" "ur" "uz" "vi" "xh" "zh-CN" "zh-TW"))
+
+(define-public icedove-l10n
+ (package
+ (name "icedove-l10n")
+ (version %icedove-version)
+ (source icedove-source)
+ (outputs (cons "out" %icedove-locales))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 format)
+ (ice-9 ftw)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ #:tests? #f ;no tests, this is data
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'install)
+ (replace 'configure
+ (lambda _
+ ;; The following configuration is inspired by guidance at
+ ;; https://firefox-source-docs.mozilla.org/build/buildsystem/locales.html.
+ (call-with-output-file ".mozconfig"
+ (lambda (p)
+ (format p "~{~a~%~}"
+ (list ;; "ac_add_options --enable-project=comm/mail"
+ "ac_add_options --disable-compile-environment"
+ (string-append
+ "ac_add_options --with-l10n-base="
+ (getcwd) "/l10n")
+ ;; Hack, otherwise the build system throws:
+ ;; 'RuntimeError: File "brand.dtd" not found'.
+ "ac_add_options --enable-official-branding"
+ "mk_add_options MOZ_OBJDIR=obj"))))
+ (setenv "CONFIG_SHELL" (which "bash"))
+ (setenv "MOZBUILD_STATE_PATH"
+ (string-append (getcwd) "/mach_state"))
+ (setenv "MOZCONFIG" (string-append (getcwd) "/.mozconfig"))
+ (setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE" "system")
+ (setenv "BUILD_BACKENDS" "FasterMake,RecursiveMake")))
+ (replace 'build ;build and install data files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define locales (with-directory-excursion "l10n"
+ (scandir "." (negate
+ (cut member <> '("." ".."
+ "compare-locales"
+ "en_US"))))))
+ (define missing (lset-difference string=?
+ locales '#$%icedove-locales))
+ (unless (null? missing)
+ (error "missing locales in %icedove-locales" missing))
+
+ (define (find-file dir name)
+ (let ((files (find-files dir name)))
+ (when (null? files)
+ (error "could not find file in dir" name dir))
+ (car files)))
+
+ (for-each
+ (lambda (l)
+ (let* ((out (assoc-ref outputs l))
+ (all-ext (string-append #$output
+ "/lib/thunderbird/extensions"))
+ (ext-dir (string-append out
+ "/lib/thunderbird/extensions")))
+ (format #t "processing locale `~a'...~%" l)
+ (system* "./mach" "build" (string-append "langpack-" l))
+ (mkdir-p ext-dir)
+ (let* ((xpi (find-file "obj" (string-append
+ "\\." l "\\.langpack\\.xpi$")))
+ (name (basename xpi)))
+ (install-file xpi ext-dir)
+ ;; Symlink to the main output so that a user can
+ ;; install all of the language packs at once.
+ (mkdir-p all-ext)
+ (symlink (string-append ext-dir "/" name)
+ (string-append all-ext "/" name)))))
+ locales))))))
+ (native-inputs
+ (list m4
+ perl
+ python-wrapper
+ node
+ unzip))
+ (home-page "https://www.thunderbird.net/")
+ (synopsis "Language localization data for Icedove")
+ (description "This package contains the various language localization data
+files (language pack extensions) for Icedove. The individual localization
+packages can be installed by using the output associated with their name. For
+example, to install just the French language:
+@example
+guix install icedove-l10n:fr
+@end example")
+ (license license:mpl2.0)))
+
(define-public firefox-decrypt
(package
(name "firefox-decrypt")