diff mbox series

[bug#39086,2/5] gnu: Add unicode-emoji.

Message ID a9985730473b92872445f56e7c90840017e8af14.camel@student.tugraz.at
State Accepted
Headers show
Series None | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Leo Prikler Jan. 17, 2020, 1:17 a.m. UTC
In my haste, I seriously forgot about match-lambda and prefix strips. 
This one should be better.
diff mbox series

Patch

From 3a1d1b2e1b3563f820c153b07693cc7496ae7c7c Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Sat, 11 Jan 2020 02:12:18 +0100
Subject: [PATCH] gnu: Add unicode-emoji.

* gnu/packages/unicode.scm: New file.
(unicode-emoji-file): New procedure.
(unicode-emoji): New variable.
* gnu/local.mk: Add unicode.scm to build.
---
 gnu/local.mk             |  1 +
 gnu/packages/unicode.scm | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 gnu/packages/unicode.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index cb46ee7..f61a67a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -497,6 +497,7 @@  GNU_SYSTEM_MODULES =				\
   %D%/packages/tor.scm				\
   %D%/packages/tv.scm				\
   %D%/packages/uml.scm				\
+  %D%/packages/unicode.scm			\
   %D%/packages/unrtf.scm			\
   %D%/packages/upnp.scm				\
   %D%/packages/usb-modeswitch.scm		\
diff --git a/gnu/packages/unicode.scm b/gnu/packages/unicode.scm
new file mode 100644
index 0000000..4c8298e
--- /dev/null
+++ b/gnu/packages/unicode.scm
@@ -0,0 +1,84 @@ 
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Leo Prikler <leo.prikler@student.tugraz.at>
+;;;
+;;; 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 packages unicode)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system trivial))
+
+(define (unicode-emoji-file name version hash)
+  (origin
+    (method url-fetch)
+    (uri (string-append "https://www.unicode.org/Public/emoji/"
+                        version
+                        "/emoji-" name ".txt"))
+    (sha256 (base32 hash))))
+
+(define-public unicode-emoji
+  (package
+    (name "unicode-emoji")
+    (version "12.0")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (let ((out (string-append %output "/share/unicode/emoji")))
+         (use-modules (guix build utils)
+                      (ice-9 match))
+         (mkdir-p out)
+         (for-each
+          (match-lambda
+            ((file . dest)
+             (and (string-prefix? dest "unicode-")
+                  (copy-file
+                   file
+                   (string-append out "/"
+                                  (substring dest (length "unicode-"))
+                                  ".txt")))))
+          %build-inputs)
+         #t)))
+    (inputs
+     `(("unicode-emoji-data"
+        ,(unicode-emoji-file
+          "data" version
+          "03sf7h1d6kb9m5s02lif88jsi5kjszpkfvcymaqxj8ds70ar9pgv"))
+       ("unicode-emoji-sequences"
+        ,(unicode-emoji-file
+          "sequences" version
+          "1hghki2rn3n7m4lwpwi2a5wrsf2nij4bxga9ldabx4g0g2k23svs"))
+       ("unicode-emoji-test"
+        ,(unicode-emoji-file
+          "test" version
+          "1dqd0fh999mh6naj816ni113m9dimfy3ih9nffjq2lrv9mmlgdck"))
+       ("unicode-emoji-variation-sequences"
+        ,(unicode-emoji-file
+          "variation-sequences" version
+          "1cccwx5bl79w4c19vi5dhjqxrph92s8hihp9y8s2cqvdzmgbln7a"))
+       ("unicode-emoji-zwj-sequences"
+        ,(unicode-emoji-file
+          "zwj-sequences" version
+          "1l791nbijmmhwa7kmvfn8gp26ban512l6mgqpz1mnbq3xm19181n"))))
+    (home-page "https://www.unicode.org")
+    (synopsis "Unicode Emoji data")
+    (description
+     "This package includes data files listing characters and sequences, that
+Unicode emoji supporting fonts or keyboards should support according to the
+Unicode Technological Standard #51.")
+    (license unicode)))
--
libgit2 0.28.4