gnu: waybar: Fix build.
[jackhill/guix/guix.git] / guix / build-system / font.scm
CommitLineData
3d90fa98
AI
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (guix build-system font)
20 #:use-module (guix utils)
21 #:use-module (guix packages)
22 #:use-module (guix derivations)
23 #:use-module (guix search-paths)
24 #:use-module (guix build-system)
25 #:use-module (guix build-system gnu)
26 #:use-module (ice-9 match)
27 #:export (%font-build-system-modules
28 font-build
29 font-build-system))
30
31;; Commentary:
32;;
33;; Standard build procedure for fonts. This is implemented as an extension of
34;; 'gnu-build-system'.
35;;
36;; Code:
37
38(define %font-build-system-modules
39 ;; Build-side modules imported by default.
40 `((guix build font-build-system)
41 ,@%gnu-build-system-modules))
42
43(define* (lower name
44 #:key source inputs native-inputs outputs system target
45 #:allow-other-keys
46 #:rest arguments)
47 "Return a bag for NAME."
48 (define private-keywords
49 '(#:target #:inputs #:native-inputs))
50
51 (bag
52 (name name)
53 (system system)
54 (host-inputs `(,@(if source
55 `(("source" ,source))
56 '())
57 ,@inputs
58 ,(list "tar" (module-ref (resolve-interface '(gnu packages base)) 'tar))
3d90fa98
AI
59 ,@(let ((compression (resolve-interface '(gnu packages compression))))
60 (map (match-lambda
61 ((name package)
62 (list name (module-ref compression package))))
63 `(("gzip" gzip)
64 ("bzip2" bzip2)
148585c2 65 ("unzip" unzip)
3d90fa98
AI
66 ("xz" xz))))))
67 (build-inputs native-inputs)
68 (outputs outputs)
69 (build font-build)
70 (arguments (strip-keyword-arguments private-keywords arguments))))
71
72(define* (font-build store name inputs
73 #:key source
74 (tests? #t)
75 (test-target "test")
76 (configure-flags ''())
77 (phases '(@ (guix build font-build-system)
78 %standard-phases))
79 (outputs '("out"))
80 (search-paths '())
81 (system (%current-system))
82 (guile #f)
83 (imported-modules %font-build-system-modules)
84 (modules '((guix build font-build-system)
85 (guix build utils))))
86 "Build SOURCE with INPUTS."
87 (define builder
88 `(begin
89 (use-modules ,@modules)
90 (font-build #:name ,name
91 #:source ,(match (assoc-ref inputs "source")
92 (((? derivation? source))
93 (derivation->output-path source))
94 ((source)
95 source)
96 (source
97 source))
98 #:configure-flags ,configure-flags
99 #:system ,system
100 #:test-target ,test-target
101 #:tests? ,tests?
102 #:phases ,phases
103 #:outputs %outputs
104 #:search-paths ',(map search-path-specification->sexp
105 search-paths)
106 #:inputs %build-inputs)))
107
108 (define guile-for-build
109 (match guile
110 ((? package?)
111 (package-derivation store guile system #:graft? #f))
112 (#f ; the default
113 (let* ((distro (resolve-interface '(gnu packages commencement)))
114 (guile (module-ref distro 'guile-final)))
115 (package-derivation store guile system #:graft? #f)))))
116
117 (build-expression->derivation store name builder
118 #:inputs inputs
119 #:system system
120 #:modules imported-modules
121 #:outputs outputs
122 #:guile-for-build guile-for-build))
123
124(define font-build-system
125 (build-system
126 (name 'font)
127 (description "The build system for font packages")
128 (lower lower)))
129
130;;; font.scm ends here