File dcmtk.spec of Package dcmtk

#
# spec file for package dcmtk
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libname libdcmtk3_6

Name:           dcmtk
Version:        3.6.0
Release:        0
Summary:        DICOM Toolkit
License:        BSD-3-Clause and Apache-2.0
Group:          Productivity/Scientific/Other
Url:            http://dicom.offis.de/dcmtk.php.en
Source0:        ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0001-Added-soname-information-for-all-targets.patch asterios.dramis@gmail.com -- Add soname information for all targets
Patch0:         dcmtk-3.6.0-0001-Added-soname-information-for-all-targets.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0002-Install-libs-in-the-correct-arch-dir.patch asterios.dramis@gmail.com -- Install libs in the correct arch dir
Patch1:         dcmtk-3.6.0-0002-Install-libs-in-the-correct-arch-dir.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0003-Removed-bundled-libcharl-reference-in-dcmjpls.patch asterios.dramis@gmail.com -- Removed bundled libcharl reference in dcmjpls
Patch2:         dcmtk-3.6.0-0003-Removed-bundled-libcharl-reference-in-dcmjpls.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0004-Use-system-charls.patch asterios.dramis@gmail.com -- Use system charls
Patch3:         dcmtk-3.6.0-0004-Use-system-charls.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0005-Fixed-includes-for-CharLS-1.0.patch asterios.dramis@gmail.com -- Fix includes for CharLS 1.0
Patch4:         dcmtk-3.6.0-0005-Fixed-includes-for-CharLS-1.0.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0006-Added-optional-support-for-building-shared-libraries.patch asterios.dramis@gmail.com -- Add optional support for building shared libraries with CMake
Patch5:         dcmtk-3.6.0-0006-Added-optional-support-for-building-shared-libraries.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0-0007-Add-soname-generation-for-modules-which-are-not-in-D.patch asterios.dramis@gmail.com -- Add soname generation for modules which are not in DCMTK_MODULES variable
Patch6:         dcmtk-3.6.0-0007-Add-soname-generation-for-modules-which-are-not-in-D.patch
# PATCH-FIX-OPENSUSE dcmtk-3.6.0.diff asterios.dramis@gmail.com -- Fix libraries linking
Patch7:         dcmtk-3.6.0.diff
# PATCH-FIX-UPSTREAM gcc-4.7_fix.patch asterios.dramis@gmail.com -- Fix compilation with gcc-4.7
Patch8:         gcc-4.7_fix.patch
BuildRequires:  CharLS-devel
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libopenssl-devel
BuildRequires:  libpng-devel
BuildRequires:  libsndfile-devel
BuildRequires:  libtiff-devel
BuildRequires:  tcpd-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(libxml-2.0)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
DCMTK is a collection of libraries and applications implementing large
parts the DICOM standard.

%package devel
Summary:        Development files for dcmtk
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}

%description devel
This package provides development libraries and headers needed to build
software using dcmtk.

%package -n %{libname}
Summary:        DICOM Toolkit
Group:          System/Libraries

%description -n %{libname}
DCMTK is a collection of libraries and applications implementing large
parts the DICOM standard.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8 -p1

# Make sure the internal library copy is not used
rm -rf dcmjpls/libcharls/

%build
mkdir build
cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
 cmake \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DINSTALL_DOCDIR=%{_docdir}/dcmtk \
 -DINSTALL_HTMDIR=%{_docdir}/dcmtk/html \
 -DBUILD_SHARED_LIBS=ON \
 %if "%{_lib}" == "lib64"
  -DLIB_SUFFIX=64 \
 %endif
 -DDCMTK_WITH_XML=ON \
 -DDCMTK_WITH_OPENSSL=ON \
 -DDCMTK_WITH_SNDFILE=ON \
 -DDCMTK_WITH_ZLIB=ON \
 -DDCMTK_WITH_CHARLS=ON \
 -DCMAKE_BUILD_TYPE=release ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
cd build
%make_install
cd ..

# Remove zero-length file (fix rpmlint warning)
rm -f %{buildroot}%{_datadir}/dcmtk/wlistdb/OFFIS/lockfile

# Fix binary name
mv -f %{buildroot}%{_bindir}/dcmsign-3.6.0 %{buildroot}%{_bindir}/dcmsign

# Move configuration files from /usr/etc to /etc/
mv %{buildroot}%{_prefix}/etc %{buildroot}

# Move doc files from /usr/share/doc/dcmtk to /usr/share/doc/packages/dcmtk/
mkdir %{buildroot}%{_docdir}
mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{_docdir}

# Install README file to documentation
install -pm 0644 README %{buildroot}%{_docdir}/dcmtk/

%fdupes -s %{buildroot}

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/dcmtk
%config(noreplace) %{_sysconfdir}/dcmtk/*.cfg
%{_bindir}/*
%{_datadir}/dcmtk/
%doc %{_docdir}/dcmtk/

%files devel
%defattr(-,root,root,-)
%{_includedir}/dcmtk/
%{_libdir}/*.so

%files -n %{libname}
%defattr(-,root,root,-)
%{_libdir}/*.so.3.6*

%changelog
openSUSE Build Service is sponsored by