gnu: darktable: Improve package style.

* gnu/packages/photo.scm (darktable)[arguments]: Use G-expressions.
[native-inputs]: Remove labels.
This commit is contained in:
Nicolas Goaziou 2023-04-08 13:33:34 +02:00
parent 841a2e2d9c
commit c47694f116
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -472,98 +472,99 @@ (define-public darktable
(base32 "1b3vr6njwqfvnrx3qpbg5aqcbl1z8nxnxcgyyw0sd4a20z33jfk0")))) (base32 "1b3vr6njwqfvnrx3qpbg5aqcbl1z8nxnxcgyyw0sd4a20z33jfk0"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
`(#:configure-flags '("-DBINARY_PACKAGE_BUILD=On" (list
"-DBUILD_TESTING=On") #:configure-flags
#:phases #~(list "-DBINARY_PACKAGE_BUILD=On"
(modify-phases %standard-phases "-DBUILD_TESTING=On")
(add-after 'unpack 'libOpenCL-path #:phases
(lambda* (#:key inputs #:allow-other-keys) #~(modify-phases %standard-phases
;; Statically link to libOpenCL. (add-after 'unpack 'libOpenCL-path
(substitute* "./src/common/dlopencl.c" (lambda* (#:key inputs #:allow-other-keys)
(("\"libOpenCL\"") ;; Statically link to libOpenCL.
(string-append "\"" (assoc-ref inputs "opencl-icd-loader") (substitute* "./src/common/dlopencl.c"
"/lib/libOpenCL.so\""))))) (("\"libOpenCL\"")
(add-after 'unpack 'fix-missing-include (string-append "\""
(lambda _ (search-input-file inputs "/lib/libOpenCL.so")
;; Fix missing include needed to build tests. See upstream "\"")))))
;; issue: https://github.com/darktable-org/darktable/issues/12604 (add-after 'unpack 'fix-missing-include
(substitute* "./src/common/variables.h" (lambda _
(("once") ;; Fix missing include needed to build tests. See upstream
"once\n#include \"common/image.h\"")))) ;; issue: https://github.com/darktable-org/darktable/issues/12604
(add-before 'configure 'prepare-build-environment (substitute* "./src/common/variables.h"
(lambda* (#:key inputs #:allow-other-keys) (("once")
;; Rawspeed fails to build with GCC due to OpenMP error: "once\n#include \"common/image.h\""))))
;; "undefined reference to `GOMP_loop_nonmonotonic_dynamic_next'" (add-before 'configure 'prepare-build-environment
(setenv "CC" "clang") (setenv "CXX" "clang++") (lambda _
;; Darktable looks for opencl-c.h in the LLVM dir. Guix installs ;; Rawspeed fails to build with GCC due to OpenMP error:
;; it to the Clang dir. We fix this by patching CMakeLists.txt. ;; "undefined reference to `GOMP_loop_nonmonotonic_dynamic_next'"
(substitute* "CMakeLists.txt" (setenv "CC" "clang")
(("\\$\\{LLVM_INSTALL_PREFIX\\}") (setenv "CXX" "clang++")
(assoc-ref %build-inputs "clang"))))) ;; Darktable looks for opencl-c.h in the LLVM dir. Guix installs
(add-before 'configure 'set-LDFLAGS ;; it to the Clang dir. We fix this by patching CMakeLists.txt.
(lambda* (#:key outputs #:allow-other-keys) (substitute* "CMakeLists.txt"
(setenv "LDFLAGS" (("\\$\\{LLVM_INSTALL_PREFIX\\}")
(string-append #$(this-package-native-input "clang")))))
"-Wl,-rpath=" (add-before 'configure 'set-LDFLAGS
(assoc-ref outputs "out") "/lib/darktable")))) (lambda _
(add-after 'install 'wrap-program (setenv "LDFLAGS"
(lambda* (#:key inputs outputs #:allow-other-keys) (string-append "-Wl,-rpath=" #$output "/lib/darktable"))))
(wrap-program (string-append (assoc-ref outputs "out") (add-after 'install 'wrap-program
"/bin/darktable") (lambda _
;; For GtkFileChooserDialog. (wrap-program (string-append #$output "/bin/darktable")
`("GSETTINGS_SCHEMA_DIR" = ;; For GtkFileChooserDialog.
(,(string-append (assoc-ref inputs "gtk+") `("GSETTINGS_SCHEMA_DIR" =
"/share/glib-2.0/schemas"))))))))) (,(string-append #$(this-package-input "gtk+")
"/share/glib-2.0/schemas")))))))))
(native-inputs (native-inputs
`(("clang" ,clang-11) (list clang-11
("cmocka" ,cmocka) cmocka
("desktop-file-utils" ,desktop-file-utils) desktop-file-utils
("glib:bin" ,glib "bin") `(,glib "bin")
("gobject-introspection" ,gobject-introspection) gobject-introspection
("intltool" ,intltool) intltool
("llvm" ,llvm-11) ;should match the Clang version llvm-11 ;should match the Clang version
("opencl-headers" ,opencl-headers) opencl-headers
("perl" ,perl) perl
("pkg-config" ,pkg-config) pkg-config
("po4a" ,po4a) po4a
("python-wrapper" ,python-wrapper) python-wrapper
("ruby" ,ruby))) ruby))
(inputs (inputs
(list bash-minimal (list bash-minimal
cairo cairo
colord-gtk ;optional, for color profile support colord-gtk ;optional, for color profile support
cups ;optional, for printing support cups ;optional, for printing support
curl curl
dbus-glib dbus-glib
exiv2 exiv2
freeimage freeimage
gmic ;optional, for HaldcLUT support gmic ;optional, for HaldcLUT support
graphicsmagick graphicsmagick
gsettings-desktop-schemas gsettings-desktop-schemas
gtk+ gtk+
imath imath
iso-codes ;optional, for language names in the preferences iso-codes ;optional, for language names in the preferences
json-glib json-glib
lcms lcms
lensfun ;optional, for the lens distortion plugin lensfun ;optional, for the lens distortion plugin
libgphoto2 ;optional, for camera tethering libgphoto2 ;optional, for camera tethering
libavif ;optional, for AVIF support libavif ;optional, for AVIF support
libjpeg-turbo libjpeg-turbo
libomp libomp
libpng libpng
librsvg librsvg
libsecret ;optional, for storing passwords libsecret ;optional, for storing passwords
libsoup-minimal-2 libsoup-minimal-2
libtiff libtiff
libwebp ;optional, for WebP support libwebp ;optional, for WebP support
libxml2 libxml2
libxslt libxslt
libheif libheif
lua-5.4 ;optional, for plugins lua-5.4 ;optional, for plugins
opencl-icd-loader ;optional, for OpenCL support opencl-icd-loader ;optional, for OpenCL support
openexr ;optional, for EXR import/export openexr ;optional, for EXR import/export
openjpeg ;optional, for JPEG2000 export openjpeg ;optional, for JPEG2000 export
osm-gps-map ;optional, for geotagging view osm-gps-map ;optional, for geotagging view
pugixml pugixml
python-jsonschema python-jsonschema
sdl2 sdl2
@ -578,8 +579,8 @@ (define-public darktable
(supported-systems '("x86_64-linux" "aarch64-linux" "powerpc64le-linux")) (supported-systems '("x86_64-linux" "aarch64-linux" "powerpc64le-linux"))
(properties (properties
'((release-monitoring-url . "https://github.com/darktable-org/darktable/releases"))) '((release-monitoring-url . "https://github.com/darktable-org/darktable/releases")))
(license (list license:gpl3+ ;; Darktable itself. (license (list license:gpl3+ ;Darktable itself
license:lgpl2.1+)))) ;; Rawspeed library. license:lgpl2.1+)))) ;Rawspeed library
(define-public photoflare (define-public photoflare
(package (package