gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / stb.scm
CommitLineData
cada868c
MB
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
6f5f60b2 3;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
cada868c
MB
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages stb)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix build-system trivial)
25 #:use-module ((guix licenses) #:select (expat public-domain)))
26
27(define stb
28 ;; stb is a collection of libraries developed within the same repository.
29 ;; When updating this, remember to change versions below as appropriate.
0e8df740
TGR
30 (let ((commit "b42009b3b9d4ca35bc703f5310eedc74f584be58")
31 (revision "2"))
cada868c
MB
32 (package
33 (name "stb")
34 (home-page "https://github.com/nothings/stb")
35 (version (git-version "0.0" revision commit))
36 (source (origin
37 (method git-fetch)
38 (uri (git-reference
39 (url home-page)
40 (commit commit)))
41 (sha256
42 (base32
0e8df740 43 "1gmcjhmj62mfdscrsg2hv4j4j9v447y8zj3rbrm7mqn94cx73z1i"))
cada868c
MB
44 (file-name (git-file-name name version))))
45 (build-system gnu-build-system)
46 (arguments
47 `(#:modules ((ice-9 ftw)
48 (ice-9 regex)
49 (srfi srfi-26)
50 ,@%gnu-build-system-modules)
51 #:phases (modify-phases %standard-phases
52 (delete 'configure)
53 (delete 'build)
54 (replace 'check
55 (lambda _
56 (invoke "make" "-C" "tests" "CC=gcc")))
57 (replace 'install
58 (lambda* (#:key outputs #:allow-other-keys)
59 (let ((out (assoc-ref outputs "out"))
60 (files (make-regexp "\\.(c|h|md)$")))
61 (for-each (lambda (file)
62 (install-file file out))
63 (scandir "." (cut regexp-exec files <>)))
64 #t))))))
65 (synopsis "Single file libraries for C/C++")
66 (description
67 "This package contains a variety of small independent libraries for
68the C programming language.")
69 ;; The user can choose either license.
70 (license (list expat public-domain)))))
71
72(define (make-stb-header-package name version description)
73 (package
74 (inherit stb)
75 (name name)
76 (version version)
77 (source #f)
78 (inputs `(("stb" ,stb)))
79 (build-system trivial-build-system)
80 (arguments
81 `(#:modules ((guix build utils))
82 #:builder (begin
83 (use-modules (guix build utils))
84 (let ((stb (assoc-ref %build-inputs "stb"))
85 (lib (string-join (string-split ,name #\-) "_"))
86 (out (assoc-ref %outputs "out")))
87 (install-file (string-append stb "/" lib ".h")
88 (string-append out "/include"))
89 #t))))
90 (description description)))
91
92;; TODO: These descriptions are not translatable! They should be
93;; converted to macros as outlined in <https://bugs.gnu.org/32155>.
94(define-public stb-image
95 (make-stb-header-package
0e8df740 96 "stb-image" "2.26"
cada868c
MB
97 "stb-image is a small and self-contained library for image loading or
98decoding from file or memory. A variety of formats are supported."))
ecb1194b
MB
99
100(define-public stb-image-write
101 (make-stb-header-package
0e8df740 102 "stb-image-write" "1.15"
ecb1194b
MB
103 "stb-image-write is a small library for writing image files to the
104C@tie{}@code{stdio} interface."))
8a4c7be4 105
6f5f60b2
TGR
106(define-public stb-rect-pack
107 (make-stb-header-package
108 "stb-rect-pack" "1.00"
109 "stb-rect-pack is a small rectangle packing library useful for, e.g., packing
110rectangular textures into an atlas. It does not do rotation."))
111
8a4c7be4
GL
112(define-public stb-sprintf
113 (make-stb-header-package
0e8df740 114 "stb-sprintf" "1.09"
8a4c7be4 115 "stb-sprintf implements fast @code{sprintf}, @code{snprintf} for C/C++."))
6e43e1ee
GL
116
117(define-public stb-truetype
118 (make-stb-header-package
0e8df740 119 "stb-truetype" "1.24"
6e43e1ee
GL
120 "stb-truetype is a library for parsing, decoding, and rasterizing
121characters from TrueType fonts."))