aboutsummaryrefslogtreecommitdiff
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))))))
=c55acb073248392b1387017378f36a1d378fa7c4'>gnu: Add bpftrace.John Soo * gnu/packages/linux.scm (bpftrace): New variable. * gnu/packages/patches/bpftrace-disable-bfd-disasm.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> 2020-07-30gnu: python-slugify: Update to 4.0.1.Tanguy Le Carrour * gnu/packages/patches/python-slugify-depend-on-unidecode.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/python-web.scm (python-slugify): Update to 4.0.1. [source] Drop patch. Signed-off-by: Marius Bakke <marius@gnu.org> 2020-07-30gnu: Add nfs4-acl-tools.Lars-Dominik Braun * gnu/packages/nfs.scm (nfs4-acl-tools): New variable. * gnu/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch: New file. * gnu/local.mk: Add it. Signed-off-by: Marius Bakke <marius@gnu.org> 2020-07-29gnu: sphinxbase: Fix building.Efraim Flashner * gnu/packages/speech.scm (sphinxbase)[source]: Add patch. * gnu/packages/patches/sphinxbase-fix-doxygen.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. 2020-07-29gnu: Add rnp.Justus Winter * gnu/packages/openpgp.scm (rnp): New variable. * gnu/packages/patches/rnp-add-version.cmake.patch: New file. * gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch: New file. * gnu/packages/patches/rnp-unbundle-googletest.patch: New file. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-07-29gnu: libextractor: Update to 1.10.Michael Rohleder * gnu/packages/gnunet.scm (libextractor): Update to 1.10. [arguments]: Add 'fix-exiv2-tests' phase. [inputs]: Add GIFLIB, remove TIDY-HTML. * gnu/packages/patches/libextractor-exiv2.patch: Remove. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-07-27gnu: plotutils: Fix build on non-x86_64 architectures.Maxim Cournoyer * gnu/packages/patches/plotutils-spline-test.patch: Add patch. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/plotutils.scm (plotutils)[patches]: Apply it. 2020-07-27gnu: python-jedi: Update to 0.17.2.Tobias Geerinckx-Rice * gnu/packages/python-xyz.scm (python-jedi): Update to 0.17.2. [source, arguments]: Remove upstreamed patching. * gnu/packages/patches/python-jedi-sort-project-test.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. 2020-07-26gnu: glibc: Remove old versions.Marius Bakke * gnu/packages/patches/glibc-CVE-2015-5180.patch, gnu/packages/patches/glibc-CVE-2015-7547.patch, gnu/packages/patches/glibc-CVE-2016-3075.patch, gnu/packages/patches/glibc-CVE-2016-3706.patch, gnu/packages/patches/glibc-CVE-2016-4429.patch, gnu/packages/patches/glibc-CVE-2017-1000366-pt1.patch, gnu/packages/patches/glibc-CVE-2017-1000366-pt2.patch, gnu/packages/patches/glibc-CVE-2017-1000366-pt3.patch, gnu/packages/patches/glibc-o-largefile.patch, gnu/packages/patches/glibc-vectorized-strcspn-guards.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/base.scm (glibc-2.26, glibc-2.25, glibc-2.24, glibc-2.23, glibc-2.22): Remove variables. 2020-07-24gnu: luminance-hdr: Update to 2.6.0.Marius Bakke * gnu/packages/patches/luminance-hdr-qt-printer.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/image-viewers.scm (luminance-hdr): Update to 2.6.0. [inputs]: Add QTSVG and EIGEN. [arguments]: Add #:tests? #f. 2020-07-24gnu: Add libtmcg.Justus Winter * gnu/packages/openpgp.scm: New file. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-07-23gnu: Fix Krita.Leo Famulari Fixes <https://bugs.gnu.org/42476>. Reported by linka on #guix. * gnu/packages/patches/qtbase-fix-krita-deadlock.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/qt.scm (qtbase-for-krita): New variable. * gnu/packages/kde.scm (krita)[inputs]: Replace qtbase with qtbase-for-krita. 2020-07-23Revert "gnu: Fix Krita."Leo Famulari This reverts commit 5f63905096e456097fca206f56ce9257f72faf64. This commit caused `guix pull` to crash like this: ------ Backtrace: In ice-9/boot-9.scm: 222:29 19 (map1 _) 222:29 18 (map1 _) 222:29 17 (map1 _) 222:29 16 (map1 _) 222:17 15 (map1 (((gnu packages kde)) ((gnu packages libevent)) ((gnu packages libidn)) ((gnu packages #)) ((?)) ?)) 3297:17 14 (resolve-interface (gnu packages kde) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _) In ice-9/threads.scm: 390:8 13 (_ _) In ice-9/boot-9.scm: 3223:13 12 (_) In ice-9/threads.scm: 390:8 11 (_ _) In ice-9/boot-9.scm: 3507:20 10 (_) 2806:4 9 (save-module-excursion _) 3527:26 8 (_) In unknown file: 7 (primitive-load-path "gnu/packages/kde" #<procedure 7f68d6fe5da0 at ice-9/boot-9.scm:3514:37 ()>) In ice-9/eval.scm: 626:19 6 (_ #<directory (gnu packages kde) 7f68d6175b40>) 293:34 5 (_ #<directory (gnu packages kde) 7f68d6175b40>) 173:47 4 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>)) 159:9 3 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>)) 191:35 2 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>)) 223:20 1 (proc #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval?>)) In unknown file: 0 (%resolve-variable (7 . qtbase) #<directory (gnu packages kde) 7f68d6175b40>) ERROR: In procedure %resolve-variable: error: qtbase: unbound variable ------ 2020-07-23gnu: Fix Krita.Leo Famulari Fixes <https://bugs.gnu.org/42476>. Reported by linka on #guix. * gnu/packages/patches/qtbase-fix-krita-deadlock.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/kde.scm (qtbase-for-krita): New variable. (krita)[inputs]: Replace qtbase with qtbase-for-krita. 2020-07-23gnu: Add mercury.Brett Gilio * gnu/local.mk (GNU_SYSTEM_MODULES): Add mercury.scm. * gnu/packages/mercury.scm: New file. 2020-07-23gnu: linux-libre@4.14: Update to 4.14.189.Mark H Weaver * gnu/packages/linux.scm (linux-libre-4.14-version): Update to 4.14.189. (linux-libre-4.14-pristine-source): Update hash. (linux-libre-4.14-source): Remove %linux-libre-fix-atheros-9271-patch. (deblob-scripts-4.14): Update to 4.14.189. (%linux-libre-fix-atheros-9271-patch): Delete variable. * gnu/packages/patches/linux-libre-fix-atheros-9271.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. 2020-07-22services: nix: Fix sandbox.Oleg Pykhalov * gnu/tests/package-management.scm: New file. * gnu/local.mk: Add this. * gnu/services/nix.scm (<nix-configuration>): New record. (nix-activation): Generate Nix config file which fixes sandbox. (nix-service-type): Add default value. (nix-shepherd-service): Allow provide Nix package. * doc/guix.texi (Miscellaneous Services)[Nix service]<nix-configuration>: Document record. 2020-07-22arb: Update to 2.18.1.Andreas Enge * gnu/packages/patches/arb-flint-2.6.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/algebra.scm (arb): Update to 2.18.1. [source](patches): Remove. 2020-07-21gnu: Add intel-xed.B. Wilson * gnu/packages/assembly.scm (intel-xed): New variable. * gnu/packages/patches/intel-xed-fix-nondeterminism.patch: New file. * gnu/local.mk (dist_patch_DATA): Add reference to new patch. Signed-off-by: Marius Bakke <marius@gnu.org> 2020-07-21gnu: libvnc: Update to 0.9.13.Marius Bakke * gnu/packages/patches/libvnc-CVE-2018-20750.patch, gnu/packages/patches/libvnc-CVE-2019-15681.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/vnc.scm (libvnc): Update to 0.9.13. [source](patches): Remove. [arguments]: Add phase to patch 'cc' invocation. 2020-07-21gnu: emacs-telega: Patch to use telega-server from Guix.Brett Gilio * gnu/packages/patches/emacs-telega-patch-server-functions.patch: New file. * gnu/local.mk (dist_patch_DATA): Reference new patch. * gnu/packages/emacs-xyz.scm (emacs-telega)[source]: Use new patch, bump revision. 2020-07-20gnu: python-aionotify: Fix test cases with Python 3.8.Lars-Dominik Braun * gnu/packages/python-xyz.scm (patches): Add fix. * gnu/packages/patches/python-aionotify-0.2.0-py3.8.patch: New file. * gnu/local.mk: Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-07-19gnu: ungoogled-chromium: Update to 84.0.4147.89-0.df199c0.Marius Bakke * gnu/packages/patches/ungoogled-chromium-system-jsoncpp.patch, gnu/packages/patches/ungoogled-chromium-system-zlib.patch: Delete files. * gnu/packages/patches/ungoogled-chromium-system-nspr.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/chromium.scm (%preserved-third-party-files): Adjust for 84. (%ungoogled-revision): Set to df199c04ff367da59ce52a23a3f3b305dd3b00c3. (%debian-revision): Set to debian/83.0.4103.116-3. (%gentoo-revision): Set to f3f649046d31ebdbc8c4a302b2384504eff78027. (chromium-gcc-patchset, %chromium-gcc-patches): New variables. (%gentoo-patches): Remove GCC patches, which have been moved to the above repo. Add ffmpeg compatibility patch. (%debian-patches): Add zlib and jsoncpp patch; remove nspr patch. (%ungoogled-origin): Update hash. (ungoogled-chromium-snippet): Add the new GCC patches. Remove obsolete local patches, add new. (xcb-proto/python2): New variable. (ungoogled-chromium): Update to 84.0.4147.89-0..df199c0. [arguments]: Add "is_unsafe_developer_build", "max_jobs_per_link", "exclude_unwind_tables", "xcbproto_path", "perfetto_use_system_protobuf" to #:configure-flags. Remove "linux_use_bundled_binutils". Adjust vulkan header substitutions. [native-inputs]: Remove YASM. [inputs]: Change from FFMPEG-4.2 to FFMPEG. Add PROTOBUF and XCB-PROTO/PYTHON2. 2020-07-17gnu: ruby-rubocop: Update to 0.88.0.Maxim Cournoyer * gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch: New file. * gnu/local.mk (dist_patch_DATA): Register patch. * gnu/packages/ruby.scm (ruby-rubocop): Update to 0.88.0. [origin]: Use git-fetch. Apply the newly added patch. [arguments]: Set #:test-target to "default". Remove #:tests?, enabling tests. [phases]{remove-problematic-tests, disable-bundler, set-home, make-adoc-files-writable}: New phases. Replace the 'replace-git-ls-files phase. [native-inputs]: Add ruby-bump, ruby-pry, ruby-rspec, ruby-test-queue, ruby-webmock-2 and ruby-yard. [propagated-inputs]: Remove ruby-powerpack and ruby-jaro-winkler. Add ruby-regexp-parser, ruby-rexml and ruby-rubocop-ast. 2020-07-17gnu: Add Rust 1.45.Jakub Kądziołka * gnu/packages/rust.scm (rust-1.45): New variable. * gnu/packages/patches/rust-1.45-linker-locale.patch: New file. * gnu/local.mk (dist_patch_DATA): Add the patch to the list. 2020-07-17gnu: Add maven-enforcer-api.Julien Lepiller * gnu/packages/maven.scm (maven-enforcer-api): New variable. * gnu/packages/patches/maven-enforcer-api-fix-old-dependencies.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. 2020-07-17gnu: Add apache-parent-pom-13.Julien Lepiller * gnu/packages/maven-parent-pom.scm: New file. * gnu/local.mk: Add maven-parent-pom.scm. 2020-07-17gnu: emacs-exwm: Fix fullscreen states.Diego Nicola Barbato * gnu/packages/patches/emacs-exwm-fix-fullscreen-states.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/emacs-xyz.scm (emacs-exwm)[source]: Use it. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> 2020-07-16services: Add ganeti.Marius Bakke * gnu/services/ganeti.scm, gnu/tests/ganeti.scm: New files. * doc/guix.texi (Virtualization Services): Document the Ganeti services. 2020-07-16gnu: Add ganeti.Marius Bakke * gnu/packages/virtualization.scm (system->qemu-target, ganeti): New variables. * gnu/packages/patches/ganeti-deterministic-manual.patch, gnu/packages/patches/ganeti-disable-version-symlinks.patch, gnu/packages/patches/ganeti-drbd-compat.patch, gnu/packages/patches/ganeti-haskell-pythondir.patch, gnu/packages/patches/ganeti-os-disk-size.patch, gnu/packages/patches/ganeti-preserve-PYTHONPATH.patch, gnu/packages/patches/ganeti-shepherd-master-failover.patch, gnu/packages/patches/ganeti-shepherd-support.patch: New files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. 2020-07-16gnu: Add tao.Ricardo Wurmus * gnu/packages/patches/tao-add-missing-headers.patch, gnu/packages/patches/tao-fix-parser-types.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/audio.scm (tao): New variable. 2020-07-15gnu: Transmission: Update to 3.0.0.Leo Famulari * gnu/packages/bittorrent.scm (transmission): Update to 3.0.0. [source]: Remove obsolete patch. * gnu/packages/patches/transmission-CVE-2018-10756.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. 2020-07-15gnu: python-tinycss2: Fix test failure.Marius Bakke Fixes <https://bugs.gnu.org/42372>. Reported by Michael Rohleder <mike@rohleder.de>. * gnu/packages/patches/python-tinycss2-flake8-compat.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/python-web.scm (python-tinycss2)[source](patches): New field. 2020-07-15gnu: python-shiboken-2, python-pyside-2: Update to 5.14.2.3.Marius Bakke * gnu/packages/patches/qtbase-absolute-runpath.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/qt.scm (qtbase/next): New variable. * gnu/packages/qt.scm (python-shiboken-2): Update to 5.14.2.3. [source](uri): Adjust for tarball rename. [inputs]: Use the default CLANG-TOOLCHAIN. (python-pyside-2)[inputs]: Likewise. (python-pyside-2-tools)[inputs]: Change from QTBASE to QTBASE/NEXT. 2020-07-13gnu: xpra: Upgrade to 4.0.2.Lars-Dominik Braun * gnu/packages/xorg.scm (xpra)[version]: Upgrade. [source]: Add patch. [inputs]: Adjust to use Python 3 dependencies. [arguments]: Use Python 3, add phases to patch hardcoded binary paths. * gnu/local.mk (dist_patch_DATA): Add patch. * gnu/packages/patches/xpra-4.0.1-systemd-run.patch: New file. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-07-13gnu: libreoffice: Update to 6.4.5.2.Efraim Flashner * gnu/packages/libreoffice.scm (libreoffice): Update to 6.4.5.2. [source]: Remove patch. * gnu/packages/patches/libreoffice-poppler-compat.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Remove it. 2020-07-12gnu: opendht: Add patch.Jan Wielkiewicz The 2.1.4 release of opendht contains a bug, preventing it's use with recent releases of Jami. This minor patch [1] resolves this issue, and should be possible to remove with the next release. 1: https://github.com/savoirfairelinux/opendht/commit/e2b39dd3a0742853e00f9c3e8c46c911da20bed7 * gnu/packages/patches/opendht-fix-jami.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/networking.scm (opendht)[source]: Apply the patch. Signed-off-by: Christopher Baines <mail@cbaines.net> 2020-07-11gnu: sqlite: Add locking-mode fix for the Hurd.Jan (janneke) Nieuwenhuizen * gnu/packages/patches/sqlite-hurd.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/sqlite.scm (sqlite)[native-inputs]: Add it when building for the Hurd. [arguments]: Apply it when building for the Hurd. 2020-07-10gnu: Add ECL 16.1.3 for Sage.Jakub Kądziołka * gnu/packages/sagemath.scm (ecl-16): New variable. * gnu/packages/patches/ecl-16-format-directive-limit.patch, gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch, gnu/packages/patches/ecl-16-libffi.patch: New files. * gnu/local.mk (dist_patch_DATA): Register the patches.