# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit distutils eutils flag-o-matic toolchain-funcs versionator DESCRIPTION="NLM Insight Segmentation and Registration Toolkit" HOMEPAGE="http://www.itk.org" SRC_URI="mirror://sourceforge/${PN}/InsightToolkit-${PV}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="patented" DEPEND="sys-libs/zlib media-libs/jpeg media-libs/libpng media-libs/tiff" RDEPEND="${RDEPEND} >=dev-util/cmake-1.8" MY_PV=$(replace_all_version_separators '-') S=${WORKDIR}/InsightToolkit-${MY_PV} src_compile() { # Patch some issues with gcc-4.1 if [ "$(gcc-major-version)" -eq 4 -a "$(gcc-minor-version)" -eq 1 ]; then epatch "${FILESDIR}"/itk-2.4.1-gcc4.1.patch fi # Out of source build mkdir my_build && cd my_build # Install path prefix, prepended onto install directories CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_INSTALL_PREFIX:PATH=/usr" # Build ITK with shared libraries CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_SHARED_LIBS:BOOL=ON" # Don't bother building the testing tree CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_TESTING:BOOL=OFF" # Don't build examples now (let the user later) CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_EXAMPLES:BOOL=OFF" # Give us an optimised release build CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO" # We do not want rpath enabled CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_SKIP_RPATH:BOOL=ON" # Use the system libraries for these CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_SYSTEM_JPEG:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_SYSTEM_PNG:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_SYSTEM_TIFF:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_SYSTEM_ZLIB:BOOL=ON" use patented && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_PATENTED:BOOL=ON" # Run CMake twice to configure properly with CMake 2.2.x cmake ${CMAKE_VARIABLES} .. && cmake ${CMAKE_VARIABLES} .. \ || die "CMake configuration failed" emake || die "emake failed" } src_install() { # Return to our build directory cd my_build # Do install make DESTDIR=${D} install || die "make install failed" # Fix configuration file sed -i -e "s:${D}:/:g" ${D}/usr/lib/${PN}/ITKConfig.cmake LDPATH="/usr/lib/InsightToolkit" echo "LDPATH=${LDPATH}" > ${T}/40${PN} echo "ITK_DATA_ROOT=/usr/share/${PN}/data" >> ${T}/40${PN} doenvd ${T}/40${PN} } pkg_postinst() { if use patented; then ewarn "Using patented code in ITK may require a license." ewarn "For more information, please read:" ewarn "http://www.vtk.org/Wiki/ITK_Patent_Bazaar" fi }