path: root/gnu/build/locale.scm
blob: 412759a320bb8df9cfa980f36b50ff8c2b4398cd (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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 build locale)
  #:use-module (guix build utils)
  #:use-module (srfi srfi-1)
  #:use-module (ice-9 rdelim)
  #:use-module (ice-9 match)
  #:use-module (ice-9 regex)
  #:export (build-locale
            normalize-codeset
            locale->name+codeset
            read-supported-locales))

(define locale-rx
  ;; Regexp matching a locale line in 'localedata/SUPPORTED'.
  (make-regexp
   "^[[:space:]]*([[:graph:]]+)/([[:graph:]]+)[[:space:]]*\\\\$"))

(define (read-supported-locales port)
  "Read the 'localedata/SUPPORTED' file from PORT.  That file is actually a
makefile snippet, with one locale per line, and a header that can be
discarded."
  (let loop ((locales '()))
    (define line
      (read-line port))

    (cond ((eof-object? line)
           (reverse locales))
          ((string-prefix? "#" (string-trim line)) ;comment
           (loop locales))
          ((string-contains line "=")            ;makefile variable assignment
           (loop locales))
          (else
           (match (regexp-exec locale-rx line)
             (#f
              (loop locales))
             (m
              (loop (alist-cons (match:substring m 1)
                                (match:substring m 2)
                                locales))))))))

(define (normalize-codeset codeset)
  "Compute the \"normalized\" variant of CODESET."
  ;; info "(libc) Using gettextized software", for the algorithm used to
  ;; compute the normalized codeset.
  (letrec-syntax ((-> (syntax-rules ()
                        ((_ proc value)
                         (proc value))
                        ((_ proc rest ...)
                         (proc (-> rest ...))))))
    (-> (lambda (str)
          (if (string-every char-set:digit str)
              (string-append "iso" str)
              str))
        string-downcase
        (lambda (str)
          (string-filter char-set:letter+digit str))
        codeset)))

(define* (build-locale locale
                       #:key
                       (localedef "localedef")
                       (directory ".")
                       (codeset "UTF-8")
                       (name (string-append locale "." codeset)))
  "Compute locale data for LOCALE and CODESET--e.g., \"en_US\" and
\"UTF-8\"--with LOCALEDEF, and store it in DIRECTORY under NAME."
  (format #t "building locale '~a'...~%" name)
  (invoke localedef "--no-archive" "--prefix" directory
          "-i" locale "-f" codeset
          (string-append directory "/" name)))

(define (locale->name+codeset locale)
  "Split a locale name such as \"aa_ER@saaho.UTF-8\" into two values: the
language/territory/modifier part, and the codeset."
  (match (string-rindex locale #\.)
    (#f  (values locale #f))
    (dot (values (string-take locale dot)
                 (string-drop locale (+ dot 1))))))
lper.Tobias Geerinckx-Rice * gnu/system/privilege.scm (file-like->setuid-program): New public procedure. * gnu/system/setuid.scm: Re-export it for compatibility. (file-like->setuid-program): Remove this old version. * gnu/services/docker.scm (singularity-setuid-programs): Use it (again). * gnu/services/desktop.scm (enlightenment-privileged-programs): Likewise. Change-Id: I8e41144438677a15cdadb3063651dbc780715497 2024-09-08gnu: libjami: Fix build.Tobias Geerinckx-Rice * gnu/packages/jami.scm (webrtc-audio-processing/jami): New variable. (libjami)[inputs]: Use it. * gnu/packages/patches/webrtc-audio-processing-big-endian.patch: New file. Change-Id: I51a25acd1b8d50e91869aef8ea1fadc862afe215 2024-09-14gnu: Add cl-s-base64.Roman Scherer * gnu/packages/lisp-xyz.scm (sbcl-s-base64, cl-s-base64, ecl-s-base64): New variables. Change-Id: I58e64470d98696ec722350465159a48581c2a1df Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-14gnu: Add cl-print-licenses.Roman Scherer * gnu/packages/lisp-xyz.scm (sbcl-print-licenses, cl-print-licenses, ecl-print-licenses): New variables. Change-Id: I62b6655a560e37218e2f056065cd4523b4c0916f Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-14gnu: smalltalk: Disable tests on x86-64.Guillaume Le Vaillant * gnu/packages/smalltalk.scm (smalltalk)[arguments]: Disable tests on x86-64. Change-Id: I6838e94545df4c11f048b06dfbfd99358bf240a3 2024-09-08gnu: skopeo: Migrate to /run/privileged/bin.Tobias Geerinckx-Rice * gnu/packages/virtualization.scm (skopeo)[arguments]: Update privileged program directory. Change-Id: I8c5243bc99ed414e5bb7bd6b211eae9dc6d15e9f 2024-09-08gnu: durden: Migrate to /run/privileged/bin.Tobias Geerinckx-Rice * gnu/packages/patches/durden-shadow-arcan.patch: Update privileged program directory. Change-Id: Id1d99d8a48582d81ebd0bfc7b152c16bf262a463 2024-09-08gnu: sudo: Update to 1.9.16.Tobias Geerinckx-Rice * gnu/packages/admin.scm (sudo): Update to 1.9.16. Change-Id: I2079b4d83195cc6271320c10eee378c8cbd1ee02 2024-09-14gnu: perl-sub-override: Fix another typo in the description.Florian Pelz * gnu/packages/perl.scm (perl-sub-override): Fix another typo in the description field. Change-Id: Iab36d7d2dc23d146114ab1aa65a845d19724e1eb 2024-09-14gnu: upower-service-type: Fix typo in the description field.Rostislav Svoboda * gnu/services/desktop.scm (upower-service-type): Fix typo in the description field. Change-Id: Ifc6e5a86bd1a031353bd2e93871c314c7937adeb Signed-off-by: Florian Pelz <pelzflorian@pelzflorian.de> 2024-09-14gnu: python-treq: Fix typo in the description field.Rostislav Svoboda * gnu/packages/python-web.scm (python-treq): Fix typo in the description field. Change-Id: I4d5effcd3a9d3e5e1281357505ade16481824275 Signed-off-by: Florian Pelz <pelzflorian@pelzflorian.de> 2024-09-14gnu: perl-sub-override: Fix typo in the description field.Rostislav Svoboda * gnu/packages/perl.scm (perl-sub-override): Fix typo in the description field. Change-Id: I43abd6f035fe641c3f53ff3fe7d352c8d03c2a59 Signed-off-by: Florian Pelz <pelzflorian@pelzflorian.de> 2024-09-13gnu: dhewm3: Update to 1.5.4.James Smith * gnu/packages/game-development.scm: (dhewm3): Update to 1.5.4. [arguments]: Set configure flags for 32-bit builds. Change-Id: I8db801b099910e60e85d0da7ddcc77654205107f Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> 2024-09-13gnu: emacs-wanderlust: Update to 2.15.9-829.8a0ea21.Hilton Chain * gnu/packages/emacs-xyz.scm (emacs-wanderlust): Update to 2.15.9-829.8a0ea21. Change-Id: Ib49d5e681ae26f2071a249fb4735188151422501 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> 2024-09-13gnu: emacs-semi-epg: Update to 1.14.6-250.85a52b8.Hilton Chain * gnu/packages/emacs-xyz.scm (emacs-semi-epg): Update to 1.14.6-250.85a52b8. Change-Id: Id25dd625ac52ab7a9189e602036512712806af55 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> 2024-09-13gnu: emacs-flim-lb: Update to 1.14.9-143.23bb29d.Hilton Chain * gnu/packages/emacs-xyz.scm (emacs-flim-lb): Update to 1.14.9-143.23bb29d. Change-Id: I39e0e89d7e0e75c0aa9447b6194be98b49487b63 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> 2024-09-14gnu: Add syncplay.aurtzy * gnu/packages/video.scm (syncplay): New variable. Change-Id: I72cdfa3db2b4b7ef6c3ef0b8585d138c272046a7 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> 2024-09-14gnu: emacs-org: Mention the emacs-org-texlive-collection in description.Maxim Cournoyer * gnu/packages/emacs-xyz.scm (emacs-org) [description]: Add text suggesting the use of the 'emacs-org-texlive-collection' meta-package. Change-Id: Iaba1940843c4de641303b48fa41aa5d036f1cb18 2024-09-14gnu: Add emacs-org-texlive-collection.Maxim Cournoyer * gnu/packages/emacs-xyz.scm (emacs-org-texlive-collection): New variable. Change-Id: I4039e67f174d0440f351da6d11634f0ceea191cd 2024-09-13gnu: linux-libre 6.1: Update to 6.1.109.Wilko Meyer * gnu/packages/linux.scm (linux-libre-6.1-version): Update to 6.1.109. (linux-libre-6.1-pristine-source): Update hash. Change-Id: I5af25fbb3fd69d791faa1b4212ef1a0c5f62bb42 Signed-off-by: Leo Famulari <leo@famulari.name> 2024-09-13gnu: linux-libre 6.6: Update to 6.6.50.Wilko Meyer * gnu/packages/linux.scm (linux-libre-6.6-version): Update to 6.6.50. (linux-libre-6.6-pristine-source): Update hash. Change-Id: I3be372e13f242c3cc160f8b53f753dab99df3340 Signed-off-by: Leo Famulari <leo@famulari.name> 2024-09-13gnu: linux-libre: Update to 6.10.9.Wilko Meyer * gnu/packages/linux.scm (linux-libre-6.10-version): Update to 6.10.9. (linux-libre-6.10-pristine-source): Update hash. Change-Id: I5c704e3693e3a9edfd269ef50fd42af79ccbd8b8 Signed-off-by: Leo Famulari <leo@famulari.name> 2024-09-13gnu: smalltalk: Fix tests.Greg Hogan * gnu/packages/smalltalk.scm (smalltalk)[native-inputs]: Add '(libc-utf8-locales-for-target)'. Change-Id: Idf49394e5c4dbd3398a6774319184339ed18585c Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-13gnu: gap: Build most packages.Andreas Enge * gnu/packages/algebra.scm (gap)[source]<snippet>: Use a blacklist instead of a whitelist. [inputs]: Add inputs required for packages. [license]: Use gpl3+ for the combined work. [arguments]<#:phases>: Set CC environment variable. This change is possible since now all licenses for GAP packages are properly documented as free. Packages are only excluded if they currently fail to build, as a reminder for further work. Change-Id: If68dfc7ce4b73cdeab0d5a31340840dc1aeb48b6 2024-09-13gnu: gap: Update to 4.13.1.Andreas Enge * gnu/packages/algebra.scm (gap): Update to 4.13.1. [source]: Do not delete file with fixed test. [arguments]<#:configure-flags>: Add LDFLAGS. Change-Id: I813559788dccc15dc57e96733b5defdd47602c69 2024-09-13gnu: cl-clack: Update to 2.1.0-1.4916ebb.Konrad Hinsen * gnu/packages/lisp-xyz.scm (sbcl-clack): Update to 2.1.0-1.4913ebb. [inputs]: Remove sbcl-cl-fastcgi and sbcl-quri. Add sbcl-slime-swank. [arguments]: Remove clack-handler-fastcgi from 'asd-systems'. [license]: Switch to expat. Change-Id: I460a621af2a50ffb6e268180873bd7570e900824 Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-13gnu: cl-lack: Update to 0.3.0-1.35d3a8e.Konrad Hinsen * gnu/packages/patches/sbcl-lack-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/lisp-xyz.scm (sbcl-lack): Update to 0.3.0-1.35d3a8e. [source]: Use patch. [native-inputs]: Add sbcl-cl-cookie, sbcl-dexador and sbcl-hunchentoot. [inputs]: Add sbcl-alexandria, sbcl-anypool, sbcl-bordeaux-threads, sbcl-cl-base64, sbcl-cl-isaac, sbcl-cl-redis, sbcl-dbi and sbcl-trivial-rfc-1123. [arguments]: Add lack-app-directory, lack-app-file, lack-middleware-accesslog, lack-middleware-auth-basic, lack-middleware-csrf, lack-middleware-dbpool, lack-middleware-mount, lack-middleware-session, lack-session-store-dbi and lack-session-store-redis to 'asd-systems'. Enable tests. [license]: Switch to expat. Change-Id: I4285cf208b76d6f461735fff04293833ef163e08 Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-13gnu: Add cl-anypool.Konrad Hinsen * gnu/packages/lisp-xyz.scm (sbcl-anypool, cl-anypool, ecl-anypool): New variables. Change-Id: Ia9cf43dc6f7a529e1a3df96360d06ddc6357a480 Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2024-09-01services: singularity: Migrate to (gnu system privilege).Tobias Geerinckx-Rice * gnu/services/docker.scm (singularity-setuid-programs): Rename from this… (singularity-privileged-programs): …to this. Use <privileged-program>. (singularity-service-type): Extend the PRIVILEGED-PROGRAM-SERVICE-TYPE. Change-Id: I4d90f9a6d4759a24a818baab49b61be67c419bad 2024-09-01services: screen-locker: Migrate to (gnu system privilege).Tobias Geerinckx-Rice * gnu/services/xorg.scm (screen-locker-setuid-programs): Rename from this… (screen-locker-privileged-programs): …to this. Use <privileged-program>. (screen-locker-service-type): Extend the PRIVILEGED-PROGRAM-SERVICE-TYPE. Change-Id: Icbd891def4fc90ed5365702731f009dec358c19e 2024-09-01uuid: Add support for exFAT.Tobias Geerinckx-Rice We expect users to use the generic STRING->FAT-UUID procedure. This is consistent with how we already treat FAT32 vs FAT16. It is not consistent with how we export 8 different aliases for STRING->DCE-UUID, but I'm unconvinced that would be better. * gnu/system/uuid.scm (%uuid-parsers, %uuid-printers): Add the ‘exfat’ file system type. Change-Id: Ia31482716e4395f9f10f794f49fb31c9f330a2e3 2024-09-01file-systems: Add support for exFAT.Tobias Geerinckx-Rice * gnu/build/file-systems.scm (%exfat-endianness): New syntax. (exfat-superblock?, exfat-bytes-per-sector-shift) (exfat-sectors-per-cluster-shift, exfat-root-directory-offset) (exfat-cluster-size, read-exfat-superblock+root-directory-cluster) (read-exfat-superblock, exfat-superblock-volume-name) (exfat-superblock-uuid, check-exfat-file-system): New procedures. (%partition-label-readers, %partition-uuid-readers): Register them. Change-Id: I08bd3147d2d67e5766c9381ae2159bc01530b814 2024-09-01gnu: exfatprogs: Run tests.Tobias Geerinckx-Rice * gnu/packages/file-systems.scm (exfatprogs)[arguments]: Use G-Expressions. Customise 'check phase to run the tests. Change-Id: I645444eb1b70bb71666ce6fe905e0229007f5a54 2024-09-01gnu: exfatprogs: Update to 1.2.5.Tobias Geerinckx-Rice * gnu/packages/file-systems.scm (exfatprogs): Update to 1.2.5. Change-Id: I615bc5b04f63c52573c69efac6c7bdb9713ba89e 2024-09-01gnu: nilfs-utils: Update to 2.2.11.Tobias Geerinckx-Rice * gnu/packages/file-systems.scm (nilfs-utils): Update to 2.2.11. Change-Id: I332ae7293da1a2d58d76324746c6b735d190ed4e 2024-09-01doc: Add more newline.Tobias Geerinckx-Rice * doc/guix.texi (partition Reference): Enumerate one list per paragraph. Change-Id: I939a73fa8a3e5063e2d9441d7a64cc4a41862abd 2024-09-01doc: Committers are people.Tobias Geerinckx-Rice * doc/contributing.texi (Commit Access): Use ‘who’. Change-Id: I88304640f8f184f7ec0caae5bb862c7f170c0d79