From 2a156e2f4f0e1ad325b3c9aa5bb5a6b313594b69 Mon Sep 17 00:00:00 2001 From: Mario Ceresa Date: Oct 29 2010 09:46:23 +0000 Subject: Initial import (#566725). --- diff --git a/.gitignore b/.gitignore index e69de29..c46a9a9 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/gdcm-2.0.16.tar.bz2 diff --git a/FindCharLS.cmake b/FindCharLS.cmake new file mode 100644 index 0000000..eaa45b7 --- /dev/null +++ b/FindCharLS.cmake @@ -0,0 +1,34 @@ +FIND_PATH(CHARLS_INCLUDE_DIR CharLS/interface.h +/usr/local/include +/usr/include +) + +FIND_LIBRARY(CHARLS_LIBRARY + NAMES CharLS + PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 + ) + + +IF (CHARLS_LIBRARY AND CHARLS_INCLUDE_DIR) + SET(CHARLS_LIBRARIES ${CHARLS_LIBRARY}) + SET(CHARLS_INCLUDE_DIRS ${CHARLS_INCLUDE_DIR}) + SET(CHARLS_FOUND "YES") +ELSE (CHARLS_LIBRARY AND CHARLS_INCLUDE_DIR) + SET(CHARLS_FOUND "NO") +ENDIF (CHARLS_LIBRARY AND CHARLS_INCLUDE_DIR) + + +IF (CHARLS_FOUND) + IF (NOT CHARLS_FIND_QUIETLY) + MESSAGE(STATUS "Found CHARLS: ${CHARLS_LIBRARIES}") + ENDIF (NOT CHARLS_FIND_QUIETLY) +ELSE (CHARLS_FOUND) + IF (CHARLS_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find CHARLS library") + ENDIF (CHARLS_FIND_REQUIRED) +ENDIF (CHARLS_FOUND) + +MARK_AS_ADVANCED( + CHARLS_LIBRARIES + CHARLS_INCLUDE_DIR + ) diff --git a/gdcm-2.0.14-inplacebuild.patch b/gdcm-2.0.14-inplacebuild.patch new file mode 100644 index 0000000..3a36994 --- /dev/null +++ b/gdcm-2.0.14-inplacebuild.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt 2009-11-12 23:09:48.000000000 +0100 ++++ CMakeLists2.txt 2010-02-05 18:08:06.000000000 +0100 +@@ -38,10 +38,7 @@ + STRING(COMPARE EQUAL "${GDCM_SOURCE_DIR}" "${GDCM_BINARY_DIR}" INSOURCE) + GET_FILENAME_COMPONENT(PARENTDIR ${GDCM_BINARY_DIR} PATH) + STRING(COMPARE EQUAL "${GDCM_SOURCE_DIR}" "${PARENTDIR}" INSOURCESUBDIR) +-IF(INSOURCE OR INSOURCESUBDIR) +- MESSAGE(FATAL_ERROR "GDCM requires an out of source Build. " +- "Please create a separate binary directory and run CMake there.") +-ENDIF(INSOURCE OR INSOURCESUBDIR) ++ + + #----------------------------------------------------------------------------- + SET(GDCM_MAJOR_VERSION 2) diff --git a/gdcm-2.0.14-use_system_charls.patch b/gdcm-2.0.14-use_system_charls.patch new file mode 100644 index 0000000..7541749 --- /dev/null +++ b/gdcm-2.0.14-use_system_charls.patch @@ -0,0 +1,101 @@ +--- CMakeLists.txt 2010-02-19 19:18:30.000000000 +0100 ++++ CMakeLists2.txt 2010-02-19 19:21:51.000000000 +0100 +@@ -197,7 +197,7 @@ + + IF(NOT GDCM_INSTALL_LIB_DIR) + #SET(GDCM_INSTALL_LIB_DIR "lib/${PROJECT_NAME}") +- SET(GDCM_INSTALL_LIB_DIR "lib") ++ SET(GDCM_INSTALL_LIB_DIR "lib${LIB_SUFFIX}") + ENDIF(NOT GDCM_INSTALL_LIB_DIR) + + IF(NOT GDCM_INSTALL_DATA_DIR) +@@ -261,6 +261,11 @@ + OPTION(GDCM_USE_SYSTEM_EXPAT "Use system expat" OFF) + OPTION(GDCM_USE_SYSTEM_LJPEG "Use system ljpeg (ijg lib)" OFF) + OPTION(GDCM_USE_SYSTEM_OPENJPEG "Use system openjpeg (1.x)" OFF) ++IF(GDCM_USE_JPEGLS) ++ OPTION(GDCM_USE_SYSTEM_JPEGLS "Use system JPEGLS (CharLS)" OFF) ++ MARK_AS_ADVANCED(GDCM_USE_SYSTEM_JPEGLS) ++ENDIF(GDCM_USE_JPEGLS) ++ + MARK_AS_ADVANCED(GDCM_USE_SYSTEM_ZLIB GDCM_USE_SYSTEM_UUID GDCM_USE_SYSTEM_EXPAT GDCM_USE_SYSTEM_OPENSSL) + MARK_AS_ADVANCED(GDCM_USE_SYSTEM_OPENJPEG GDCM_USE_SYSTEM_LJPEG) + OPTION(GDCM_USE_SYSTEM_POPPLER "Use system poppler (pdf)" OFF) +@@ -283,6 +288,14 @@ + SET(GDCM_OPENJPEG_LIBRARIES gdcmopenjpeg) + ENDIF(GDCM_USE_SYSTEM_OPENJPEG) + ++IF(GDCM_USE_SYSTEM_JPEGLS) ++ FIND_PACKAGE(CharLS REQUIRED) ++ SET(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES}) ++ELSE(GDCM_USE_SYSTEM_JPEGLS) ++ SET(GDCM_CHARLS_LIBRARIES gdcmcharls) ++ENDIF(GDCM_USE_SYSTEM_JPEGLS) ++ ++ + # Very advanced user option: + # This will cause building of the broken JPEG library released by the Standford PVRG group: + OPTION(GDCM_USE_PVRG "Use pvrg lib, only turn it on if you know what you are doing." OFF) + +--- Utilities/CMakeLists.txt 2009-11-12 23:09:48.000000000 +0100 ++++ Utilities/CMakeLists2.txt 2010-02-19 19:21:59.000000000 +0100 +@@ -35,12 +35,14 @@ + # Do jpegls (JPEG-LS aka near lossless implementation) + APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmcharls/License.txt) + IF(GDCM_USE_JPEGLS) +- SET(CHARLS_NAMESPACE "GDCMCHARLS") +- SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES}) +- SET(CHARLS_INSTALL_BIN_DIR ${GDCM_INSTALL_BIN_DIR}) +- SET(CHARLS_INSTALL_LIB_DIR ${GDCM_INSTALL_LIB_DIR}) +- SET(CHARLS_INSTALL_INCLUDE_DIR ${GDCM_INSTALL_INCLUDE_DIR}) +- SUBDIRS(gdcmcharls) ++ IF(NOT GDCM_USE_SYSTEM_JPEGLS) ++ SET(CHARLS_NAMESPACE "GDCMCHARLS") ++ SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES}) ++ SET(CHARLS_INSTALL_BIN_DIR ${GDCM_INSTALL_BIN_DIR}) ++ SET(CHARLS_INSTALL_LIB_DIR ${GDCM_INSTALL_LIB_DIR}) ++ SET(CHARLS_INSTALL_INCLUDE_DIR ${GDCM_INSTALL_INCLUDE_DIR}) ++ SUBDIRS(gdcmcharls) ++ ENDIF(NOT GDCM_USE_SYSTEM_JPEGLS) + ENDIF(GDCM_USE_JPEGLS) + + # Do md5 +--- Source/MediaStorageAndFileFormat/CMakeLists.txt 2009-11-12 23:09:48.000000000 +0100 ++++ Source/MediaStorageAndFileFormat/CMakeLists2.txt 2010-02-19 19:22:23.000000000 +0100 +@@ -132,7 +132,7 @@ + TARGET_LINK_LIBRARIES(gdcmMSFF gdcmIOD gdcmDSED gdcmDICT ${GDCM_LJPEG_LIBRARIES} ${GDCM_OPENJPEG_LIBRARIES}) + SET_TARGET_PROPERTIES(gdcmMSFF PROPERTIES ${GDCM_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "gdcmDSED;gdcmDICT;gdcmIOD") + IF(GDCM_USE_JPEGLS) +- TARGET_LINK_LIBRARIES(gdcmMSFF gdcmcharls) ++ TARGET_LINK_LIBRARIES(gdcmMSFF ${GDCM_CHARLS_LIBRARIES}) + ENDIF(GDCM_USE_JPEGLS) + + IF(CMAKE_COMPILER_IS_GNUCXX AND MINGW) +--- Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx 2009-11-12 23:09:48.000000000 +0100 ++++ Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec2.cxx 2010-02-19 19:22:09.000000000 +0100 +@@ -18,6 +18,16 @@ + #include "gdcmDataElement.h" + + // CharLS includes ++#ifdef GDCM_USE_SYSTEM_EXPAT ++#include "CharLS/stdafx.h" // sigh... ++#include "CharLS/interface.h" ++#include "CharLS/util.h" ++#include "CharLS/defaulttraits.h" ++#include "CharLS/losslesstraits.h" ++#include "CharLS/colortransform.h" ++#include "CharLS/streams.h" ++#include "CharLS/processline.h" ++#else + #include "gdcmcharls/stdafx.h" // sigh... + #include "gdcmcharls/interface.h" + #include "gdcmcharls/util.h" +@@ -26,6 +36,8 @@ + #include "gdcmcharls/colortransform.h" + #include "gdcmcharls/streams.h" + #include "gdcmcharls/processline.h" ++#endif ++ + + + namespace gdcm diff --git a/gdcm-2.0.14-usecopyright.patch b/gdcm-2.0.14-usecopyright.patch new file mode 100644 index 0000000..2a3fdb8 --- /dev/null +++ b/gdcm-2.0.14-usecopyright.patch @@ -0,0 +1,15 @@ +--- CMake/UseCopyright.cmake 2009-11-12 23:09:48.000000000 +0100 ++++ CMake/UseCopyright2.cmake 2010-02-17 13:24:09.000000000 +0100 +@@ -18,8 +18,10 @@ + # need to raise an error if COPYRIGHT_MODULE_FILENAME is not set... + IF(EXISTS ${COPYRIGHT_MODULE_FILENAME} ) + FOREACH(filename ${ARGN}) +- FILE(READ ${filename} content) +- FILE(APPEND ${COPYRIGHT_MODULE_FILENAME} ${content}) ++ IF(EXISTS ${filename} ) ++ FILE(READ ${filename} content) ++ FILE(APPEND ${COPYRIGHT_MODULE_FILENAME} ${content}) ++ ENDIF(EXISTS ${filename} ) + ENDFOREACH(filename) + ENDIF(EXISTS ${COPYRIGHT_MODULE_FILENAME} ) + ENDMACRO(APPEND_COPYRIGHT) diff --git a/gdcm.spec b/gdcm.spec new file mode 100644 index 0000000..2ae0473 --- /dev/null +++ b/gdcm.spec @@ -0,0 +1,225 @@ +# we don't want to provide private python extension libs +%{?filter_setup: +%filter_provides_in %{python_sitearch}/.*\.so$ +%filter_setup +} + +%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + +Name: gdcm +Version: 2.0.16 +Release: 5%{?dist} +Summary: Grassroots DiCoM is a C++ library to parse DICOM medical files +Group: Development/Libraries +License: BSD +URL: http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=Main_Page +Source0: http://download.sourceforge.net/project/gdcm/gdcm%202.x/GDCM%202.0.16/gdcm-2.0.16.tar.bz2 +#Source1: http://downloads.sourceforge.net/project/gdcm/gdcmData/gdcmData/gdcmData.tar.bz2 +Source2: FindCharLS.cmake +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# There is a bug in doxygen preventing compilation on: +ExcludeArch: ppc ppc64 + +Patch1: gdcm-2.0.14-inplacebuild.patch +Patch2: gdcm-2.0.14-usecopyright.patch +Patch3: gdcm-2.0.14-use_system_charls.patch + +BuildRequires: cmake >= 2.6.0 +BuildRequires: openssl-devel +BuildRequires: libuuid-devel +BuildRequires: expat-devel +BuildRequires: openjpeg-devel +BuildRequires: poppler-devel +BuildRequires: mesa-libOSMesa-devel +BuildRequires: fontconfig-devel +BuildRequires: doxygen +BuildRequires: CharLS-devel +BuildRequires: texlive-latex +BuildRequires: graphviz +BuildRequires: python2-devel +BuildRequires: swig + + +%description +GDCM implements the dicom base standard part 5 that concentrates on image file +format. Hence GDCM supports the following formats: +- ACR-NEMA version 1 and 2 (huffman compression is not supported), +- DICOM version 3.0, including various encodings of JPEG - lossless & lossy-, +RLE, J2K, deflated, JPEG-LS (very experimental) (MPEG2 compression is not +supported) +- Papyrus V2 and V3 file headers should be readable, + +%package devel +Summary: Libraries and headers for GDCM +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel + +You should install the gdcm-devel package if you would like to +compile applications based on gdcm + +%package python +Summary: Python binding for GDCM +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description python + +You should install the gdcm-python package if you would like to +used this library with python + + + +%prep +%setup -q +%patch1 +%patch2 +%patch3 + +# Remove bundled utilities (we use Fedora's ones) + +rm -rf Utilities/gdcmexpat +rm -rf Utilities/gdcmopenjpeg +rm -rf Utilities/gdcmzlib +rm -rf Utilities/gdcmuuid +rm -rf Utilities/gdcmcharls + +# Remove bundled utilities (we don't use them) +rm -rf Utilities/gdcmmd5 +rm -rf Utilities/getopt +rm -rf Utilities/pvrg +rm -rf Utilities/rle +rm -rf Utilities/wxWidgets + +cp %{SOURCE2} CMake/ + +%build +%cmake -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_SKIP_RPATH:BOOL=YES \ + -DGDCM_BUILD_TESTING=OFF \ + -DGDCM_BUILD_EXAMPLES:BOOL=ON \ + -DGDCM_DOCUMENTATION:BOOL=ON \ + -DGDCM_PDF_DOCUMENTATION:BOOL=ON \ + -DGDCM_WRAP_PYTHON:BOOL=ON \ + -DGDCM_WRAP_JAVA=OFF \ + -DGDCM_BUILD_SHARED_LIBS:BOOL=ON \ + -DGDCM_BUILD_APPLICATIONS:BOOL=ON \ + -DCMAKE_BUILD_TYPE:STRING="Release" \ + -DGDCM_USE_VTK:BOOL=OFF \ + -DGDCM_USE_SYSTEM_EXPAT=ON \ + -DGDCM_USE_SYSTEM_OPENJPEG=ON \ + -DGDCM_USE_SYSTEM_ZLIB=ON \ + -DGDCM_USE_SYSTEM_UUID=ON \ + -DGDCM_USE_SYSTEM_LJPEG=OFF \ + -DGDCM_USE_SYSTEM_OPENSSL=ON \ + -DGDCM_USE_JPEGLS=ON \ + -DGDCM_USE_SYSTEM_JPEGLS=ON \ + -DGDCM_USE_SYSTEM_POPPLER=ON . + +#Cannot build wrap_java: +# -DGDCM_VTK_JAVA_JAR:PATH=/usr/share/java/vtk.jar no found! +# yum provides */vtk.jar -> No results found + +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + +install -d $RPM_BUILD_ROOT%{python_sitelib}/ +mv $RPM_BUILD_ROOT%{_libdir}/gdcm.py $RPM_BUILD_ROOT%{python_sitelib}/ +mv $RPM_BUILD_ROOT%{_libdir}/gdcmswig.py $RPM_BUILD_ROOT%{python_sitelib}/ +mv $RPM_BUILD_ROOT%{_libdir}/_gdcmswig.so $RPM_BUILD_ROOT%{python_sitelib}/ + + +## Rearranging directory layout and removing version from dir +mv $RPM_BUILD_ROOT%{_datadir}/gdcm-2.0 $RPM_BUILD_ROOT%{_datadir}/gdcm +mv $RPM_BUILD_ROOT%{_libdir}/gdcm-2.0/*.cmake $RPM_BUILD_ROOT%{_datadir}/gdcm/ +rmdir $RPM_BUILD_ROOT%{_libdir}/gdcm-2.0/ +mv $RPM_BUILD_ROOT%{_includedir}/gdcm-2.0 $RPM_BUILD_ROOT%{_includedir}/gdcm + +## Cleaning Example dir from cmake cache files + remove 0-lenght files +find %{_builddir}/%{?buildsubdir}/Examples -depth -name CMakeFiles | xargs rm -rf +find %{_builddir}/%{?buildsubdir}/Examples -depth -size 0 | xargs rm -rf + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc %{_mandir}/man1/*.1* +%doc AUTHORS Copyright.txt README.Copyright.txt README.txt +%dir %{_datadir}/gdcm/ +%{_bindir}/* +%{_libdir}/*.so.* +%{_datadir}/gdcm/XML + +%check +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bin +ctest . + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files devel +%defattr(-,root,root) +%dir %{_includedir}/gdcm/ +%doc Examples +%{_includedir}/gdcm/* +%{_libdir}/*.so +%{_datadir}/gdcm/*.cmake + +%files python +%defattr(-,root,root,-) +%{python_sitelib}/* + +%changelog +* Tue Oct 19 2010 Mario Ceresa 2.0.16-5 +- Filtered out private python extension lib +- Added documentation + +* Tue Oct 19 2010 Mario Ceresa 2.0.16-4 +- Changed directory ownership + +* Fri Oct 15 2010 Mario Ceresa 2.0.16-3 +- Rearranged directory layout to remove version in dir names + +* Sat Sep 18 2010 Mario Ceresa 2.0.16-2 +- Added ExcludeArch for ppc and ppc64 because of a bug in doxygen +see https://bugzilla.redhat.com/show_bug.cgi?id=566725#c9 + +* Sat Sep 18 2010 Mario Ceresa 2.0.16-1 +- Updated to release 2.0.16 +- Removed patch "stack_namespace" and "poppler_breaks_api" because +already included upstream +- Added swig and texlive-pdflatex to BuildRequires +- Moved python files to a separate package + +* Sun Apr 11 2010 Mario Ceresa 2.0.14-5 +- Fixed some issues pointed out by Martin Gieseking. In details: +- BR to build documentation (tex + graphviz) +- Changed man page inclusion +- Fixed changelog format +- Removed VTK support because cmake 2.8 is needed to recognize vtk 5.4! +- Fixed python support + +* Thu Mar 25 2010 Mario Ceresa 2.0.14-4 +- Added VTK support +- Added python support + +* Mon Mar 21 2010 Mario Ceresa 2.0.14-3 +- Added BuildRequires fontconfig-devel +- Fixed lib /lib64 issue with base CMakeLists.txt + +* Mon Mar 15 2010 Mario Ceresa 2.0.14-2 +- Added BuildRequires CharLS-devel + +* Wed Feb 17 2010 Mario Ceresa 2.0.14 +- Initial RPM Release + diff --git a/sources b/sources index e69de29..c08ca74 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +e9e8e7703bedef939d7dc88350c25691 gdcm-2.0.16.tar.bz2