123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- # 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
- _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')
- optdepends=(
- 'python2: build python wrapping'
- 'ruby'
- 'tcl: build tcl wrapping (currently not supported)'
- 'perl: build perl wrapping (currently not supported)'
- 'java-runtime: build java 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=("${_pkgbase}::git+https://github.com/InsightSoftwareConsortium/ITK#tag=v${pkgver}${pkgrel}"
- "SimpleITKFilters::git+file://${startdir}/Modules/SimpleITKFilters"
- "disable_remote_git.diff")
- sha512sums=('SKIP'
- 'SKIP'
- '021a162cf37eee24535d52d9b5a137d6722653f8ff4a5c7feade7b6b3ee71a74e6af1191384891d3f572136a08e8381e04137291b1a745a51f80d26f19d7a033')
- provides=(python-itk="${pkgver}" itk="${pkgver}")
- conflicts=(python-itk itk)
- 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="${_comp_nproc##*-j}"
- _nproc_make="${_comp_nproc%%[[:space:]]*}"
- _nproc_make="${_comp_nproc##*[[:space:]]}"
- }
- prepare() {
- cd "${srcdir}"
- _basedir="${srcdir}"/"${_pkgbase}"
- patch -d "${_basedir}" -p0 \
- -i "${srcdir}"/disable_remote_git.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
- # -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
- )
- cmake "${_confopts[@]}" 1>/dev/null
- _get_cores_func
- # Persist after error
- local _f=1 _try_i=0 _max_try=20
- while [[ ! "${_f}" == "0" ]] && \
- [[ "${_i}" -lt "${_max_try}" ]]; do
- _f=0
- samu -j"${_nproc_make}" -C "${_build_dir}" ||
- _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}" samu -C "${_build_dir}" \
- -j"${_nproc_make}" 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
- }
|