123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- # Maintainer: Chris <christopher.r.mullins g-mail>
- # Contributor: geosam <samuelmesa@linuxmail.org>
- # Contributor: Andrzej Giniewicz <gginiu@gmail.com>
- # Contributor: Thomas Dziedzic < gostrc at gmail >
- # Contributor: joel schaerer <joel.schaerer@laposte.net>
- _pkgbase=insight-toolkit
- pkgname="${_pkgbase}"
- pkgver=5.3
- pkgrel=rc03.tubetk_fem_c++14
- _pkgdesc="Cross-platform system that provides developers"
- _pkgdesc="${_pkgdesc} with an extensive suite of software"
- _pkgdesc="${_pkgdesc} tools for image analysis"
- pkgdesc="${_pkgdesc}"
- arch=('i686' 'x86_64')
- url='http://www.itk.org/'
- license=('APACHE')
- depends=('fftw' 'libjpeg-turbo' 'libpng' 'zlib' 'libtiff'
- 'gdcm' 'expat' 'hdf5' 'gtest' 'eigen' 'jre-openjdk'
- 'jre-openjdk-headless')
- optdepends=(
- 'python2: build python wrapping'
- 'ruby'
- 'tcl: build tcl wrapping (currently not supported)'
- 'perl: build perl wrapping (currently not supported)'
- 'swig: generate python wrappers'
- 'pcre: for wrapping'
- 'castxml-git: for wrapping and docs'
- 'clang: for swig'
- 'castxml-git: for ITK')
- makedepends=('cmake' 'git' 'castxml' "samurai")
- source=("insight-toolkit::git+https://github.com/InsightSoftwareConsortium/ITK#tag=v${pkgver}rc03"
- "disable_remote_git.diff"
- "libdl_fix.diff"
- "SimpleITKFilters::git+https://github.com/InsightSoftwareConsortium/ITKSimpleITKFilters.git"
- "IsotropicWavelets::git+https://github.com/InsightSoftwareConsortium/ITKIsotropicWavelets.git"
- "LabelErodeDilate::git+https://github.com/InsightSoftwareConsortium/ITKLabelErodeDilate.git"
- "Montage::git+https://github.com/InsightSoftwareConsortium/ITKMontage.git"
- "MorphologicalContourInterpolation::git+https://github.com/KitwareMedical/ITKMorphologicalContourInterpolation.git"
- "MultipleImageIterator::git+https://github.com/KitwareMedical/MultipleImageIterator.git"
- "PhaseSymmetry::git+https://github.com/KitwareMedical/ITKPhaseSymmetry.git"
- "Strain::git+https://github.com/KitwareMedical/ITKStrain.git"
- "TubeTK::git+https://github.com/InsightSoftwareConsortium/ITKTubeTK.git#tag=v1.0.0"
- "TwoProjectionRegistration::git+https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration.git"
- "MinimalPathExtraction::git+https://github.com/InsightSoftwareConsortium/ITKMinimalPathExtraction.git"
- )
- sha512sums=('SKIP'
- 'c5338b5919e818e3719c1273e865ecd2a1673f71df29a0cc13b02dbdc3b7dc293eb61935f45ea4a51e12ab01584f79cbd55ae426d214c21e4ad80e6ba4aefa4d'
- '972ba667ac65849f18f93d6e29003d2f02218dedc4d37cbaefe63fd587ee0fcf9aa1b0e2195b338b7a4c3943620263100b86202d255019beacdf99be50cfc511'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP'
- 'SKIP')
- provides=(python-itk="${pkgver}" itk="${pkgver}")
- conflicts=(python-itk itk)
- backup=(etc/ld.so.conf.d/insight-toolkit.conf)
- function _get_cores_func() {
- # Not CPU, but cores. Hopefully, the machine has enough
- # memory for that
- local _ncores
- _ncores=$(grep -m 1 'cpu cores' /proc/cpuinfo |
- cut -f2 -d":" | tr -d "[:space:]")
- # Try to use MAKEFLAGS, otherwise, _ncores
- _nproc_make="${MAKEFLAGS:-$_ncores}"
- _nproc_make="${_nproc_make##*-j}"
- _nproc_make="${_nproc_make%%[[:space:]]*}"
- _nproc_make="${_nproc_make##*[[:space:]]}"
- }
- prepare() {
- cd "${srcdir}"
- _basedir="${srcdir}"/"${_pkgbase}"
- patch -d "${_basedir}" -p0 \
- -i "${srcdir}"/disable_remote_git.diff
- patch -d "${srcdir}" -p0 -i "${srcdir}"/libdl_fix.diff
- }
- build() {
- cd "${srcdir}"
- _build_dir="${srcdir}"/"${_pkgbase}"/build
- _confopts=(
- -S "${srcdir}"/"${_pkgbase}"
- -B "${_build_dir}"
- -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr
- -DCMAKE_BUILD_TYPE:STRING=Release
- -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
- --log-level="NOTICE"
- -DCMAKE_CXX_FLAGS:STRING="-std=c++14 ${CXXFLAGS}"
- -DCMAKE_C_FLAGS:STRING="${CFLAGS}"
- -DITK_CXX_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
- -DITK_C_OPTIMIZATION_FLAGS:STRING="${COPTFLAGS}"
- -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
- -G Ninja
- # -G "Unix Makefiles"
- # -DCMAKE_BUILD_PARALLEL_LEVEL="${_nproc_make}"
- -DBUILD_TESTING:BOOL=OFF
- -DBUILD_EXAMPLES:BOOL=OFF
- -DITK_BUILD_DOCUMENTATION:BOOL=OFF
- -DITK_BUILD_DEFAULT_MODULES:BOOL=ON
- # Python
- -DITK_WRAP_PYTHON:BOOL=ON
- -DITK_USE_SYSTEM_SWIG:BOOL=ON
- -DITK_USE_SYSTEM_CASTXML:BOOL=ON
- -DITK_LEGACY_SILENT:BOOL=ON
- -DBUILD_SHARED_LIBS:BOOL=ON
- -DITK_USE_SYSTEM_LIBRARIES:BOOL=ON
- -DITK_USE_SYSTEM_JPEG:BOOL=ON
- -DITK_USE_SYSTEM_PNG:BOOL=ON
- -DITK_USE_SYSTEM_ZLIB:BOOL=ON
- -DITK_USE_SYSTEM_TIFF:BOOL=ON
- -DITK_USE_SYSTEM_GDCM:BOOL=ON
- -DITK_USE_SYSTEM_EXPAT:BOOL=ON
- -DITK_USE_SYSTEM_FFTW:BOOL=ON
- -DITK_USE_SYSTEM_HDF5:BOOL=ON
- -DITK_USE_64BITS_IDS:BOOL=ON
- -DITK_WRAP_IMAGE_DIMS:STRING="2;3;4"
- -DITK_WRAP_VECTOR_COMPONENTS:STRING="2;3;4"
- -DITK_WRAP_float:BOOL=ON
- -DITK_WRAP_vector_float:BOOL=ON
- # generates a compile_commands.json
- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON
- # Reconstruction of 3D from 2D slices
- -DModule_Montage:BOOL=ON
- # Interpolate contours
- -DModule_MorphologicalContourInterpolation:BOOL=ON
- # Facilitate working on multiple images
- -DModule_MultipleImageIterator:BOOL=ON
- # Separate material phases?
- -DModule_PhaseSymmetry:BOOL=ON
- -DModule_IsotropicWavelets:BOOL=OFF # Not working
- # Improving segmentation of circles
- -DModule_LabelErodeDilate:BOOL=ON
- # Compute strain from displacement or transformation
- -DModule_Strain:BOOL=ON
- # From 2D slices to 3D registration
- -DModule_TwoProjectionRegistration:BOOL=ON
- # segmentation, registration, and analysis of tubes
- -DModule_TubeTK:BOOL=ON
- # TubeTK requires MinimalPathExtraction module enabled
- -DModule_MinimalPathExtraction:BOOL=ON
- # Finite Element
- -DModule_ITKFEM:BOOL=ON
- -DModule_ITKFEMRegistration:BOOL=ON
- # -DModule_FixedPointInverseDisplacementField:BOOL=ON
- # -DModule_IOOpenSlide:BOOL=OFF #
- # -DModule_IOTransformDCMTK:BOOL=OFF
- # -DITKVideoBridgeOpenCV
- # -DITKVideoBridgeVXL
- )
- printf "INFO: Running CMake...\n"
- cmake "${_confopts[@]}"
- printf "INFO: ... CMake done\n"
- printf "INFO: Cleaning TubeTK...\n"
- # Fixing TubeTK
- # The next commands should go in prepare(), but `cmake'
- # should be in build(), and the files only exist after
- # `cmake'.
- # find "${srcdir}" -type f -regex '.*\.\(supp\|cxx\|txt\|ninja\|make\|so\.1\)' -exec grep --color -nH --null -e 'libdl[^[:space:];]*\.\(so\|a\)[[:digit:].]*' \{\} +
- sed -i "s%libdl[^[:space:];]*\.so[[:digit:].]*%libdl.so.2%g" "${_build_dir}"/build.ninja
- # Get rid of triaged MinimalPathExtraction.h
- rm -fr "${srcdir}/${pkgname}"/Modules/Remote/TubeTK/include/MinimalPathExtractionExport.h
- printf "INFO: ... cleaning TubeTK, done\n"
- _get_cores_func
- # Persist after error
- local _f=1 _try_i=0 _max_try=20
- while [[ "${_i}" -lt "${_max_try}" ]] && [[ ! "${_f}" == "0" ]]; do
- _f=0
- # make -s -j4 -C "${_build_dir}" -f "${_build_dir}"/Makefile ||
- samu -j4 -C "${_build_dir}" -f "${_build_dir}"/build.ninja ||
- _f=$? # catch error
- _try_i="$(( ${_i} + 1 ))" # counter
- sleep 3; # pause (to kill manually)
- done
- }
- package() {
- _build_dir="${srcdir}"/"${_pkgbase}"/build
- cd "${_build_dir}"
- _get_cores_func;
- # DESTDIR="${pkgdir}" make -C "${_build_dir}" \
- DESTDIR="${pkgdir}" samu -C "${_build_dir}" -f "${_build_dir}"/build.ninja \
- -j4 install 1>/dev/null
- # Based on AUR's itk-git package
- # (quick fix for
- # https://github.com/InsightSoftwareConsortium/ITK/issues/2960)
- install -dm755 "${pkgdir}"/usr/lib
- _pycmd='print("%s.%s" % (sys.version_info[:2]))'
- _pyver=$(python -c "import sys; ${_pycmd}")
- find "${pkgdir}" -type d -name "python${_pyver}" \
- -print0 -quit | xargs -0 mv -vt "${pkgdir}/usr/lib"
- python -O -m compileall "${pkgdir}/usr/lib" 1>/dev/null
- # Find required java libraries and add it to /etc/profile.d/
- # Skipping RPATH allows that the packager system's may
- # be different from the installer's system, but it also
- # implies having the path to some libraries in the
- # right place. For some reason libjawt.so,
- # libawt_xawt.so and libjvm.so are not immediately
- # found, so we create entries in /etc/profile.d/ with
- # insight-toolkit.sh.
- mkdir "${pkgdir}"/etc/profile.d/
- echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/jvm/default/lib:/usr/lib/jvm/default/lib/server"' > "${pkgdir}"/etc/profile.d/insight-toolkit.sh
- }
|