diff mbox series

[bug#60358,v7,3/5] gnu: UCD: Add version 3.0-update1.

Message ID 86ed1bdd80433e8f3a0407bfe51d1ed4713e875f.camel@planete-kraus.eu
State New
Headers show
Series None | expand

Commit Message

Vivien Kraus Dec. 30, 2022, 9:20 p.m. UTC
* gnu/packages/unicode.scm (ucd3.0-update1): New variable.
---
 gnu/packages/unicode.scm | 59 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

Comments

Liliana Marie Prikler Dec. 31, 2022, 7:17 p.m. UTC | #1
Am Freitag, dem 30.12.2022 um 22:20 +0100 schrieb Vivien Kraus:
> * gnu/packages/unicode.scm (ucd3.0-update1): New variable.
Once again, do you need all of these, or just a single file?  (Or
indeed none at all?)
Vivien Kraus Jan. 1, 2023, 12:24 a.m. UTC | #2
Happy new year!

Le samedi 31 décembre 2022 à 20:17 +0100, Liliana Marie Prikler a
écrit :
> Am Freitag, dem 30.12.2022 um 22:20 +0100 schrieb Vivien Kraus:
> > * gnu/packages/unicode.scm (ucd3.0-update1): New variable.
> Once again, do you need all of these, or just a single file?  (Or
> indeed none at all?)

The build fails if I pass an empty file or a file with just the header.

I switched to an unnamed origin in the build phase, is that better?

Vivien
Liliana Marie Prikler Jan. 1, 2023, 1:28 a.m. UTC | #3
Am Sonntag, dem 01.01.2023 um 01:24 +0100 schrieb Vivien Kraus:
> Happy new year!
> 
> Le samedi 31 décembre 2022 à 20:17 +0100, Liliana Marie Prikler a
> écrit :
> > Am Freitag, dem 30.12.2022 um 22:20 +0100 schrieb Vivien Kraus:
> > > * gnu/packages/unicode.scm (ucd3.0-update1): New variable.
> > Once again, do you need all of these, or just a single file?  (Or
> > indeed none at all?)
> 
> The build fails if I pass an empty file or a file with just the
> header.
> 
> I switched to an unnamed origin in the build phase, is that better?
Yes, that is better – an outside variable would also have been, but it
works for now.

> +                (("sc_check_sym_list")
> +                 "disabled_check_sym_list")
> +                (("sc_cpp_indent_check")
> +                 "disabled_cpp_indent_check")
> +                (("sc_check_copyright")
> +                 "disabled_check_copyright")
> +                (("sc_prohibit_AC_LIBOBJ_in_m4")
> +                 "disabled_prohibit_AC_LIBOBJ_in_m4")
> +                (("sc_prefer_ac_check_funcs_once")
> +                 "disabled_prefer_ac_check_funcs_once")
> +                (("sc_prohibit_leading_TABs")
> +                 "disabled_prohibit_leading_TABs"))))
I think matching the name and then doing (string-append "disabled_"
test) should work better and possibly lets you group some.

> +              (define (find-ucd-file name)
> +                (search-input-file inputs (string-append
> "share/ucd/" name)))
I think you should also 
  (define (find-ucd-files . files)
     (map find-ucd-file files))
Then you can

