summary refs log tree commit diff
path: root/gnu/packages/image.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2023-01-08 19:32:17 +0100
committerMarius Bakke <marius@gnu.org>2023-01-08 19:32:17 +0100
commitda91e790fdf4053a1503738e69f88c4b2054b096 (patch)
tree27f26ac3308eaa34952314a3182ffce2f5dcd51e /gnu/packages/image.scm
parent9123bb0fba3fce976dc41cd3b8919ee73b4cee4d (diff)
parent8cca1a35bc42cddb7e0586062d192197520042d5 (diff)
downloadguix-da91e790fdf4053a1503738e69f88c4b2054b096.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/packages/image.scm')
-rw-r--r--gnu/packages/image.scm62
1 files changed, 35 insertions, 27 deletions
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index a4ca328b5d..f48776469d 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
 ;;; Copyright © 2014, 2017 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2016, 2017, 2018, 2020 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016-2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016–2022 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016, 2017, 2020, 2021, 2022 Arun Isaac <arunisaac@systemreboot.net>
@@ -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.
 ;;;
@@ -2168,35 +2169,42 @@ This package can be used to create @code{favicon.ico} files for web sites.")
                 "02zmb62g0yx6rfz4w1isyzfrckv5i7dzyz26rp2mspbx9w6v8j4r"))))
     (build-system cmake-build-system)
     (arguments
-     (list #:configure-flags
-           #~'("-DAVIF_CODEC_AOM=ON" "-DAVIF_CODEC_DAV1D=ON"
-               #$@(if (string-prefix? "x86_64"
-                                      (or (%current-target-system)
-                                          (%current-system)))
-                      '("-DAVIF_CODEC_RAV1E=ON")
-                      '())
-               "-DAVIF_BUILD_TESTS=ON")
-       #:phases
-       #~(modify-phases %standard-phases
-           (add-after 'install 'install-readme
-             (lambda _
-               (let ((doc (string-append #$output "/share/doc/libavif-"
-                                         #$(package-version this-package))))
-                 (install-file "../source/README.md" doc)))))))
+     (list
+      #:configure-flags
+      #~(list "-DAVIF_CODEC_AOM=ON" "-DAVIF_CODEC_DAV1D=ON"
+              #$@(if (this-package-input "rav1e")
+                   '("-DAVIF_CODEC_RAV1E=ON")
+                   '())
+              "-DAVIF_BUILD_TESTS=ON" "-DAVIF_BUILD_APPS=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-readme
+            (lambda _
+              (let ((doc (string-append #$output "/share/doc/libavif-"
+                                        #$(package-version this-package))))
+                (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*))))))))
     (native-inputs (list googletest))
     (inputs
      (append
-      (list dav1d
-            libaom
-            libjpeg-turbo
-            libpng
-            zlib)
-       ;; XXX: rav1e depends on rust, which currently only works on x86_64.
-       ;; See also the related configure flag when changing this.
-       (if (string-prefix? "x86_64" (or (%current-target-system)
-                                        (%current-system)))
-           (list rav1e)
-           '())))
+      (if (member (%current-system) (package-transitive-supported-systems rav1e))
+        (list rav1e) '())
+      (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