# $Id: Portfile 87739 2011-12-03 05:29:42Z eborisch@macports.org $

PortSystem              1.0
PortGroup               muniversal 1.0
name                    dcmtk
version                 3.6.0
revision                1
set unpatched_version   [lindex [split ${version} _] 0]
set stripped_version    [string map {. ""} ${unpatched_version}]
categories              graphics
platforms               darwin
license                 {BSD Apache-2.0}

maintainers             eborisch \
                        openmaintainer

description             The DICOM Toolkit.
long_description        DCMTK is a collection of libraries and applications    \
                        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. DCMTK is is written in a mixture of ANSI C    \
                        and C++. It comes in complete source code and is made  \
                        available as "open source" software.

homepage                http://dicom.offis.de/dcmtk

master_sites            ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk${stripped_version}/ \
                        http://dicom.offis.de/download/dcmtk/dcmtk${stripped_version}/

distname                ${name}-${unpatched_version}
distfiles               ${distname}${extract.suffix}

checksums               md5     19409e039e29a330893caea98715390e \
                        sha1    469e017cffc56f36e834aa19c8612111f964f757 \
                        rmd160  ad80a4b6cff9ed275e6153036bdce9e2d912721b

depends_lib             port:zlib 

patchfiles              patch-config-configure.diff

# To enable building while previous version is in ${prefix}

post-extract {
  reinplace "s|\$\(LDFLAGS\) \$\(LIBDIRS\)|\$(LIBDIRS) \$(LDFLAGS)|g" \
            ${worksrcpath}/dcmdata/apps/Makefile.in \
            ${worksrcpath}/dcmdata/libsrc/Makefile.in \
            ${worksrcpath}/dcmdata/tests/Makefile.in \
            ${worksrcpath}/dcmimage/apps/Makefile.in \
            ${worksrcpath}/dcmimgle/apps/Makefile.in \
            ${worksrcpath}/dcmjpeg/apps/Makefile.in \
            ${worksrcpath}/dcmjpls/apps/Makefile.in \
            ${worksrcpath}/dcmnet/apps/Makefile.in \
            ${worksrcpath}/dcmpstat/apps/Makefile.in \
            ${worksrcpath}/dcmpstat/jni/Makefile.in \
            ${worksrcpath}/dcmpstat/tests/Makefile.in \
            ${worksrcpath}/dcmqrdb/apps/Makefile.in \
            ${worksrcpath}/dcmsign/apps/Makefile.in \
            ${worksrcpath}/dcmsr/apps/Makefile.in \
            ${worksrcpath}/dcmsr/tests/Makefile.in \
            ${worksrcpath}/dcmwlm/apps/Makefile.in \
            ${worksrcpath}/dcmwlm/tests/Makefile.in \
            ${worksrcpath}/dcmwlm/wwwapps/Makefile.in \
            ${worksrcpath}/ofstd/tests/Makefile.in
}

configure.args-append   --without-libtiff \
                        --without-libpng \
                        --without-openssl \
                        --without-libxml

destroot.target-append  install-lib

use_parallel_build      no

if {${configure.compiler} == "clang"} {
   configure.compiler      llvm-gcc-4.2
}

variant private description "Install private tags dictionary" {
  configure.args-append --with-private-tags
}

variant doc description "Install html documentation" {
  destroot.target-delete install-lib
  destroot.target-append install-all
  depends_build-append  port:doxygen
}

variant png description "Enable png support" {
  depends_lib-append    port:libpng
  configure.args-delete --without-libpng  
}

variant ssl description "Enable openssl support" {
  depends_lib-append    port:openssl
  configure.args-delete --without-openssl  
}

variant tiff description "Enable tiff support" {
  depends_lib-append    port:tiff
  configure.args-delete --without-libtiff  
}

variant xml description "Enable xml support" {
  depends_lib-append    port:libxml2
  configure.args-delete --without-libxml  
}

default_variants        +png +ssl +tiff +xml

destroot.args           docdir=${prefix}/share/doc/${name}

livecheck.type          regex
livecheck.regex         {dcmtk\-(\d+(?:\.\d+)*).tar.gz}

