]> git.sthu.org Git - shuber-gentoo-overlay.git/blob - itk-4.4.2-r1.ebuild
5671bb01758060eacc03e086d7a6838e03cc7ee2
[shuber-gentoo-overlay.git] / itk-4.4.2-r1.ebuild
1 # Copyright 2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python{2_5,2_6,2_7} )
8
9 inherit eutils toolchain-funcs cmake-utils python-single-r1
10
11 MYP=InsightToolkit-${PV}
12
13 DESCRIPTION="NLM Insight Segmentation and Registration Toolkit"
14 HOMEPAGE="http://www.itk.org"
15 SRC_URI="mirror://sourceforge/${PN}/${MYP}.tar.gz"
16
17 RESTRICT="primaryuri"
18
19 LICENSE="Apache-2.0"
20 SLOT="0"
21 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
22 IUSE="debug examples fftw itkv3compat python review sse2 test vtkglue"
23
24 RDEPEND="
25 sci-libs/hdf5[cxx]
26 virtual/jpeg
27 media-libs/libpng
28 media-libs/tiff:0
29 sys-libs/zlib
30 fftw? ( sci-libs/fftw:3.0 )
31 vtkglue? ( sci-libs/vtk )
32 "
33 DEPEND="${RDEPEND}
34 python? ( ${PYTHON_DEPS}
35 >=dev-lang/swig-2.0
36 >=dev-cpp/gccxml-0.9.0_pre20120309 )
37 "
38
39 S="${WORKDIR}/${MYP}"
40
41 pkg_pretend() {
42 if [[ -z ${ITK_COMPUTER_MEMORY_SIZE} ]]; then
43 elog "To tune ITK to make the best use ouf working memory you can set"
44 elog " ITK_COMPUTER_MEMORY_SIZE=XX"
45 elog "in make.conf, default is 1 (unit is GB)"
46 fi
47 if use python && [[ -z ${ITK_WRAP_DIMS} ]]; then
48 elog "For Python language bindings, you can define the dimensions"
49 elog "you want to create bindings for by setting"
50 elog " ITK_WRAP_DIMS=X;Y;Z..."
51 elog "in make.conf, default is 2;3 for 2D and 3D data"
52 fi
53 }
54
55 src_configure() {
56 local mycmakeargs=(
57 -DWRAP_ITK_JAVA=OFF
58 -DWRAP_ITK_TCL=OFF
59 -DITK_USE_SYSTEM_HDF5=ON
60 -DITK_USE_SYSTEM_JPEG=ON
61 -DITK_USE_SYSTEM_PNG=ON
62 -DITK_USE_SYSTEM_TIFF=ON
63 -DITK_USE_SYSTEM_ZLIB=ON
64 -DITK_USE_SYSTEM_GCCXML=ON
65 -DITK_USE_SYSTEM_SWIG=ON
66 -DITK_BUILD_ALL_MODULES=ON
67 -DBUILD_SHARED_LIBS=ON
68 -DBUILD_EXAMPLES=OFF
69 -DITK_COMPUTER_MEMORY_SIZE="${ITK_COMPUTER_MEMORY_SIZE:-1}"
70 $(cmake-utils_use_build test TESTING)
71 $(cmake-utils_use review ITK_USE_REVIEW)
72 $(cmake-utils_use itkv3compat ITKV3_COMPATIBILITY)
73 $(cmake-utils_use sse2 VNL_CONFIG_ENABLE_SSE2)
74 )
75 if use fftw; then
76 mycmakeargs+=(
77 -DUSE_FFTWD=ON
78 -DUSE_FFTWF=ON
79 -DUSE_SYSTEM_FFTW=ON
80 -DITK_WRAP_double=ON
81 -DITK_WRAP_vector_double=ON
82 -DITK_WRAP_covariant_vector_double=ON
83 -DITK_WRAP_complex_double=ON
84 )
85 fi
86 if use vtkglue; then
87 mycmakeargs+=(
88 -DModule_ITKVtkGlue=ON
89 )
90 fi
91 if use python; then
92 mycmakeargs+=(
93 -DITK_WRAP_PYTHON=ON
94 -DITK_WRAP_DIMS="${ITK_WRAP_DIMS:-2;3}"
95 )
96 else
97 mycmakeargs+=(
98 -DITK_WRAP_PYTHON=OFF
99 )
100 fi
101 cmake-utils_src_configure
102 }
103
104 src_install() {
105 cmake-utils_src_install
106
107 if use examples; then
108 insinto /usr/share/doc/${PF}/examples
109 docompress -x /usr/share/doc/${PF}/examples
110 doins -r "${S}"/Examples/*
111 fi
112
113 echo "ITK_DATA_ROOT=${EROOT}/usr/share/${PN}/data" > ${T}/40${PN}
114 local ldpath="${EROOT}/usr/$(get_libdir)/InsightToolkit"
115 if use python; then
116 echo "PYTHONPATH=${EROOT}/usr/$(get_libdir)/InsightToolkit/WrapITK/Python" >> ${T}/40${PN}
117 ldpath="${ldpath}:${EROOT}/usr/$(get_libdir)/InsightToolkit/WrapITK/lib"
118 fi
119 echo "LDPATH=${ldpath}" >> ${T}/40${PN}
120
121 doenvd "${T}"/40${PN}
122 }