> +                (apply invoke
> +                       "./gen-uni-tables"
> +                       `(,@(map find-ucd-file
> +                                '("UnicodeData.txt"
> +                                  "PropList.txt"
> +                                  "DerivedCoreProperties.txt"
> +                                  "emoji/emoji-data.txt"
> +                                  "ArabicShaping.txt"
> +                                  "Scripts.txt"
> +                                  "Blocks.txt"))
> +                         ,PropList-3.0.1.txt
> +                         ,@(map find-ucd-file
> +                                '("EastAsianWidth.txt"
> +                                  "LineBreak.txt"
> +                                  "auxiliary/WordBreakProperty.txt"
> +                                 
> "auxiliary/GraphemeBreakProperty.txt"
> +                                  "CompositionExclusions.txt"
> +                                  "SpecialCasing.txt"
> +                                  "CaseFolding.txt"))
(apply invoke
       (append
        (find-ucd-files "UnicodeData.txt"
                        "PropList.txt"
                        ...)
        (list PropList-3.0.1.txt) ; or inline the origin here
        (find-ucd-files "EastAsianWidth.txt"
                        ...)))

> +                (copy-file (search-input-file inputs
> "share/ucd/NameAliases.txt")
> +                           "../tests/uniname/NameAliases.txt")
> +                (copy-file (search-input-file inputs
> "share/ucd/UnicodeData.txt")
> +                           "../tests/uniname/UnicodeData.txt")
> +                (copy-file (search-input-file inputs
> "share/ucd/NormalizationTest.txt")
> +                           "../tests/uninorm/NormalizationTest.txt")
> +                (copy-file (search-input-file inputs
> "share/ucd/auxiliary/GraphemeBreakTest.txt")
> +                           "../tests/unigbrk/GraphemeBreakTest.txt")
> +                (copy-file (search-input-file inputs
> "share/ucd/auxiliary/WordBreakTest.txt")
> +                           "../tests/uniwbrk/WordBreakTest.txt")
Can we simplify this in terms of for-each and directory excursions?
Also reuse find-ucd-file(s).

> +          (replace 'install
> +            (lambda _
> +              (install-file "gnulib-tool"
> +                            (string-append #$output "/bin"))
> +              (delete-file-recursively ".git")
> +              (copy-recursively "." (string-append #$output
> "/src/gnulib/")))))))
Should we perhaps use copy-build-system instead and just copy over
gnu:build and gnu:test?

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/unicode.scm b/gnu/packages/unicode.scm
index 1f5bc10c94..b3a228f4f1 100644
--- a/gnu/packages/unicode.scm
+++ b/gnu/packages/unicode.scm
@@ -21,13 +21,15 @@ 
 (define-module (gnu packages unicode)
   #:use-module (gnu packages autotools)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:use-module (ice-9 match))
 
 (define-public libunibreak
   (package
@@ -111,6 +113,61 @@  (define-public ucd-next
         (base32
          "133inqn33hcfvylmps63yjr6rrqrfq6x7a5hr5fd51z6yc0f9gaz"))))))
 
+(define-public ucd3.0-update1
+  (package
+    (inherit ucd)
+    (version "3.0-update1")
+    (source
+     ;; unicode.org does not provide a zipped archive.
+     (directory-union
+      "ucd-3.0-update1-source"
+      (map
+       (match-lambda
+         ((filename . hash)
+          (file-union
+           (string-append "ucd-3.0-update1-" filename)
+           `((,filename
+              ,(origin
+                 (method url-fetch)
+                 (uri (string-append "https://www.unicode.org/Public/3.0-Update1/" filename))
+                 (sha256 hash)))))))
+       `(("ArabicShaping-3.txt"
+          . ,(base32
+              "0k6hwdnln8cwkzixxbbc6q5g3nx3z5p1549c0jicnz7gq2mvkh90"))
+         ("BidiMirroring-1.txt"
+          . ,(base32
+              "0wc5gj6mx5wjkwph734swqd3zvi3ngfx75yybbc1f52dc1l3sh9m"))
+         ("CaseFolding-2.txt"
+          . ,(base32
+              "143hvpalrnkrxc2g9626v6w4cgmksg9hkcm39fpmqidn0rnpm8vy"))
+         ("CompositionExclusions-2.txt"
+          . ,(base32
+              "06vlc7yqhkacbb411ykyn4na5kq93yp0p9mm3a2jfixk704nwpj1"))
+         ("Jamo-3.txt"
+          . ,(base32
+              "092lww4ak9wa7g4jn80i9ckniwg3ymmiaq62xxhhbwk3cx2d23ad"))
+         ("NormalizationTest-3.0.1.txt"
+          . ,(base32
+              "1r5vq8dlar7km1376bp16l40pyczzvwk9waxgin2i2432qdpwmga"))
+         ("PropList-3.0.1.txt"
+          . ,(base32
+              "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh"))
+         ("ReadMe-3.0.1.txt"
+          . ,(base32
+              "08mkcs3r1caj67wrcqq0gyb79zj9qyqnmx8qab0rsd4qg87xhnbv"))
+         ("SpecialCasing-3.txt"
+          . ,(base32
+              "08vrf0kk5zlsl40h4nsfbpnckl4610m7x2072lyq97lln7dsky7a"))
+         ("UnicodeCharacterDatabase-3.0.1.html"
+          . ,(base32
+              "0fy7vb1zkxg2pg198p7phncjs78gz6lvdzhv51yz34kds8nzz40m"))
+         ("UnicodeData-3.0.1.html"
+          . ,(base32
+              "0fvv59ydp09mppjr8130kmp90r240hnaqld8i5xkpz900fl20pc1"))
+         ("UnicodeData-3.0.1.txt"
+          . ,(base32
+              "092svm19f78pxg58pcisg3i57884y7z22rymrcppjkg6sz3izsia"))))))))
+
 (define (unicode-emoji-file name version hash)
   (origin
     (method url-fetch)