Subject: bug#26109: [PATCH 3/7] gnu: Add dcmtk.

From: Kei Kebreau <[email-masked]>
Date: Fri, 17 Mar 2017 16:42:59 -0400

John Darrington <[email-masked]> writes:

> * gnu/packages/image-processing.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.

Judging from the description of the software, it seems like this could
fit in gnu/packages/image.scm.

> ---
>  gnu/local.mk                      |  1 +
>  gnu/packages/image-processing.scm | 75 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 76 insertions(+)
>  create mode 100644 gnu/packages/image-processing.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index c1b076a..15325d3 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -187,6 +187,7 @@ GNU_SYSTEM_MODULES =				\
>    %D%/packages/idris.scm			\
>    %D%/packages/idutils.scm			\
>    %D%/packages/image.scm			\
> +  %D%/packages/image-processing.scm	\
>    %D%/packages/image-viewers.scm	\
>    %D%/packages/imagemagick.scm			\
>    %D%/packages/indent.scm			\
> diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
> new file mode 100644
> index 0000000..e1ad93e
> --- /dev/null
> +++ b/gnu/packages/image-processing.scm
> @@ -0,0 +1,75 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2017 John Darrington <[email-masked]>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages image-processing)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix packages)
> +  #:use-module (guix utils)
> +  #:use-module (guix download)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages compression)
> +  #:use-module (gnu packages documentation)
> +  #:use-module (gnu packages image)
> +  #:use-module (gnu packages perl))
> +
> +(define-public dcmtk
> +  (package
> +    (name "dcmtk")
> +    (version "3.6.0")
> +    (source (origin
> +              (method url-fetch)
> +              (uri
> +               (string-append
> +                "ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk"
> +                (string-fold (lambda (x prev)
> +                               (if (eq? x #\.) prev
> +                                   (string-append prev (string x))))
> +                             "" version)

The same effect is more directly (IMO) accomplished using the following:

(string-join (string-split version #\.) "")

> +                "/dcmtk-"
> +                version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "0fnkbq0nz8658svdn1xnjrv8qm618gln1q8ykwszmb9225q0kifg"))))
> +    (build-system gnu-build-system)
> +    (arguments `(#:parallel-build? #f ; Broken makefile
> +                 #:tests? #f    ; There are no tests
> +                 #:make-flags `("CXXFLAGS=-fpermissive -fPIC"
> +                                "CFLAGS=-fPIC")
> +                 #:phases
> +                 (modify-phases %standard-phases
> +                   (replace 'install
> +                            (lambda* (#:key outputs #:allow-other-keys)
> +                              (zero? (system* "make"
> +                                              "install-all")))))))
> +    (inputs `(("libtiff" ,libtiff)
> +              ("libpng" ,libpng)
> +              ("doxygen" ,doxygen)
> +              ("zlib" ,zlib)))
> +    (native-inputs `(("perl" ,perl)))
> +    (synopsis "Libraries and programs implementing large parts the DICOM standard")
> +    (description  "DCMTK is a collection of libraries and applications

Nitpicking again: why the double space between "description" and the
double quote?

> +implementing large parts the DICOM standard.  It includes software for
> +examining, constructing and converting DICOM image files, handling offline
> +media, sending and receiving images over a network connection, as well as
> +demonstrative image storage and worklist servers.")
> +    (home-page "http://dcmtk.org")
> +    (license (license:fsf-free
> +              "file://COPYRIGHT"
> +              "A union of the Apache 2.0 licence and various non-copyleft
> +licences similar to the Modified BSD licence."))))

Also, the linter says that this package vulnerable to
CVE-2015-8979. Supposedly this* upstream patch fixes it. Could you see
if that fix works for this package?

* https://github.com/commontk/DCMTK/commit/1b6bb76

Other than the above, LGTM.