packages: stb: Add stb-image-resize2

main
Luis Guilherme Coelho 2024-11-12 23:57:38 -03:00
parent 2282685f5e
commit 2d037af446
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 75 additions and 0 deletions

75
radix/packages/stb.scm Normal file
View File

@ -0,0 +1,75 @@
(define-module (radix packages stb)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module ((guix licenses) #:select (expat public-domain)))
(define stb
;; stb is a collection of libraries developed within the same repository.
;; When updating this, remember to change versions below as appropriate.
(let ((commit "5c205738c191bcb0abc65c4febfa9bd25ff35234")
(revision "0"))
(package
(name "stb")
(home-page "https://github.com/nothings/stb")
(version (git-version "0.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url home-page)
(commit commit)))
(sha256
(base32
"1g8arc3rndy78fwyznwywxqcy2pwnf4w0220vj2197wrl6hn9r95"))
(file-name (git-file-name name version))))
(build-system gnu-build-system)
(arguments
`(#:modules ((ice-9 ftw)
(ice-9 regex)
(srfi srfi-26)
,@%default-gnu-modules)
#:phases (modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(delete 'check)
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(files (make-regexp "\\.(c|h|md)$")))
(for-each (lambda (file)
(install-file file out))
(scandir "." (cut regexp-exec files <>)))
#t))))))
(synopsis "Single file libraries for C/C++")
(description
"This package contains a variety of small independent libraries for
the C programming language.")
;; The user can choose either license.
(license (list expat public-domain)))))
(define (make-stb-header-package name version description)
(package
(inherit stb)
(name name)
(version version)
(source #f)
(inputs (list stb))
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder (begin
(use-modules (guix build utils))
(let ((stb (assoc-ref %build-inputs "stb"))
(lib (string-join (string-split ,name #\-) "_"))
(out (assoc-ref %outputs "out")))
(install-file (string-append stb "/" lib ".h")
(string-append out "/include"))
#t))))
(description description)))
(define-public stb-image-resize2
(make-stb-header-package
"stb-image-resize2" "2.12"
"stb-image-resize is a library that supports scaling and translation of
images."))