From e2e2d9e220158aa2fd7dd0f4995c76d7d09ae79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor-bj=C3=B6rn=20Claesson?= Date: Sat, 7 Jan 2023 21:40:42 +0200 Subject: [PATCH v2] gnu: Add gdcm. * gnu/packages/image-processing.scm (gdcm): New variable. Signed-off-by: Tobias Geerinckx-Rice --- gnu/packages/image-processing.scm | 105 ++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index 70c820e76b..b95cb54964 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -99,6 +99,7 @@ (define-module (gnu packages image-processing) #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages video) + #:use-module (gnu packages web) #:use-module (gnu packages xiph) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) @@ -196,6 +197,110 @@ (define-public dcmtk "A union of the Apache 2.0 licence and various non-copyleft licences similar to the Modified BSD licence.")))) +(define-public gdcm + (package + (name "gdcm") + (version "3.0.20") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/malaterre/GDCM/") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1w78cmm9q7aavs7svdkl4dgilcqk4yazci9m6x7icrssb7cj991i")) + (modules '((guix build utils) + (ice-9 ftw))) + (snippet + '(begin + (define (unbundle? file) + (and (file-is-directory? file) + ;; Not all directories represent a bundled project, + ;; and some projects can't yet be unbundled. + (not (member file '("." ".." + "doxygen" + "gdcmext" + "gdcmjpeg" ; TODO + "gdcmrle" + "socketxx"))))) ; TODO + (with-directory-excursion "Utilities" + (for-each (lambda (utility) + (delete-file-recursively utility) + (substitute* "CMakeLists.txt" + (((string-append ".*/" utility "/.*")) ""))) + (scandir "." unbundle?))))))) + (build-system cmake-build-system) + (outputs '("out" "doc")) + (arguments + (list #:tests? #f ; XXX + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'set-LDFLAGS + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "LDFLAGS" + (string-append "-Wl,-rpath=" + #$output "/lib")))) + (add-before 'build 'set-HOME + ;; The build spams ‘Fontconfig error: No writable cache + ;; directories’ in a seemingly endless loop otherwise. + (lambda _ + (setenv "HOME" "/tmp"))) + (add-before 'build 'patch-gdcm-charls.h + (lambda _ + (substitute* "../source/Utilities/gdcm_charls.h" + (("") + ""))))) + #:configure-flags + #~(list "-DCMAKE_SKIP_RPATH:BOOL=YES" + "-DCMAKE_BUILD_TYPE:STRING=Release" + "-DCMAKE_C_FLAGS=-fvisibility=hidden" + "-DCMAKE_CXX_FLAGS=-fvisibility=hidden" + "-DGDCM_BUILD_SHARED_LIBS:BOOL=ON" + + "-DGDCM_DOCUMENTATION:BOOL=ON" + "-DGDCM_PDF_DOCUMENTATION:BOOL=OFF" ; TODO? need texlive + (string-append "-DGDCM_INSTALL_DOC_DIR=" + #$output:doc "/share/doc/" #$name) + "-DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF" ; TODO: need ‘xsl-ns’ + + "-DGDCM_USE_SYSTEM_EXPAT:BOOL=ON" + "-DGDCM_USE_SYSTEM_ZLIB:BOOL=ON" + "-DGDCM_USE_SYSTEM_CHARLS:BOOL=ON" + "-DGDCM_USE_SYSTEM_POPPLER:BOOL=ON" + "-DGDCM_USE_SYSTEM_LIBXML2:BOOL=ON" + "-DGDCM_USE_SYSTEM_JSON:BOOL=ON" + "-DGDCM_USE_SYSTEM_UUID:BOOL=ON" + "-DGDCM_USE_SYSTEM_OPENJPEG:BOOL=ON" + "-DGDCM_USE_SYSTEM_OPENSSL:BOOL=ON" + + "-DGDCM_BUILD_APPLICATIONS:BOOL=OFF" + + ;; TODO: Unbundle these if possible. + "-DGDCM_USE_SYSTEM_PAPYRUS3:BOOL=OFF" + "-DGDCM_USE_SYSTEM_SOCKETXX:BOOL=OFF" ; socketxx in snippet + "-DGDCM_USE_SYSTEM_LJPEG:BOOL=OFF"))) ; gdcmjpeg in snippet + (inputs (list charls + expat + json-c + libxml2 + openjpeg + openssl + poppler + `(,util-linux "lib") + zlib)) + (native-inputs (list doxygen git graphviz pkg-config)) + (home-page "https://gdcm.sourceforge.net") + (synopsis "C++ library to read, parse, and write DICOM medical files") + (description + "@acronym{GDCM, Grassroots DICOM} implements the @acronym{DICOM, Digital +Imaging and Communications in Medicine} standard to let researchers access +clinical data directly. GDCM includes a file format definition and a network +communications protocol, both of which should be extended to provide a full set +of tools for a researcher or small medical imaging vendor to interface with an +existing medical database.") + (license license:bsd-3))) + (define-public mia (package (name "mia") base-commit: e0ed305f2f096e7048af1a117c72895433f4886a -- 2.38.1