# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit toolchain-funcs inherit cvs DESCRIPTION="NLM Insight Segmentation and Registration Toolkit" HOMEPAGE="http://www.itk.org" SRC_URI="" LICENSE="BSD" SLOT="0" KEYWORDS="~x86" IUSE="doc examples patented" RDEPEND="sys-libs/zlib media-libs/jpeg media-libs/libpng media-libs/tiff" DEPEND="${RDEPEND} >=dev-util/cmake-2.0 dev-util/darcs" MY_PN=Insight S="${WORKDIR}/${MY_PN}" src_unpack() { ECVS_SERVER="www.itk.org:/cvsroot/Insight" ECVS_USER="anonymous" ECVS_PASS="insight" ECVS_AUTH="pserver" ECVS_MODULE="Insight" ECVS_TOP_DIR="${DISTDIR}/cvs-src/${ECVS_MODULE}" cvs_src_unpack ECVS_MODULE="CableSwig" cvs_src_unpack mv "${WORKDIR}/CableSwig" "${WORKDIR}/Insight/Utilities" } src_compile() { local CMAKE_VARIABLES="" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_INSTALL_PREFIX:PATH=/usr" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_SHARED_LIBS:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_TESTING:BOOL=OFF" if use examples; then CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_EXAMPLES:BOOL=ON" else CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_EXAMPLES:BOOL=OFF" fi if use patented; then CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_PATENTED:BOOL=ON" else CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_PATENTED:BOOL=OFF" fi # Give us an optimised release build CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO" # 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" # Suggested by http://wiki.bioimagexd.net/index.php?title=GettingStartedLinux CMAKE_VARIABLES="${CMAKE_VARIABLES} -DITK_USE_REVIEW:BOOL=ON " CMAKE_VARIABLES="${CMAKE_VARIABLES} -DUSE_WRAP_ITK:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_ITK_JAVA:BOOL=OFF " CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_ITK_TCL:BOOL=OFF" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_ITK_PYTHON:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_double:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_float:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_rgb_unsigned_short:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_unsigned_char:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_unsigned_long:BOOL=ON" CMAKE_VARIABLES="${CMAKE_VARIABLES} -DWRAP_unsigned_short:BOOL=ON" echo -n "cmake_vars:" echo ${CMAKE_VARIABLES} # Run CMake twice to configure properly with CMake 2.2.x cmake ${CMAKE_VARIABLES} . && cmake ${CMAKE_VARIABLES} . \ || die "cmake configuration failed" emake -j1 || die "emake failed" cd "${S}/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue" cmake . && cmake . \ || die "cmake configuration failed" emake -j1 || die "emake failed" cd "${S}/Wrapping/WrapITK/ExternalProjects/" darcs get --partial http://voxel.jouy.inra.fr/darcs/contrib-itk/labelShape/ cd "${S}/Wrapping/WrapITK/ExternalProjects/labelShape" cmake . && cmake . \ || die "cmake configuration failed" emake -j1 || die "emake failed" } src_install() { cd "${S}" make DESTDIR=${D} install || die "make install failed" # install the documentation if use doc; then mv README.html README-Overview.html dodoc "${S}"/README-Overview.html dodoc "${S}"/Documentation/DeveloperList.txt \ "${S}"/Documentation/InsightDeveloperStart.doc \ "${S}"/Documentation/InsightDeveloperStart.pdf \ "${S}"/Documentation/README.html \ "${S}"/Documentation/Style.pdf \ "${S}"/Documentation/itk.ico docinto Doxygen dodoc "${S}"/Documentation/Doxygen/*.dox \ "${S}"/Documentation/Doxygen/*.html \ "${S}"/Documentation/Doxygen/*.css docinto Art dodoc "${S}"/Documentation/Art/*gif \ "${S}"/Documentation/Art/*jpg \ "${S}"/Documentation/Art/*psd \ "${S}"/Documentation/Art/*xpm fi # install the examples if use examples; then # Copy Example sources dodir /usr/share/${MY_PN}/examples || \ die "Failed to create examples directory" cp -pPR ${S}/Examples ${D}/usr/share/${MY_PN}/examples/src || \ die "Failed to copy example files" # copy binary examples cp -pPR ${S}/bin ${D}/usr/share/${MY_PN}/examples || \ die "Failed to copy binary example files" rm -rf ${D}/usr/share/${MY_PN}/examples/bin/*.so || \ die "Failed to remove libraries from examples directory" # fix examples permissions find ${D}/usr/share/${MY_PN}/examples -type d -exec \ chmod 0755 {} \; || \ die "Failed to fix example directories permissions" find ${D}/usr/share/${MY_PN}/examples -type f -exec \ chmod 0644 {} \; || \ die "Failed to fix example files permissions" fi cd "${S}/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue" make DESTDIR=${D} install || die "make install failed" cd "${S}/Wrapping/WrapITK/ExternalProjects/labelShape" make DESTDIR=${D} install || die "make install failed" cd "${S}" 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.itk.org/HTML/Copyright.htm" ewarn "http://www.itk.org/Wiki/ITK_Patent_Bazaar" fi }