Skip to content

Instantly share code, notes, and snippets.

@holgersson32644
Created September 21, 2017 19:01
Show Gist options
  • Save holgersson32644/d5a5a7e21fd70f5191e49df8de7a0850 to your computer and use it in GitHub Desktop.
Save holgersson32644/d5a5a7e21fd70f5191e49df8de7a0850 to your computer and use it in GitHub Desktop.
bumped ebuild, WIP
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI="6"
PYTHON_COMPAT=( python{2_5,2_6,2_7} )
inherit eutils toolchain-funcs cmake-multilib python-single-r1
MYPN=InsightToolkit
MYP=${MYPN}-${PV}
DOC_PV=4.10.0
DESCRIPTION="NLM Insight Segmentation and Registration Toolkit"
HOMEPAGE="http://www.itk.org"
SRC_URI="mirror://sourceforge/${PN}/${MYP}.tar.xz
doc? ( mirror://sourceforge/${PN}/InsightDoxygenDocHtml-${DOC_PV}.tar.gz )"
RESTRICT="primaryuri"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="debug doc examples fftw itkv3compat python review test vtkglue"
# CPU_FLAGS_X86 in a format easy expandable later (idea copied from eigen::gentoo)
IUSE_CPU_FLAGS_X86=" sse2"
IUSE+=" ${IUSE_CPU_FLAGS_X86// / cpu_flags_x86_}"
RDEPEND="dev-libs/double-conversion:0=
media-libs/libpng:0=
media-libs/tiff:0=
sci-libs/dcmtk
dev-libs/expat
sci-libs/gdcm
sci-libs/nifticlib
sci-libs/hdf5:0=[cxx]
sys-libs/zlib:0=
virtual/jpeg:0=
fftw? ( sci-libs/fftw:3.0= )
vtkglue? ( sci-libs/vtk:0=[python?] )"
DEPEND="${RDEPEND}
python? ( ${PYTHON_DEPS}
>=dev-lang/swig-3.0
>=dev-cpp/CastXML-0.0.0_pre1 )
doc? ( app-doc/doxygen )"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
S="${WORKDIR}/${MYP}"
PATCHES=(
"${FILESDIR}/atomic_load.patch"
"${FILESDIR}/flatStructuringElementTest_fix_rescale.patch"
"${FILESDIR}/ITKv3MultiResImageRegistrationTest_correct.patch"
"${FILESDIR}/itk4.10-enable-system-nifti.patch"
)
pkg_pretend() {
if [[ -z ${ITK_COMPUTER_MEMORY_SIZE} ]]; then
elog "To tune ITK to make the best use of working memory you can set"
elog " ITK_COMPUTER_MEMORY_SIZE=XX"
elog "in make.conf, default is 1 (unit is GB)"
fi
if use python && [[ -z ${ITK_WRAP_DIMS} ]]; then
elog "For Python language bindings, you can define the dimensions"
elog "you want to create bindings for by setting"
elog " ITK_WRAP_DIMS=X;Y;Z..."
elog "in make.conf, default is 2;3 for 2D and 3D data"
fi
}
src_configure() {
local mycmakeargs=(
-DBUILD_SHARED_LIBS=ON
-DITK_USE_SYSTEM_DCMTK=ON
-DITK_USE_SYSTEM_DOUBLECONVERSION=ON
-DITK_USE_SYSTEM_EXPAT=ON
-DITK_USE_SYSTEM_GDCM=ON
-DITK_USE_SYSTEM_HDF5=ON
-DITK_USE_SYSTEM_JPEG=ON
-DITK_USE_SYSTEM_PNG=ON
-DITK_USE_SYSTEM_TIFF=ON
-DITK_USE_SYSTEM_ZLIB=ON
-DITK_BUILD_DEFAULT_MODULES=ON
-DITK_FORBID_DOWNLOADS=ON
-DITK_COMPUTER_MEMORY_SIZE="${ITK_COMPUTER_MEMORY_SIZE:-1}"
-DModule_ITKDCMTK=ON
-DModule_ITKIODCMTK=OFF
-DITK_FORBID_DOWNLOADS=ON
-DITK_WRAP_JAVA=OFF
-DITK_WRAP_TCL=OFF
-DBUILD_TESTING="$(usex test)"
-DBUILD_EXAMPLES="$(usex examples)"
-DModule_ITKReview="$(usex review)"
-DITKV3_COMPATIBILITY="$(usex itkv3compat)"
-DBUILD_EXAMPLES="$(usex examples)"
-DVNL_CONFIG_ENABLE_SSE2="$(usex cpu_flags_x86_sse2)"
)
if use fftw; then
mycmakeargs+=(
-DUSE_FFTWD=ON
-DUSE_FFTWF=ON
-DUSE_SYSTEM_FFTW=ON
-DITK_WRAP_double=ON
-DITK_WRAP_vector_double=ON
-DITK_WRAP_covariant_vector_double=ON
-DITK_WRAP_complex_double=ON
)
fi
if use vtkglue; then
mycmakeargs+=(
-DModule_ITKVtkGlue=ON
)
fi
if use python; then
mycmakeargs+=(
-DITK_WRAP_PYTHON=ON
-DITK_WRAP_DIMS="${ITK_WRAP_DIMS:-2;3}"
)
else
mycmakeargs+=(
-DITK_WRAP_PYTHON=OFF
)
fi
cmake-utils_src_configure
}
src_install() {
cmake-multilib_src_install
if use examples; then
insinto /usr/share/doc/${PF}/examples
docompress -x /usr/share/doc/${PF}/examples
doins -r "${S}"/Examples/*
fi
echo "ITK_DATA_ROOT=${EROOT%/}/usr/share/${PN}/data" > ${T}/40${PN}
local ldpath="${EROOT%/}/usr/$(get_libdir)/InsightToolkit"
if use python; then
echo "PYTHONPATH=${EROOT%/}/usr/$(get_libdir)/InsightToolkit/WrapITK/Python" >> "${T}"/40${PN}
ldpath="${ldpath}:${EROOT%/}/usr/$(get_libdir)/InsightToolkit/WrapITK/lib"
fi
echo "LDPATH=${ldpath}" >> "${T}"/40${PN}
doenvd "${T}"/40${PN}
if use doc; then
insinto /usr/share/doc/${PF}/api-docs
cd "${WORKDIR}"/html
rm *.md5 || die "Failed to remove superfluous hashes"
einfo "Installing API docs. This may take some time."
insinto /usr/share/doc/${PF}/api-docs
doins -r *
fi
}
@gerddie
Copy link

gerddie commented Sep 22, 2017

Thanks for your work on this, but since I only keep ITK updated as an dependency for ginkgocadx, itksnap and eastix, I don't really care about multilib support.
From what I see it is an upstream problem, i.e. they don't set the multilib library install targets correctly, so you might want to report a bug there - they are usually quite responsive.

Be warned though, I don't know whether you tried to build ITK with python support. For me it takes about 10 hours (AMD-FX6300) , and compiling this with multilib might be unsustainable.

BTW: there is also an itk ebuild in the science overlay, AFAIR they don't use system gdcm though.

Best,
Gert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment