From faeeb302c25754b8be5d5f0621e4e4ef20a35812 Mon Sep 17 00:00:00 2001 From: Bruno Victal Date: Sat, 17 Dec 2022 00:51:28 +0000 Subject: gnu: libavif: Rewrite using G-Exps. * gnu/packages/image.scm (libavif)[arguments]: Rewrite using G-Expressions. Signed-off-by: Leo Famulari --- gnu/packages/image.scm | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index bc1f25627b..80872b1466 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -2168,32 +2168,32 @@ (define-public libavif "1yxmgjlxm1srm98zyj79bj8r8vmg67daqnq0ggcvxknq54plkznk")))) (build-system cmake-build-system) (arguments - `(#: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 - (replace 'check - (lambda _ - (invoke "./aviftest" "../source/tests/data"))) - (add-after 'install 'install-readme - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (doc (string-append out "/share/doc/libavif-" ,version))) - (install-file "../source/README.md" doc))))))) + (list + #:configure-flags + #~(list "-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 + (replace 'check + (lambda _ + (invoke "./aviftest" "../source/tests/data"))) + (add-after 'install 'install-readme + (lambda _ + (let ((doc (string-append #$output "/share/doc/libavif-" #$version))) + (install-file "../source/README.md" doc))))))) (inputs - `(("dav1d" ,dav1d) - ("libaom" ,libaom) - ;; 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))) - `(("rav1e" ,rav1e)) - '()))) + (append + ;; 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) '()) + (list dav1d libaom))) (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 -- cgit v1.2.3 From 216281b1ebbbc3ea08a5d7b372e024bbaf758f39 Mon Sep 17 00:00:00 2001 From: Bruno Victal Date: Sat, 17 Dec 2022 00:51:29 +0000 Subject: 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 --- gnu/packages/image.scm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'gnu/packages/image.scm') 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 ;;; Copyright © 2022 Jai Vetrivelan ;;; Copyright © 2022 ( +;;; Copyright © 2022 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -2176,7 +2177,7 @@ (define-public libavif (%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 @@ (define-public libavif (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 @@ (define-public libavif (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 -- cgit v1.2.3 From 9c098979a2ce5732d689ddf919aa9bd3464d9d3d Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 3 Jan 2023 21:57:35 +0200 Subject: gnu: libavif: Honor #:tests? flag. * gnu/packages/image.scm (libavif)[arguments]: Adjust custom 'check phase to honor the #:tests? flag. --- gnu/packages/image.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index c7cfad8714..53e5363dcd 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2015 Amirouche Boubekki ;;; Copyright © 2014, 2017 John Darrington ;;; Copyright © 2016, 2017, 2018, 2020 Leo Famulari -;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner +;;; Copyright © 2016-2023 Efraim Flashner ;;; Copyright © 2016–2022 Tobias Geerinckx-Rice ;;; Copyright © 2016 Eric Bavier ;;; Copyright © 2016, 2017, 2020, 2021, 2022 Arun Isaac @@ -2181,8 +2181,9 @@ (define-public libavif #:phases #~(modify-phases %standard-phases (replace 'check - (lambda _ - (invoke "./aviftest" "../source/tests/data"))) + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "./aviftest" "../source/tests/data")))) (add-after 'install 'install-readme (lambda _ (let ((doc (string-append #$output "/share/doc/libavif-" #$version))) -- cgit v1.2.3 From fe1ed81d28dcc5d6448d2eb6431397bbd10a2a55 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 3 Jan 2023 22:37:09 +0200 Subject: gnu: libavif: Add configure-flag for rav1e when available. * gnu/packages/image.scm (libavif)[arguments]: Adjust configure-flags to build with rav1e support when it is in the build closure. --- gnu/packages/image.scm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 53e5363dcd..6daf479c81 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -2172,11 +2172,9 @@ (define-public libavif (list #:configure-flags #~(list "-DAVIF_CODEC_AOM=ON" "-DAVIF_CODEC_DAV1D=ON" - #$@(if (string-prefix? "x86_64" - (or (%current-target-system) - (%current-system))) - '("-DAVIF_CODEC_RAV1E=ON") - '()) + #$@(if (this-package-input "rav1e") + '("-DAVIF_CODEC_RAV1E=ON") + '()) "-DAVIF_BUILD_TESTS=ON" "-DAVIF_BUILD_APPS=ON") #:phases #~(modify-phases %standard-phases -- cgit v1.2.3 From 1d3098fc3bfd6cddc38c359c5e834ee2974c99ec Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 3 Jan 2023 22:39:56 +0200 Subject: gnu: libavif: Add rav1e when it is supported. * gnu/packages/image.scm (libavif)[inputs]: Add rav1e when building on a supported system. --- gnu/packages/image.scm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 6daf479c81..195d127b31 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -2202,11 +2202,8 @@ (define-public libavif (list avifenc* avifdec*)))))))) (inputs (append - ;; 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 -- cgit v1.2.3