mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-26 20:49:29 -05:00
build/minetest-build-system: Move png-file? to (guix build utils).
It's not really Minetest-specific. It was only placed in (guix build minetest-build-system) to avoid a world rebuild. * guix/build/minetest-build-system.scm (%png-magic-bytes,png-file?): Move to ... * guix/build/utils.scm (%png-magic-bytes,png-file?): ... here. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
parent
9bf0652b08
commit
8a55fde935
2 changed files with 11 additions and 9 deletions
|
@ -90,15 +90,6 @@ (define* (install #:key inputs #:allow-other-keys #:rest arguments)
|
|||
#:install-plan (mod-install-plan (apply guess-mod-name arguments))
|
||||
arguments))
|
||||
|
||||
(define %png-magic-bytes
|
||||
;; Magic bytes of PNG images, see ‘5.2 PNG signatures’ in
|
||||
;; ‘Portable Network Graphics (PNG) Specification (Second Edition)’
|
||||
;; on <https://www.w3.org/TR/PNG/>.
|
||||
#vu8(137 80 78 71 13 10 26 10))
|
||||
|
||||
(define png-file?
|
||||
((@@ (guix build utils) file-header-match) %png-magic-bytes))
|
||||
|
||||
(define* (minimise-png #:key inputs native-inputs #:allow-other-keys)
|
||||
"Minimise PNG images found in the working directory."
|
||||
(define optipng (which "optipng"))
|
||||
|
|
|
@ -61,6 +61,8 @@ (define-module (guix build utils)
|
|||
symbolic-link?
|
||||
call-with-temporary-output-file
|
||||
call-with-ascii-input-file
|
||||
file-header-match
|
||||
png-file?
|
||||
elf-file?
|
||||
ar-file?
|
||||
gzip-file?
|
||||
|
@ -290,6 +292,15 @@ (define (get-header)
|
|||
#f ;FILE is a directory
|
||||
(apply throw args))))))
|
||||
|
||||
(define %png-magic-bytes
|
||||
;; Magic bytes of PNG images, see ‘5.2 PNG signatures’ in
|
||||
;; ‘Portable Network Graphics (PNG) Specification (Second Edition)’
|
||||
;; on <https://www.w3.org/TR/PNG/>.
|
||||
#vu8(137 80 78 71 13 10 26 10))
|
||||
|
||||
(define png-file?
|
||||
(file-header-match %png-magic-bytes))
|
||||
|
||||
(define %elf-magic-bytes
|
||||
;; Magic bytes of ELF files. See <elf.h>.
|
||||
(u8-list->bytevector (map char->integer (string->list "\x7FELF"))))
|
||||
|
|
Loading…
Reference in a new issue