summary refs log tree commit diff
path: root/gnu/packages/image.scm
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2022-12-17 00:51:29 +0000
committerLeo Famulari <leo@famulari.name>2023-01-03 12:53:27 -0500
commit216281b1ebbbc3ea08a5d7b372e024bbaf758f39 (patch)
tree1b54867689e92a64e3bb881a1a89b781caac8663 /gnu/packages/image.scm
parentfaeeb302c25754b8be5d5f0621e4e4ef20a35812 (diff)
downloadguix-216281b1ebbbc3ea08a5d7b372e024bbaf758f39.tar.gz
gnu: libavif: Add tools output.
* gnu/packages/image.scm (libavif)[arguments]: Build avifenc & avifdec.
[outputs]: Add 'tools' output.
[inputs]: Add zlib, libpng, libjpeg-turbo.

Signed-off-by: Leo Famulari <leo@famulari.name>
Diffstat (limited to 'gnu/packages/image.scm')
-rw-r--r--gnu/packages/image.scm23
1 files changed, 20 insertions, 3 deletions
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 80872b1466..c7cfad8714 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -34,6 +34,7 @@
 ;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
 ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
 ;;; Copyright © 2022 ( <paren@disroot.org>
+;;; Copyright © 2022 Bruno Victal <mirai@makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2176,7 +2177,7 @@ This package can be used to create @code{favicon.ico} files for web sites.")
                                          (%current-system)))
                      '("-DAVIF_CODEC_RAV1E=ON")
                      '())
-              "-DAVIF_BUILD_TESTS=ON")
+              "-DAVIF_BUILD_TESTS=ON" "-DAVIF_BUILD_APPS=ON")
       #:phases
       #~(modify-phases %standard-phases
           (replace 'check
@@ -2185,7 +2186,21 @@ This package can be used to create @code{favicon.ico} files for web sites.")
           (add-after 'install 'install-readme
             (lambda _
               (let ((doc (string-append #$output "/share/doc/libavif-" #$version)))
-                (install-file "../source/README.md" doc)))))))
+                (install-file "../source/README.md" doc))))
+          (add-after 'install 'split
+            (lambda _
+              (let* ((avifenc  (string-append #$output       "/bin/avifenc"))
+                     (avifenc* (string-append #$output:tools "/bin/avifenc"))
+                     (avifdec  (string-append #$output       "/bin/avifdec"))
+                     (avifdec* (string-append #$output:tools "/bin/avifdec")))
+                (mkdir-p (string-append #$output:tools "/bin"))
+
+                (for-each (lambda (old new)
+                            (copy-file old new)
+                            (delete-file old)
+                            (chmod new #o555))
+                          (list avifenc avifdec)
+                          (list avifenc* avifdec*))))))))
     (inputs
      (append
       ;; XXX: rav1e depends on rust, which currently only works on x86_64.
@@ -2193,7 +2208,9 @@ This package can be used to create @code{favicon.ico} files for web sites.")
       (if (string-prefix? "x86_64" (or (%current-target-system)
                                        (%current-system)))
           (list rav1e) '())
-      (list dav1d libaom)))
+      (list dav1d libaom zlib libpng libjpeg-turbo)))
+    (outputs (list "out"
+                   "tools"))  ; avifenc & avifdec
     (synopsis "Encode and decode AVIF files")
     (description "Libavif is a C implementation of @acronym{AVIF, the AV1 Image
 File Format}.  It can encode and decode all YUV formats and bit depths supported