| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 |
|
| 21 | (define-module (gnu packages stb)
|
| 22 | #:use-module (guix gexp)
|
| 23 | #:use-module (guix packages)
|
| 24 | #:use-module (guix git-download)
|
| 25 | #:use-module (guix build-system gnu)
|
| 26 | #:use-module (guix build-system trivial)
|
| 27 | #:use-module ((guix licenses) #:select (expat public-domain)))
|
| 28 |
|
| 29 | (define-public stb
|
| 30 | |
| 31 | |
| 32 | (let ((commit "2e2bef463a5b53ddf8bb788e25da6b8506314c08")
|
| 33 | (revision "3"))
|
| 34 | (package
|
| 35 | (name "stb")
|
| 36 | (home-page "https://github.com/nothings/stb")
|
| 37 | (version (git-version "0.0" revision commit))
|
| 38 | (source (origin
|
| 39 | (method git-fetch)
|
| 40 | (uri (git-reference
|
| 41 | (url home-page)
|
| 42 | (commit commit)))
|
| 43 | (sha256
|
| 44 | (base32
|
| 45 | "1n3klhrf65ndlzg88z0ligk9z4jdg4p296wnqivd1259834cj8gf"))
|
| 46 | (file-name (git-file-name name version))))
|
| 47 | (build-system gnu-build-system)
|
| 48 | (arguments
|
| 49 | (list
|
| 50 | #:modules `((ice-9 ftw)
|
| 51 | (ice-9 regex)
|
| 52 | (srfi srfi-26)
|
| 53 | ,@%default-gnu-modules)
|
| 54 | #:phases
|
| 55 | #~(modify-phases %standard-phases
|
| 56 | (delete 'configure)
|
| 57 | (delete 'build)
|
| 58 | (replace 'check
|
| 59 | (lambda _
|
| 60 | #f |
| 61 | ))
|
| 62 | (replace 'install
|
| 63 | (lambda _
|
| 64 | (let* ((files-rx (make-regexp "\\.(c|h|md)$"))
|
| 65 | (include-file? (cut regexp-exec files-rx <>))
|
| 66 | (deprecated-output (string-append #$output "/deprecated"))
|
| 67 | (pkgconfig (string-append #$output "/lib/pkgconfig"))
|
| 68 | (pc (string-append pkgconfig "/stb.pc")))
|
| 69 | (for-each (cut install-file <> #$output)
|
| 70 | (scandir "." include-file?))
|
| 71 | (mkdir-p deprecated-output)
|
| 72 | (with-directory-excursion "deprecated"
|
| 73 | (for-each (cut install-file <> deprecated-output)
|
| 74 | (scandir "." include-file?)))
|
| 75 | |
| 76 | (mkdir-p pkgconfig)
|
| 77 | (call-with-output-file pc
|
| 78 | (lambda (port)
|
| 79 | (format port
|
| 80 | "prefix=~a
|
| 81 | includedir=${prefix}
|
| 82 |
|
| 83 | Name: stb
|
| 84 | Version: ~a
|
| 85 | Description: ~a
|
| 86 | Cflags: -I${includedir}~%"
|
| 87 | #$output #$version
|
| 88 | #$(package-synopsis this-package))))))))))
|
| 89 | (synopsis "Single file libraries for C/C++")
|
| 90 | (description
|
| 91 | "This package contains a variety of small independent libraries for
|
| 92 | the C programming language.")
|
| 93 | |
| 94 | (license (list expat public-domain)))))
|
| 95 |
|
| 96 | (define* (make-stb-header-package name version description #:key deprecated?)
|
| 97 | (package
|
| 98 | (inherit stb)
|
| 99 | (name name)
|
| 100 | (version version)
|
| 101 | (source #f)
|
| 102 | (inputs (list stb))
|
| 103 | (build-system trivial-build-system)
|
| 104 | (arguments
|
| 105 | (list
|
| 106 | #:modules '((guix build utils))
|
| 107 | #:builder
|
| 108 | #~(begin
|
| 109 | (use-modules (guix build utils))
|
| 110 | (let ((headers-dir #$(file-append (this-package-input "stb")
|
| 111 | (if deprecated? "/deprecated" "")))
|
| 112 | (lib (string-join (string-split #$name #\-) "_"))
|
| 113 | (out #$output))
|
| 114 | (install-file (string-append headers-dir "/" lib ".h")
|
| 115 | (string-append out "/include"))
|
| 116 | #t))))
|
| 117 | (description description)))
|
| 118 |
|
| 119 | (define-syntax define-stb-header-package
|
| 120 | (syntax-rules (description)
|
| 121 | ((_ symbol name version (description text) rest ...)
|
| 122 | (define-public symbol
|
| 123 | (make-stb-header-package name version text rest ...)))))
|
| 124 |
|
| 125 | (define-stb-header-package stb-image
|
| 126 | "stb-image" "2.30"
|
| 127 | (description
|
| 128 | "stb-image is a small and self-contained library for image loading or
|
| 129 | decoding from file or memory. A variety of formats are supported."))
|
| 130 |
|
| 131 | (define-stb-header-package stb-image-resize
|
| 132 | "stb-image-resize" "0.97"
|
| 133 | (description
|
| 134 | "stb-image-resize is a library that supports scaling and translation of
|
| 135 | images. This library is deprecated; @code{stb-image-resize2} should be used
|
| 136 | instead.")
|
| 137 | #:deprecated? #t)
|
| 138 |
|
| 139 | (define-stb-header-package stb-image-resize2
|
| 140 | "stb-image-resize2" "2.12"
|
| 141 | (description
|
| 142 | "stb-image-resize2 is a library that supports scaling and translation of
|
| 143 | images."))
|
| 144 |
|
| 145 | (define-stb-header-package stb-image-write
|
| 146 | "stb-image-write" "1.16"
|
| 147 | (description
|
| 148 | "stb-image-write is a small library for writing image files to the
|
| 149 | C@tie{}@code{stdio} interface."))
|
| 150 |
|
| 151 | (define-stb-header-package stb-rect-pack
|
| 152 | "stb-rect-pack" "1.01"
|
| 153 | (description
|
| 154 | "stb-rect-pack is a small rectangle packing library useful for, e.g., packing
|
| 155 | rectangular textures into an atlas. It does not do rotation."))
|
| 156 |
|
| 157 | (define-stb-header-package stb-sprintf
|
| 158 | "stb-sprintf" "1.10"
|
| 159 | (description
|
| 160 | "stb-sprintf implements fast @code{sprintf}, @code{snprintf} for C/C++."))
|
| 161 |
|
| 162 | (define-stb-header-package stb-truetype
|
| 163 | "stb-truetype" "1.26"
|
| 164 | (description
|
| 165 | "stb-truetype is a library for parsing, decoding, and rasterizing
|
| 166 | characters from TrueType fonts."))
|