unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument
@ 2023-12-13  8:00 Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-13  8:00 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori

* guix/build-system/font.scm: (font-build): Pass license-file-regexp
keyword argument to font-build.
* guix/build-system/gnu.scm: Export %license-file-regexp.

Change-Id: I4e9378cbed9a8c3b9838efcd448e9bfec8ba97be
---
 guix/build-system/font.scm | 2 ++
 guix/build-system/gnu.scm  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/guix/build-system/font.scm b/guix/build-system/font.scm
index c57c304f52..893e9f635e 100644
--- a/guix/build-system/font.scm
+++ b/guix/build-system/font.scm
@@ -81,6 +81,7 @@ (define* (font-build name inputs
                      (search-paths '())
                      (system (%current-system))
                      (guile #f)
+                     (license-file-regexp %license-file-regexp)
                      (imported-modules %font-build-system-modules)
                      (modules '((guix build font-build-system)
                                 (guix build utils))))
@@ -94,6 +95,7 @@ (define* (font-build name inputs
               #~(font-build #:name #$name
                             #:source #+source
                             #:configure-flags #$configure-flags
+                            #:license-file-regexp #$license-file-regexp
                             #:system #$system
                             #:test-target #$test-target
                             #:tests? #$tests?
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index cdbb547773..b8082354b9 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -28,6 +28,7 @@ (define-module (guix build-system gnu)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (%gnu-build-system-modules
+            %license-file-regexp
             %strip-flags
             %strip-directories
             gnu-build

base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
@ 2023-12-13  8:02 ` Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument Saku Laesvuori via Guix-patches via
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-13  8:02 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I52e3e3fda5fa83b6b0e865b9e56f008f91a4465c
---
 gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 813367be8a..f88a715fae 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -59,6 +59,7 @@
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2023 chris <chris@bumblehead.com>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <sirgazil@zoho.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2526,6 +2527,29 @@ (define-public font-jetbrains-mono
 in small sizes, the text looks crisper.")
     (license license:asl2.0)))
 
+(define-public font-jetbrains-mono-nerd-font
+  (package
+    (name "font-jetbrains-mono-nerd-font")
+    (version "3.1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/ryanoasis/nerd-fonts/releases/"
+                    "download/v" version "/JetBrainsMono.tar.xz"))
+              (sha256
+               (base32
+                "1f8xi8kgyik59ahjm3pcrb2s02c9a9i6kwf5b4651zpjmjy5l8lj"))))
+    (build-system font-build-system)
+    (arguments '(#:license-file-regexp "^OFL\\.txt$"))
+    (home-page "https://nerdfonts.com")
+    (synopsis "Mono typeface for developers with Nerd Fonts patching")
+    (description
+     "JetBrains Mono is a font family dedicated to developers.  JetBrains
+Mono’s typeface forms are simple and free from unnecessary details.  Rendered
+in small sizes, the text looks crisper. Nerd Fonts patching adds a high number
+of extra glyphs.")
+    (license license:silofl1.1)))
+
 (define-public font-juliamono
   (package
     (name "font-juliamono")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
@ 2023-12-13  8:02 ` Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license Saku Laesvuori via Guix-patches via
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-13  8:02 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (font-jetbrains-mono)[arguments]: Replace
custom 'install-license-files build phase with license-file-regexp
argument.

Change-Id: Ie8b851b04c84c63c5e1abb1e75c9312b4729be57
---
 gnu/packages/fonts.scm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index f88a715fae..3f4f5ae847 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2512,13 +2512,8 @@ (define-public font-jetbrains-mono
            ;; Find the license file outside of the default subdirectory.
            (lambda _
              (chdir "..")
-             #t))
-         (replace 'install-license-files
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (doc (string-append out "/share/doc/" ,name "-" ,version)))
-               (install-file "OFL.txt" doc)
-               #t))))))
+             #t)))
+       #:license-file-regexp "^OFL\\.txt$"))
     (home-page "https://www.jetbrains.com/lp/mono/")
     (synopsis "Mono typeface for developers")
     (description
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license.
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument Saku Laesvuori via Guix-patches via
@ 2023-12-13  8:02 ` Saku Laesvuori via Guix-patches via
  2023-12-13  8:02 ` [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304 Saku Laesvuori via Guix-patches via
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-13  8:02 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

The build scripts are licensed under asl2.0 but the packaged font files
are licensed under silofl1.1.

* gnu/packages/fonts.scm (font-jetbrains-mono)[license]: Use silofl1.1
instead of asl2.0.

Change-Id: I256a89b6e4bdb368c9cc94cae0808f72c76e7599
---
 gnu/packages/fonts.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 3f4f5ae847..52e9cb0987 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2520,7 +2520,7 @@ (define-public font-jetbrains-mono
      "JetBrains Mono is a font family dedicated to developers.  JetBrains
 Mono’s typeface forms are simple and free from unnecessary details.  Rendered
 in small sizes, the text looks crisper.")
-    (license license:asl2.0)))
+    (license license:silofl1.1)))
 
 (define-public font-jetbrains-mono-nerd-font
   (package
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
                   ` (2 preceding siblings ...)
  2023-12-13  8:02 ` [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license Saku Laesvuori via Guix-patches via
@ 2023-12-13  8:02 ` Saku Laesvuori via Guix-patches via
  2023-12-13 14:33 ` [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Simon South
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-13  8:02 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (font-jetbrains-mono): Update to version 2.304.

Change-Id: Id325fda8f9b50cf830107823c6ca1b439a6bdca0
---
 gnu/packages/fonts.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 52e9cb0987..a2bb8a1065 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2495,7 +2495,7 @@ (define-public font-sil-ezra
 (define-public font-jetbrains-mono
   (package
     (name "font-jetbrains-mono")
-    (version "2.242")
+    (version "2.304")
     (source
      (origin
        (method url-fetch)
@@ -2503,7 +2503,7 @@ (define-public font-jetbrains-mono
         (string-append "https://github.com/JetBrains/JetBrainsMono/releases/"
                        "download/v" version "/JetBrainsMono-" version ".zip"))
        (sha256
-        (base32 "17qs985v38x3rcg3v4av3qynwr4gvixrj50vjzy7zkkny575ncaf"))))
+        (base32 "1gvv5w0vfzndzp8k7g15j5i3yvnpr5z3imrwjs5flq19xp37cqvg"))))
     (build-system font-build-system)
     (arguments
      `(#:phases
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
                   ` (3 preceding siblings ...)
  2023-12-13  8:02 ` [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304 Saku Laesvuori via Guix-patches via
@ 2023-12-13 14:33 ` Simon South
  2023-12-14  6:46   ` Saku Laesvuori via Guix-patches via
  2023-12-14  7:35 ` [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font Saku Laesvuori via Guix-patches via
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Simon South @ 2023-12-13 14:33 UTC (permalink / raw)
  To: 67808; +Cc: saku

Thanks for raising this again, Saku.

The issue of the font-build-system not exposing its %license-file-regexp
argument affects a number of font packages that either define a
redundant phase or simply fail to install the right license files from
their distribution.  I attempted to address the problem comprehensively
with the patches in issue 61253:

https://issues.guix.gnu.org/61253

In addition to exposing the "%license-file-regexp" argument the changes
there also provide a default value that matches common font-license file
names (including "OFL.txt") and correct the 29 font packages I found to
have issues.

If there's interest in fixing this, I'm willing to review those patches
to verify they fix the problem globally.  Saku's update to the
font-jetbrains-mono package and addition of font-jetbrains-mono-nerd
could then (and maybe should) be handled each as a separate issue.

-- 
Simon South
simon@simonsouth.net




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument
  2023-12-13 14:33 ` [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Simon South
@ 2023-12-14  6:46   ` Saku Laesvuori via Guix-patches via
  0 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14  6:46 UTC (permalink / raw)
  To: Simon South; +Cc: 67808

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

> Thanks for raising this again, Saku.
> 
> The issue of the font-build-system not exposing its %license-file-regexp
> argument affects a number of font packages that either define a
> redundant phase or simply fail to install the right license files from
> their distribution.  I attempted to address the problem comprehensively
> with the patches in issue 61253:
> 
> https://issues.guix.gnu.org/61253
> 
> In addition to exposing the "%license-file-regexp" argument the changes
> there also provide a default value that matches common font-license file
> names (including "OFL.txt") and correct the 29 font packages I found to
> have issues.

That looks like a much more complete fix/improvement than mine. Great!

> If there's interest in fixing this, I'm willing to review those patches
> to verify they fix the problem globally.  Saku's update to the
> font-jetbrains-mono package and addition of font-jetbrains-mono-nerd
> could then (and maybe should) be handled each as a separate issue.

Sounds good to me. I'll rebase those patches onto your's now and again
later if needed.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
                   ` (4 preceding siblings ...)
  2023-12-13 14:33 ` [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Simon South
@ 2023-12-14  7:35 ` Saku Laesvuori via Guix-patches via
  2023-12-14  7:35   ` [bug#67808] [PATCH v2 1/1] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts Saku Laesvuori via Guix-patches via
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
  7 siblings, 1 reply; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14  7:35 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

The commits from the earlier serires that don't require the patches
adding the #:license-file-regexp argument have been split to issue
https://issues.guix.gnu.org/67821.

This remaining patch has been rebased on the patch series in
https://issues.guix.gnu.org/61253, which provides a more complete
implementation of #:license-file-regexp and uses it in more packages
that are currently missing license files or require extra phases to
install them.

Saku Laesvuori (1):
  gnu: Add font-jetbrains-mono-nerd-font

 gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)


base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
prerequisite-patch-id: f1a3748021e8151006183f5bf8a3453d95348e4f
prerequisite-patch-id: d0efcb0bae4e140993f7357be85bafc7db2a03a9
prerequisite-patch-id: 32722a903edb46f733a99b5f89a8f0d42ee34f6c
prerequisite-patch-id: 3194c603473c81f60dde6feb43a27b3c1660835f
prerequisite-patch-id: 509e75f9191fadc38ec04f2ab989eba0405f2098
prerequisite-patch-id: 0d5568f0f56d4a9aa42259674c1192e1f8341aaf
prerequisite-patch-id: d925c21152992d98567fe4c97fd938aebb86e52c
prerequisite-patch-id: 79976cb8b9c9b844821cfdec23ed13c8b65f1023
prerequisite-patch-id: bace71a67a9b9f31d3a1e3b724329542e82b9beb
prerequisite-patch-id: 0e3995a7ff4d3ee174db5ad470f514fbbed81c88
prerequisite-patch-id: bfee1b31479e96ab5673a3c7a6b29072808b9b26
prerequisite-patch-id: 60ebfde4db3da5ce38eb2d5ea6b4be5e8d8fe1e5
prerequisite-patch-id: 0cdc659948d06ec8ecf0334524fb1475e03476fe
prerequisite-patch-id: e3792b37a113e83822d5193054da424f9f4bccf4
prerequisite-patch-id: d3e99b0184547ac5fc8447594a2401d737bdc95b
prerequisite-patch-id: 46f87c03fa136a6565462a9f9221c129b98e408b
prerequisite-patch-id: bc4cabfd0780e673a604a408aa97fcebe912be68
prerequisite-patch-id: d981276b0d3b8aa436bdaf28e4f9d5afcd781d66
prerequisite-patch-id: 31e1fa56623253a275f7cb65f60adfaa91b4cf59
-- 
2.41.0





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v2 1/1] gnu: Add font-jetbrains-mono-nerd-font
  2023-12-14  7:35 ` [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font Saku Laesvuori via Guix-patches via
@ 2023-12-14  7:35   ` Saku Laesvuori via Guix-patches via
  0 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14  7:35 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I52e3e3fda5fa83b6b0e865b9e56f008f91a4465c
---
 gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 1cb0576974..e1324bded1 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -59,6 +59,7 @@
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2023 chris <chris@bumblehead.com>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <sirgazil@zoho.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2532,6 +2533,29 @@ (define-public font-jetbrains-mono
 in small sizes, the text looks crisper.")
     (license license:asl2.0)))
 
+(define-public font-jetbrains-mono-nerd-font
+  (package
+    (name "font-jetbrains-mono-nerd-font")
+    (version "3.1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/ryanoasis/nerd-fonts/releases/"
+                    "download/v" version "/JetBrainsMono.tar.xz"))
+              (sha256
+               (base32
+                "1f8xi8kgyik59ahjm3pcrb2s02c9a9i6kwf5b4651zpjmjy5l8lj"))))
+    (build-system font-build-system)
+    (arguments '(#:license-file-regexp "^OFL\\.txt$"))
+    (home-page "https://nerdfonts.com")
+    (synopsis "Mono typeface for developers with Nerd Fonts patching")
+    (description
+     "JetBrains Mono is a font family dedicated to developers.  JetBrains
+Mono’s typeface forms are simple and free from unnecessary details.  Rendered
+in small sizes, the text looks crisper. Nerd Fonts patching adds a high number
+of extra glyphs.")
+    (license license:silofl1.1)))
+
 (define-public font-juliamono
   (package
     (name "font-juliamono")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
                   ` (5 preceding siblings ...)
  2023-12-14  7:35 ` [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font Saku Laesvuori via Guix-patches via
@ 2023-12-14 14:01 ` Saku Laesvuori via Guix-patches via
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
  7 siblings, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14 14:01 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

I had originally planned to package the script that the Nerd Fonts
project uses to patch their fonts and use it to patch the JetBrains Mono
font. Unfortunately, the script is just an unpackaged script and I had
trouble making a sane package definition for it until now.

This series packages that script, adds a procedure for creating a Nerd
Fonts patched copy of an arbitrary package and uses it to package the
JetBrainsMono Nerd Font.

This doesn't depend on the patch series adding missing license files to
many font packages [1] anymore. Changes from the series updating
font-jetbrains-mono[2] that split from this series are independent but
also improve the font-jetbrains-mono-nerd-font package.

[1]: https://issues.guix.gnu.org/61253
[2]: https://issues.guix.gnu.org/67821

Saku Laesvuori (3):
  gnu: Add nerd-font-patcher
  gnu: Add Nerd Font patching procedure
  gnu: Add font-jetbrains-mono-nerd-font

 gnu/packages/fonts.scm                        | 54 ++++++++++++
 ...nt-patcher-convert-to-python-package.patch | 85 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 47 ++++++++++
 3 files changed, 186 insertions(+)
 create mode 100644 gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch


base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
-- 
2.41.0





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher
  2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
                   ` (6 preceding siblings ...)
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts Saku Laesvuori via Guix-patches via
@ 2023-12-14 14:01 ` Saku Laesvuori via Guix-patches via
  2023-12-14 14:01   ` [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure Saku Laesvuori via Guix-patches via
  2023-12-14 14:01   ` [bug#67808] [PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
  7 siblings, 2 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14 14:01 UTC (permalink / raw)
  To: 67808
  Cc: Saku Laesvuori, Lars-Dominik Braun, Marius Bakke,
	Munyoki Kilyungi, jgart

* gnu/packages/python-xyz.scm (nerd-font-patcher): New variable.
* gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch:
New file

Change-Id: I5f0b99b5120dfa8835727f4ea9f01c235962eed9
---
 ...nt-patcher-convert-to-python-package.patch | 85 +++++++++++++++++++
 gnu/packages/python-xyz.scm                   | 47 ++++++++++
 2 files changed, 132 insertions(+)
 create mode 100644 gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch

diff --git a/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch b/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch
new file mode 100644
index 0000000000..400c608f88
--- /dev/null
+++ b/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch
@@ -0,0 +1,85 @@
+This patch
+
+* Creates a pyproject.toml file
+* Changes paths to be more sensible.
+
+It requires extra work in a snippet to work properly, because moving the
+files in a patch would effectively duplicate all the code.
+
+ font-patcher                               | 13 ++++---------
+ bin/scripts/name_parser/FontnameParser.py |  2 +-
+ pyproject.toml                             | 13 +++++++++++++
+ 3 files changed, 18 insertions(+), 10 deletions(-)
+ create mode 100644 pyproject.toml
+
+diff --git a/font-patcher b/font-patcher
+index 4cbf46c..89ae402 100755
+--- a/font-patcher
++++ b/font-patcher
+@@ -38,13 +38,9 @@ except ImportError:
+         )
+     )
+ 
+-sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])) + '/bin/scripts/name_parser/')
+-try:
+-    from FontnameParser import FontnameParser
+-    from FontnameTools import FontnameTools
+-    FontnameParserOK = True
+-except ImportError:
+-    FontnameParserOK = False
++from nerd_font_patcher.name_parser.FontnameParser import FontnameParser
++from nerd_font_patcher.name_parser.FontnameTools import FontnameTools
++FontnameParserOK = True
+ 
+ class TableHEADWriter:
+     """ Access to the HEAD table without external dependencies """
+@@ -1897,7 +1893,7 @@ def setup_arguments():
+     expert_group.add_argument('--custom',                                  dest='custom',           default=False, type=str,            help='Specify a custom symbol font, all glyphs will be copied; absolute path suggested')
+ 
+     expert_group.add_argument('--dry',                                     dest='dry_run',          default=False, action='store_true', help='Do neither patch nor store the font, to check naming')
+-    expert_group.add_argument('--glyphdir',                                dest='glyphdir',         default=__dir__ + "/src/glyphs/", type=str, help='Path to glyphs to be used for patching')
++    expert_group.add_argument('--glyphdir',                                dest='glyphdir',         default=__dir__ + "/share/fonts/nerd-font-glyphs", type=str, help='Path to glyphs to be used for patching')
+     expert_group.add_argument('--has-no-italic',                           dest='noitalic',         default=False, action='store_true', help='Font family does not have Italic (but Oblique), to help create correct RIBBI set')
+     expert_group.add_argument('-l', '--adjust-line-height',                dest='adjustLineHeight', default=False, action='store_true', help='Whether to adjust line heights (attempt to center powerline separators more evenly)')
+     expert_group.add_argument('--metrics',                                 dest='metrics',          default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)')
+@@ -2068,5 +2064,4 @@ def main():
+ 
+ 
+ if __name__ == "__main__":
+-    __dir__ = os.path.dirname(os.path.abspath(__file__))
+     main()
+diff --git a/bin/scripts/name_parser/FontnameParser.py b/bin/scripts/name_parser/FontnameParser.py
+index 5768c42..1d95fdc 100644
+--- a/bin/scripts/name_parser/FontnameParser.py
++++ b/bin/scripts/name_parser/FontnameParser.py
+@@ -2,7 +2,7 @@
+ # coding=utf8
+ 
+ import re
+-from FontnameTools import FontnameTools
++from nerd_font_patcher.name_parser.FontnameTools import FontnameTools
+ 
+ class FontnameParser:
+     """Parse a font name and generate all kinds of names"""
+diff --git a/pyproject.toml b/pyproject.toml
+new file mode 100644
+index 0000000..e039e68
+--- /dev/null
++++ b/pyproject.toml
+@@ -0,0 +1,13 @@
++[build-system]
++requires = ["setuptools"]
++build-backend = "setuptools.build_meta"
++
++[project]
++name = "font_patcher"
++version = "3.1.1"
++
++[project.scripts]
++font-patcher = "nerd_font_patcher:main"
++
++[tool.setuptools]
++packages = ["nerd_font_patcher", "nerd_font_patcher.name_parser"]
+-- 
+2.41.0
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 86f8d81689..320fd4cb69 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -146,6 +146,7 @@
 ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2023 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2023 Troy Figiel <troy@troyfigiel.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -13611,6 +13612,52 @@ (define-public python-fonttools
              python-zopfli))
       (properties (alist-delete 'hidden? (package-properties base))))))
 
+(define-public nerd-font-patcher
+  (package
+    (name "nerd-font-patcher")
+    (version "3.1.1")
+    (source
+     (origin
+       (method url-fetch/zipbomb)
+       (uri
+        (string-append
+         "https://github.com/ryanoasis/nerd-fonts/releases/download/v"
+         version "/FontPatcher.zip"))
+       (sha256
+        (base32 "1wp41ljxa5sjgxhw97cm06icw9n03nmpygr3j9qq3zs5wsxvs4bv"))
+       (snippet #~(begin
+                    (rename-file "bin/scripts" "nerd_font_patcher")
+                    (rename-file "font-patcher" "nerd_font_patcher/__init__.py")))
+       (patches
+        (search-patches "nerd-font-patcher-convert-to-python-package.patch"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f ;no tests available
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'build 'patch-__dir__
+            (lambda _
+              (substitute* "nerd_font_patcher/__init__.py"
+                (("__dir__")
+                 (string-append "\"" #$output "\"\n")))))
+          (add-after 'install 'install-glyphs
+            (lambda _
+              (let ((font-directory (string-append #$output "/share/fonts")))
+                (mkdir-p font-directory)
+                (copy-recursively "src/glyphs" (string-append font-directory "/nerd-font-glyphs"))))))))
+    (inputs (list python fontforge))
+    (native-inputs (list python-setuptools))
+    (home-page "https://github.com/ryanoasis/nerd-fonts/#option-9-patch-your-own-font")
+    (synopsis "Script for adding Nerd Fonts glyphs into fonts")
+    (description "This package provides a python script that can be used to add the
+Nerd Fonts glyphs to any font file.")
+    (license (list license:asl2.0
+                   license:cc-by4.0
+                   license:expat
+                   license:silofl1.1
+                   license:unlicense))))
+
 (define-public python-ly
   (package
     (name "python-ly")

base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
@ 2023-12-14 14:01   ` Saku Laesvuori via Guix-patches via
  2023-12-14 14:01   ` [bug#67808] [PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
  1 sibling, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14 14:01 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (patch-nerd-font): New variable.

Change-Id: Id830424ec68836df7622535207818ff3445c21d4
---
 gnu/packages/fonts.scm | 54 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 813367be8a..3568f38c60 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -59,6 +59,7 @@
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2023 chris <chris@bumblehead.com>
 ;;; Copyright © 2023 Luis Felipe López Acevedo <sirgazil@zoho.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -103,6 +104,56 @@ (define-module (gnu packages fonts)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages xorg))
 
+(define-public (patch-nerd-font font-package)
+  "Return a package that contains the same files as FONT-PACKAGE, except
+that all font files are Nerd Fonts patched."
+  (package
+    (name (string-append (package-name font-package) "-nerd-font"))
+    (version (package-version font-package))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:builder
+      (with-imported-modules '((guix build utils))
+        #~(begin
+            (use-modules (guix build utils))
+
+            (define (font-file? filename)
+              ;; The regexp's are from guix/build/font-build-system.scm (install)
+              ;; woff2 is excluded because the fontforge in guix is not compiled
+              ;; with support for it
+              ((file-name-predicate "\\.(tt[fc]|ot[fc]|woff)$")
+               filename #f)) ;the 2. argument is stat but it is unused
+
+            (define (output-path source-path)
+              (let* ((name-version/path (strip-store-file-name source-path))
+                     (path-pieces (string-split name-version/path
+                                                file-name-separator?))
+                     (path-in-package (string-join (cdr path-pieces)
+                                                   file-name-separator-string
+                                                   'prefix)))
+                (string-append #$output (dirname path-in-package))))
+
+            (define (install-and-patch-file file)
+              (if (font-file? file)
+                (invoke (string-append #$(this-package-native-input "nerd-font-patcher")
+                                       "/bin/font-patcher")
+                        file "-o" (output-path file) "--complete")
+                (install-file file (output-path file))))
+
+            (for-each install-and-patch-file
+                      (find-files #$(this-package-native-input
+                                      (package-name font-package))))))))
+    (native-inputs (list nerd-font-patcher font-package))
+    (synopsis
+     (string-append (package-synopsis font-package) " (Nerd Fonts patched)"))
+    (description
+     (string-append (package-description font-package)
+                    " Nerd Fonts patching adds thousands of symbolic glyphs."))
+    (home-page (package-home-page font-package))
+    (license (package-license font-package))))
+
 (define-public font-artifika
   (package
     (name "font-artifika")
@@ -2526,6 +2577,9 @@ (define-public font-jetbrains-mono
 in small sizes, the text looks crisper.")
     (license license:asl2.0)))
 
+(define-public font-jetbrains-mono-nerd-font
+  (patch-nerd-font font-jetbrains-mono))
+
 (define-public font-juliamono
   (package
     (name "font-juliamono")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#67808] [PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font
  2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
  2023-12-14 14:01   ` [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure Saku Laesvuori via Guix-patches via
@ 2023-12-14 14:01   ` Saku Laesvuori via Guix-patches via
  1 sibling, 0 replies; 13+ messages in thread
From: Saku Laesvuori via Guix-patches via @ 2023-12-14 14:01 UTC (permalink / raw)
  To: 67808; +Cc: Saku Laesvuori, Zhu Zihao, 宋文武

* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I61b356b1ac57a030e6fa3f8236afcb07daf02c9f
---
 gnu/packages/fonts.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 3568f38c60..bcddf71d27 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2580,6 +2580,9 @@ (define-public font-jetbrains-mono
 (define-public font-jetbrains-mono-nerd-font
   (patch-nerd-font font-jetbrains-mono))
 
+(define-public font-jetbrains-mono-nerd-font
+  (patch-nerd-font font-jetbrains-mono))
+
 (define-public font-juliamono
   (package
     (name "font-juliamono")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-12-14 14:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13  8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
2023-12-13  8:02 ` [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
2023-12-13  8:02 ` [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument Saku Laesvuori via Guix-patches via
2023-12-13  8:02 ` [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license Saku Laesvuori via Guix-patches via
2023-12-13  8:02 ` [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304 Saku Laesvuori via Guix-patches via
2023-12-13 14:33 ` [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Simon South
2023-12-14  6:46   ` Saku Laesvuori via Guix-patches via
2023-12-14  7:35 ` [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font Saku Laesvuori via Guix-patches via
2023-12-14  7:35   ` [bug#67808] [PATCH v2 1/1] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
2023-12-14 14:01 ` [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts Saku Laesvuori via Guix-patches via
2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
2023-12-14 14:01   ` [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure Saku Laesvuori via Guix-patches via
2023-12-14 14:01   ` [bug#67808] [PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).