commit: 42b8aadc9ce1de416e55dba98c3ba02a0177366f
Author: Horea Christian <chr <AT> chymera <DOT> eu>
AuthorDate: Thu Sep 15 07:02:53 2022 +0000
Commit: Horea Christian <horea.christ <AT> gmail <DOT> com>
CommitDate: Thu Sep 15 07:02:53 2022 +0000
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=42b8aadc
sci-libs/itk: add 5.1.0
Signed-off-by: Horea Christian <chr <AT> chymera.eu>
sci-libs/itk/files/itk-5.1.0-downloads.patch | 20 +++
sci-libs/itk/files/itk-5.1.0-include_limits.patch | 10 ++
sci-libs/itk/files/tests.patch | 41 +++++
sci-libs/itk/itk-5.1.0.ebuild | 191 ++++++++++++++++++++++
4 files changed, 262 insertions(+)
diff --git a/sci-libs/itk/files/itk-5.1.0-downloads.patch
b/sci-libs/itk/files/itk-5.1.0-downloads.patch
new file mode 100644
index 000000000..34fdb76d1
--- /dev/null
+++ b/sci-libs/itk/files/itk-5.1.0-downloads.patch
@@ -0,0 +1,20 @@
+--- a/CMake/ITKDownloadSetup.cmake 2020-07-30 19:03:10.330325423 -0400
++++ b/CMake/ITKDownloadSetup.cmake 2020-07-30 19:03:10.330325423 -0400
+@@ -11,7 +11,7 @@
+
+ macro(itk_download_attempt_check _name)
+ if(ITK_FORBID_DOWNLOADS)
+- message(SEND_ERROR "Attempted to download ${_name} when
ITK_FORBID_DOWNLOADS is ON")
++ message(WARNING "Attempted to download ${_name} when ITK_FORBID_DOWNLOADS
is ON")
+ endif()
+ endmacro()
+
+--- a/Modules/Remote/GenericLabelInterpolator.remote.cmake 2020-04-25
14:30:53.000000000 -0400
++++ b/Modules/Remote/GenericLabelInterpolator.remote.cmake 2020-04-25
14:30:53.000000000 -0400
+@@ -44,6 +44,4 @@
+ itk_fetch_module(GenericLabelInterpolator
+ "A generic interpolator for multi-label images."
+ MODULE_COMPLIANCE_LEVEL 2
+- GIT_REPOSITORY
${git_protocol}://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator.git
+- GIT_TAG b95fe46c7f4fe8002af67c67e6fe4e1f087bf6b7
+ )
diff --git a/sci-libs/itk/files/itk-5.1.0-include_limits.patch
b/sci-libs/itk/files/itk-5.1.0-include_limits.patch
new file mode 100644
index 000000000..9a8fae820
--- /dev/null
+++ b/sci-libs/itk/files/itk-5.1.0-include_limits.patch
@@ -0,0 +1,10 @@
+---
a/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h
++++
a/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h
+@@ -16,6 +16,7 @@
+
+ #include "gdcmImageToImageFilter.h"
+ #include "gdcmPhotometricInterpretation.h"
++#include <limits>
+
+ namespace gdcm
+ {
diff --git a/sci-libs/itk/files/tests.patch b/sci-libs/itk/files/tests.patch
new file mode 100644
index 000000000..c24714e4d
--- /dev/null
+++ b/sci-libs/itk/files/tests.patch
@@ -0,0 +1,41 @@
+Known to fail by upstream:
+https://github.com/InsightSoftwareConsortium/ITK/issues/1212#issuecomment-527998115
+
+--- a/Modules/Bridge/VtkGlue/test/CMakeLists.txt 2019-09-09
00:45:14.736032139 +0200
++++ b/Modules/Bridge/VtkGlue/test/CMakeLists.txt 2019-09-09
00:49:42.183935497 +0200
+@@ -7,8 +7,6 @@
+ if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
+ list(APPEND ITKVtkGlueTests
+ itkVtkMedianFilterTest.cxx
+- itkVtkConnectedComponentImageFilterTest.cxx
+- QuickViewTest.cxx
+ # ### runViewImage ###
+ # No test generated. Use it for view images (2D or 3D) with:
+ # ITKVtkGlueTestDriver runViewImage image_file
+@@ -40,26 +38,3 @@
+ NAME itkVTKImageToImageFilterTest
+ COMMAND ITKVtkGlueTestDriver
+ itkVTKImageToImageFilterTest)
+-
+-if(NOT VTK_RENDERING_BACKEND STREQUAL "None")
+- itk_add_test(
+- NAME itkVtkMedianImageFilterTest
+- COMMAND ITKVtkGlueTestDriver
+- itkVtkMedianFilterTest DATA{${ITK_DATA_ROOT}/Input/cthead1.png} 2)
+- set_property(TEST itkVtkMedianImageFilterTest APPEND PROPERTY LABELS
REQUIRES_DISPLAY)
+-
+- itk_add_test(
+- NAME QuickViewTest
+- COMMAND ITKVtkGlueTestDriver
+- --compare DATA{Baseline/QuickViewTest.png,:}
+- ${ITK_TEST_OUTPUT_DIR}/QuickViewTest0.png
+- --compareNumberOfPixelsTolerance 1500
+- QuickViewTest DATA{${ITK_DATA_ROOT}/Input/peppers.png}
${ITK_TEST_OUTPUT_DIR})
+- set_property(TEST QuickViewTest APPEND PROPERTY LABELS REQUIRES_DISPLAY)
+-
+- itk_add_test(
+- NAME itkVtkConnectedComponentImageFilterTest
+- COMMAND ITKVtkGlueTestDriver
+- itkVtkConnectedComponentImageFilterTest
DATA{${ITK_DATA_ROOT}/Input/cthead1.png})
+- set_property(TEST itkVtkConnectedComponentImageFilterTest APPEND PROPERTY
LABELS REQUIRES_DISPLAY)
+-endif()
diff --git a/sci-libs/itk/itk-5.1.0.ebuild b/sci-libs/itk/itk-5.1.0.ebuild
new file mode 100644
index 000000000..34d2c215d
--- /dev/null
+++ b/sci-libs/itk/itk-5.1.0.ebuild
@@ -0,0 +1,191 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit cmake python-single-r1
+
+MY_PN="InsightToolkit"
+MY_P="${MY_PN}-${PV}"
+GLI_HASH="a02cbeaf28cb3d28ac66b9ac651073530eb6ab78"
+TEST_HASH="0eb202e23ae81be123b1b26cf31a9ba743824700"
+declare -a GLI_TEST_HASHES=(
+
"a5e11ea71164ff78c65fcf259db01ea5db981a9d868e60045ff2bffca92984df1174bf984a1076e450f0d5d69b4f0191ed1a61465c220e2c91a893b5df150c0a"
+
"bcdbb347f3704262d1f00be7179d6a0a6e68aed56c0653e8072ee5a94985c713bd229c935b1226a658af84fb7f1fffc2458c98364fc35303a2303b12f9f7ce2f"
+)
+
+GLI_TEST_SRC=""
+for i in "${GLI_TEST_HASHES[@]}"; do
+ GLI_TEST_SRC+="https://data.kitware.com/api/v1/file/hashsum/sha512/${i}
-> ${P}-test-${i} "
+done
+
+DESCRIPTION="NLM Insight Segmentation and Registration Toolkit"
+HOMEPAGE="http://www.itk.org"
+SRC_URI="
+
https://github.com/InsightSoftwareConsortium/ITK/releases/download/v${PV}/${MY_P}.tar.gz
+
https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/archive/${GLI_HASH}.tar.gz
-> ITKGenericLabelInterpolator-${PV}.tar.gz
+ test? (
+
https://github.com/InsightSoftwareConsortium/ITK/releases/download/v${PV}/InsightData-${PV}.tar.gz
+
https://github.com/InsightSoftwareConsortium/ITKTestingData/archive/${TEST_HASH}.tar.gz
-> ${P}-testingdata.tar.gz
+ ${GLI_TEST_SRC}
+ )
+ "
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug doc examples fftw itkv4-compat python review test vtkglue"
+RESTRICT="!test? ( test )"
+# python will not work, this is a know issue upstream:
+# https://github.com/InsightSoftwareConsortium/ITK/issues/2005
+# https://github.com/InsightSoftwareConsortium/ITK/issues/1229
+#
https://github.com/InsightSoftwareConsortium/ITKGenericLabelInterpolator/issues/10
+
+RDEPEND="
+ dev-libs/double-conversion:0=
+ media-libs/openjpeg:2
+ media-libs/libpng:0=
+ media-libs/tiff:0=[jpeg]
+ sci-libs/dcmtk:0=
+ sci-libs/hdf5:0=[cxx]
+ sys-libs/zlib:0=
+ media-libs/libjpeg-turbo:0=
+ fftw? ( sci-libs/fftw:3.0= )
+ vtkglue? ( sci-libs/vtk:0=[rendering,python?] )
+ python? ( ${PYTHON_DEPS} )
+"
+DEPEND="${RDEPEND}
+ sys-apps/coreutils
+ python? (
+ >=dev-lang/swig-2.0:0
+ dev-libs/castxml
+ )
+ doc? ( app-doc/doxygen )
+"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}"/tests.patch
+ "${FILESDIR}"/${P}-downloads.patch
+ "${FILESDIR}"/${P}-include_limits.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_prepare() {
+ sed -i -e "s/find_package(OpenJPEG 2.0.0/find_package(OpenJPEG/g"\
+ Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt
+ ln -sr ../ITKGenericLabelInterpolator-*
Modules/External/ITKGenericLabelInterpolator || die
+ cmake_src_prepare
+ if use test; then
+ cp -rf "../ITKTestingData-${TEST_HASH}/"* ".ExternalData/" ||
die
+ mv "../ITKTestingData-${TEST_HASH}"
"${BUILD_DIR}/.ExternalData" || die
+ for i in "${GLI_TEST_HASHES[@]}"; do
+ cp "${DISTDIR}/${i}" ".ExternalData/SHA512/" || die
+ cp "${DISTDIR}/${i}"
"${BUILD_DIR}/.ExternalData/SHA512/" || die
+ done
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DITK_BUILD_DOCUMENTATION="$(usex doc ON OFF)"
+ -DBUILD_EXAMPLES="$(usex examples ON OFF)"
+ -DBUILD_SHARED_LIBS=ON
+ -DBUILD_TESTING="$(usex test ON OFF)"
+
-Ddouble-conversion_INCLUDE_DIRS="${EPREFIX}/usr/include/double-conversion"
+
-DExternalData_OBJECT_STORES="${WORKDIR}/InsightToolkit-${PV}/.ExternalData"
+ -DGDCM_USE_SYSTEM_OPENJPEG=ON
+ -DITK_FORBID_DOWNLOADS:BOOL=ON
+ -DITK_INSTALL_LIBRARY_DIR=$(get_libdir)
+ -DITK_USE_REVIEW="$(usex review ON OFF)"
+ -DITK_USE_SYSTEM_DCMTK=ON
+ -DITK_USE_SYSTEM_DOUBLECONVERSION=ON
+ -DITK_USE_SYSTEM_CASTXML=ON
+ -DITK_USE_SYSTEM_HDF5=ON
+ -DITK_USE_SYSTEM_JPEG=ON
+ -DITK_USE_SYSTEM_PNG=ON
+ -DITK_USE_SYSTEM_SWIG=ON
+ -DITK_USE_SYSTEM_TIFF=ON
+ -DITK_USE_SYSTEM_ZLIB=ON
+ -DITK_USE_KWSTYLE=OFF
+ -DITK_BUILD_DEFAULT_MODULES=ON
+ -DITK_COMPUTER_MEMORY_SIZE="${ITK_COMPUTER_MEMORY_SIZE:-1}"
+ -DModule_GenericLabelInterpolator:BOOL=ON
+ -DModule_ITKReview:BOOL=ON
+ -DWRAP_ITK_JAVA=OFF
+ -DWRAP_ITK_TCL=OFF
+ -DITKV4_COMPATIBILITY:BOOL=$(usex itkv4-compat)
+ )
+ 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_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ if use examples; then
+ docinto examples
+ docompress -x /usr/share/doc/${PF}/examples
+ dodoc -r "${S}"/Examples/*
+ fi
+
+ echo "ITK_DATA_ROOT=${EPREFIX}/usr/share/${PN}/data" > ${T}/40${PN}
+ local ldpath="${EPREFIX}/usr/$(get_libdir)/InsightToolkit"
+ if use python; then
+ echo
"PYTHONPATH=${EPREFIX}/usr/$(get_libdir)/InsightToolkit/WrapITK/Python" >>
"${T}"/40${PN}
+
ldpath="${ldpath}:${EPREFIX}/usr/$(get_libdir)/InsightToolkit/WrapITK/lib"
+ fi
+ echo "LDPATH=${ldpath}" >> "${T}"/40${PN}
+ doenvd "${T}"/40${PN}
+
+ if use doc; then
+ cd "${WORKDIR}"/html || die
+ rm *.md5 || die "Failed to remove superfluous hashes"
+ einfo "Installing API docs. This may take some time."
+ docinto api-docs
+ dodoc -r *
+ fi
+}