diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 0a677d7835..0b0452664b 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -19,7 +19,7 @@ ;;; Copyright © 2018 Joshua Sierles, Nextjournal ;;; Copyright © 2018 Fis Trivial ;;; Copyright © 2018 Pierre Neidhardt -;;; Copyright © 2018, 2019, 2020 Marius Bakke +;;; Copyright © 2018-2020, 2022 Marius Bakke ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; Copyright © 2018 Alex Vong ;;; Copyright © 2018 Rutger Helling @@ -98,6 +98,7 @@ (define-module (gnu packages image) #:use-module (gnu packages fonts) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) + #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) @@ -1071,89 +1072,89 @@ (define-public giblib (define-public freeimage (package - (name "freeimage") - (version "3.18.0") - (source (origin - (method url-fetch) - (uri (string-append - "mirror://sourceforge/freeimage/Source%20Distribution/" - version "/FreeImage" - (string-concatenate (string-split version #\.)) - ".zip")) - (sha256 - (base32 - "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl")) - (modules '((guix build utils))) - (snippet - '(begin - (for-each - (lambda (dir) - (delete-file-recursively (string-append "Source/" dir))) - '("LibJPEG" "LibOpenJPEG" "LibPNG" "LibRawLite" - "LibJXR" "LibWebP" "OpenEXR" "ZLib")))) - (patches - (append - (search-patches "freeimage-unbundle.patch") - ;; Take one patch from Arch Linux that adds LibRaw 0.20 compatibility. - (list (origin - (method url-fetch) - (uri "https://raw.githubusercontent.com/archlinux\ + (name "freeimage") + (version "3.18.0") + (source (origin + (method url-fetch) + (uri (string-append + "mirror://sourceforge/freeimage/Source%20Distribution/" + version "/FreeImage" + (string-concatenate (string-split version #\.)) + ".zip")) + (sha256 + (base32 + "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each + (lambda (dir) + (delete-file-recursively (string-append "Source/" dir))) + '("LibJPEG" "LibOpenJPEG" "LibPNG" "LibRawLite" + "LibJXR" "LibWebP" "OpenEXR" "ZLib")))) + (patches + (append + (search-patches "freeimage-unbundle.patch") + ;; Take one patch from Arch Linux that adds LibRaw 0.20 compatibility. + (list (origin + (method url-fetch) + (uri "https://raw.githubusercontent.com/archlinux\ /svntogit-community/ca3e6a52f5a46dec87cbf85e9d84fe370e282c8c/trunk\ /freeimage-libraw-0.20.patch") - (file-name "freeimage-libraw-compat.patch") - (sha256 - (base32 - "0cwjxjz0f4gs6igvwqg0p99mnrsrwzkal1l2n08yvz2xq9s5khki")))))))) - (build-system gnu-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - ;; According to Fedora these files depend on private headers, but their - ;; presence is required for building, so we replace them with empty files. - (add-after 'unpack 'delete-unbuildable-files - (lambda _ - (for-each (lambda (file) - (delete-file file) - (close (open file O_CREAT))) - '("Source/FreeImage/PluginG3.cpp" - "Source/FreeImageToolkit/JPEGTransform.cpp")) - #t)) - ;; These scripts generate the Makefiles. - (replace 'configure - (lambda _ - (invoke "sh" "gensrclist.sh") - (invoke "sh" "genfipsrclist.sh"))) - (add-before 'build 'patch-makefile - (lambda* (#:key outputs #:allow-other-keys) - (substitute* "Makefile.gnu" - (("/usr") (assoc-ref outputs "out")) - (("-o root -g root") "")) - #t))) + (file-name "freeimage-libraw-compat.patch") + (sha256 + (base32 + "0cwjxjz0f4gs6igvwqg0p99mnrsrwzkal1l2n08yvz2xq9s5khki")))))))) + (build-system gnu-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + ;; According to Fedora these files depend on private headers, but their + ;; presence is required for building, so we replace them with empty files. + (add-after 'unpack 'delete-unbuildable-files + (lambda _ + (for-each (lambda (file) + (delete-file file) + (close (open file O_CREAT))) + '("Source/FreeImage/PluginG3.cpp" + "Source/FreeImageToolkit/JPEGTransform.cpp")))) + ;; These scripts generate the Makefiles. + (replace 'configure + (lambda _ + (invoke "sh" "gensrclist.sh") + (invoke "sh" "genfipsrclist.sh"))) + (add-before 'build 'patch-makefile + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "Makefile.gnu" + (("/usr") (assoc-ref outputs "out")) + (("-o root -g root") ""))))) #:make-flags - (list ,(string-append "CC=" (cc-for-target)) - ;; We need '-fpermissive' for Source/FreeImage.h. - ;; libjxr doesn't have a pkg-config file. - (string-append "CFLAGS+=-O2 -fPIC -fvisibility=hidden -fpermissive " - "-I" (assoc-ref %build-inputs "libjxr") "/include/jxrlib")) - #:tests? #f)) ; no check target - (native-inputs - (list pkg-config unzip)) - (inputs - `(("libjpeg" ,libjpeg-turbo) - ("libjxr" ,libjxr) - ("libpng" ,libpng) - ("libraw" ,libraw) - ("libtiff" ,libtiff) - ("libwebp" ,libwebp) - ("openexr" ,openexr-2) - ("openjpeg" ,openjpeg) - ("zlib" ,zlib))) - (synopsis "Library for handling popular graphics image formats") - (description - "FreeImage is a library for developers who would like to support popular + #~(let ((jxrlib (search-input-directory %build-inputs "include/jxrlib"))) + (list (string-append "CC=" #$(cc-for-target)) + ;; We need '-fpermissive' for Source/FreeImage.h. + ;; libjxr doesn't have a pkg-config file. + (string-append "CFLAGS+=-O2 -fPIC -fvisibility=hidden " + "-fpermissive -I" jxrlib))) + #:tests? #f)) ; no check target + (native-inputs + (list pkg-config unzip)) + (inputs + (list libjpeg-turbo + libjxr + libpng + libraw + libtiff + libwebp + openexr-2 + openjpeg + zlib)) + (synopsis "Library for handling popular graphics image formats") + (description + "FreeImage is a library for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others.") - (license license:gpl2+) - (home-page "https://freeimage.sourceforge.io/"))) + (license license:gpl2+) + (home-page "https://freeimage.sourceforge.io/"))) (define-public vigra (let ((commit "9b514fa00a136f5fd81bb57ee9f6293c333ffc1f")