all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 32026@debbugs.gnu.org
Cc: mhw@netris.org, ludo@gnu.org,
	Jonathan Brielmaier <jonathan.brielmaier@web.de>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#32026: [PATCH v3 05/11] gnu: Add icecat-l10n and icedove-l10n.
Date: Fri, 17 Feb 2023 07:55:32 -0500	[thread overview]
Message-ID: <20230217125539.24467-5-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20230217125539.24467-1-maxim.cournoyer@gmail.com>

* gnu/packages/gnuzilla.scm (%icecat-locales, %icedove-locales): New variable.
(make-l10n-package): New procedure.
(icecat-l10n, icedove-l10n): New variables.
---

(no changes since v1)

 gnu/packages/gnuzilla.scm | 143 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 142 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 17edb9fa7e..7bc7ad6cec 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.
@@ -1123,6 +1123,16 @@ (define (runpaths-of-input label)
        (cpe-name . "firefox_esr")
        (cpe-version . ,(first (string-split version #\-)))))))
 
+(define %icecat-locales
+  '("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 %icedove-build-id "20230207000000") ;must be of the form YYYYMMDDhhmmss
 (define %icedove-version "102.7.2")
 
@@ -1147,6 +1157,15 @@ (define (comm-source->locales+changeset source)
     (((_ changeset locale) ...)
      (values locale (first changeset)))))
 
+;;; Generated with comm-source->locales+changeset.
+(define %icedove-locales
+  '("af" "ar" "ast" "be" "bg" "br" "ca" "cak" "cs" "cy" "da" "de" "dsb" "el"
+    "en-CA" "en-GB" "es-AR" "es-ES" "es-MX" "et" "eu" "fi" "fr" "fy-NL" "ga-IE"
+    "gd" "gl" "he" "hr" "hsb" "hu" "hy-AM" "id" "is" "it" "ja" "ja-JP-mac" "ka"
+    "kab" "kk" "ko" "lt" "lv" "ms" "nb-NO" "nl" "nn-NO" "pa-IN" "pl" "pt-BR"
+    "pt-PT" "rm" "ro" "ru" "sk" "sl" "sq" "sr" "sv-SE" "th" "tr" "uk" "uz" "vi"
+    "zh-CN" "zh-TW"))
+
 ;;; To find out which changeset to use for the comm-l10n repo, use the
 ;;; 'comm-source->locales+changeset' procedure on the thunderbird-comm-source
 ;;; checkout directory.  The complete localization data should be released as
@@ -1555,6 +1574,128 @@ (define-public icedove/wayland
     (native-inputs '())
     (inputs '())))
 
+(define (make-l10n-package project version source locales)
+  "Return a package for PROJECT, a symbol (either icecat or icedove), with
+their corresponding VERSION, SOURCE and LOCALES variables."
+  (unless (member project '(icecat icedove))
+    (error "only icecat or icedove components are currently supported"))
+
+  (let ((name (if (eq? 'icecat project)
+                  "IceCat"
+                  "Icedove")))
+    (package
+      (name (format #f "~a-l10n" project))
+      (version version)
+      (source source)
+      (outputs (cons "out" 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 (if (eq? 'icecat '#$project)
+                                      "ac_add_options --enable-project=browser"
+                                      "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 (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))
+                          ;; The older lib/$project/distribution/extensions
+                          ;; directory is deprecated.  Use the newer app-global
+                          ;; directory, which is lib/$project/extensions.
+                          (ext-dir-prefix
+                           (format
+                            #f "lib/~a/~:[~;browser/~]extensions"
+                            '#$project (eq? 'icecat '#$project)))
+                          (all-ext (string-append #$output "/" ext-dir-prefix))
+                          (ext-dir (string-append out "/" ext-dir-prefix))
+                          ;; XXX: Because Icedove doesn't have a makeicedove
+                          ;; script that substitutes all the Thunderbird
+                          ;; references to Icedove, the MOZ_LANGPACK_EID
+                          ;; defined in comm/mail/locales/Makefile.in uses
+                          ;; 'thunderbird' in its ID extension rather than
+                          ;; 'icedove'.
+                          (name (format #f "langpack-~a@~a.mozilla.org.xpi"
+                                        l (if (eq? 'icedove '#$project)
+                                              'thunderbird
+                                              '#$project))))
+                     (format #t "processing locale `~a'...~%" l)
+                     (if (eq? 'icecat '#$project)
+                         ;; XXX: For some reasons, for IceCat, there are some
+                         ;; parsing errors that cause the build system to
+                         ;; return an unclean exit code; use system* to ignore
+                         ;; errors.
+                         (system* "./mach" "build" (string-append "langpack-" l))
+                         (invoke "./mach" "build" (string-append "langpack-" l)))
+                     (mkdir-p ext-dir)
+                     (let ((xpi (find-file "obj" (string-append
+                                                  "\\." l "\\.langpack\\.xpi$"))))
+                       (copy-file xpi (string-append ext-dir "/" name))
+                       ;; 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)))))
+                 (if (eq? 'icedove '#$project)
+                     '#$%icedove-locales
+                     '#$%icecat-locales)))))))
+      (native-inputs
+       (list m4
+             perl
+             python-wrapper
+             node
+             unzip))
+      (home-page "https://www.mozilla.org/")
+      (synopsis (string-append "Language localization data for " name))
+      (description (string-append "This package contains the various language
+localization data files (language pack extensions) for " name ".  The
+individual localization packages can be installed by using the output
+associated with their name."))
+      (license license:mpl2.0))))
+
+(define-public icecat-l10n
+  (make-l10n-package 'icecat %icecat-version icecat-source %icecat-locales))
+
+(define-public icedove-l10n
+  (make-l10n-package 'icedove %icedove-version icedove-source %icedove-locales))
+
 (define-public firefox-decrypt
   (package
     (name "firefox-decrypt")
-- 
2.39.1





  parent reply	other threads:[~2023-02-17 12:57 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 20:23 bug#32026: IceCat locales are missing? Ludovic Courtès
2023-02-14  1:55 ` bug#32026: [PATCH 00/10] Add proper locale support to IceCat and Icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-14 21:32     ` Jonathan Brielmaier
2023-02-16  0:55       ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 04/10] gnu: icecat: Update the "ach" locale Maxim Cournoyer
2023-02-15  6:39     ` Mark H Weaver
2023-02-14  1:55   ` bug#32026: [PATCH 05/10] gnu: icecat: Add a patch that makes building language packs reproducible Maxim Cournoyer
2023-02-14  7:58     ` Mark H Weaver
2023-02-14 13:58       ` Maxim Cournoyer
2023-02-14 21:06         ` Mark H Weaver
2023-02-15 21:32           ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 06/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 07/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 08/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 09/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 10/10] gnu: icecat: " Maxim Cournoyer
2023-02-14  9:23     ` Mark H Weaver
2023-02-14 14:00       ` Maxim Cournoyer
2023-02-16  4:36 ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-16 22:26     ` Mark H Weaver
2023-02-17  2:55       ` Maxim Cournoyer
2023-02-18 20:46         ` Mark H Weaver
2023-02-19 17:43           ` Maxim Cournoyer
2023-02-20  1:06           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 04/10] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 05/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-16 22:45     ` Mark H Weaver
2023-02-17  3:37       ` Maxim Cournoyer
2023-02-18 20:22         ` Mark H Weaver
2023-02-18 20:42           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 06/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 07/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 08/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 09/10] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-16 22:50     ` Mark H Weaver
2023-02-16  4:36   ` bug#32026: [PATCH 10/10] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-16 22:14     ` Mark H Weaver
2023-02-17 19:44       ` Maxim Cournoyer
2023-02-18  1:02         ` Mark H Weaver
2023-02-18 14:09           ` Maxim Cournoyer
2023-02-16 22:05   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-17  2:25     ` Maxim Cournoyer
2023-02-17 12:55 ` bug#32026: [PATCH v3 01/11] " Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 02/11] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 03/11] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 04/11] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-18 21:02     ` Mark H Weaver
2023-02-19 17:35       ` Maxim Cournoyer
2023-02-17 12:55   ` Maxim Cournoyer [this message]
2023-02-17 12:55   ` bug#32026: [PATCH v3 06/11] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 07/11] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 08/11] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 09/11] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 10/11] gnu: nss-next: Update to 3.88.1 [fixes CVE-2023-0767] Maxim Cournoyer
2023-02-17 21:38     ` Mark H Weaver
2023-02-18 17:27       ` Maxim Cournoyer
2023-02-18 19:49         ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2023-02-18 20:45           ` Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 11/11] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 19:23 ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-19 19:23   ` bug#32026: [PATCH v4 2/9] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-19 19:23   ` bug#32026: [PATCH v4 3/9] gnu: Define %icecat-base-version at the top level Maxim Cournoyer
2023-02-19 20:13     ` Mark H Weaver
2023-02-19 22:14       ` Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 4/9] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 5/9] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 6/9] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 7/9] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 8/9] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 9/9] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 20:17   ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-19 23:17     ` Maxim Cournoyer
2023-02-20 11:06   ` Ludovic Courtès
2023-02-20 15:35     ` Maxim Cournoyer
2023-02-22  9:19       ` bug#32026: LibreOffice locales Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217125539.24467-5-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=32026@debbugs.gnu.org \
    --cc=jonathan.brielmaier@web.de \
    --cc=ludo@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.