diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 176 |
1 files changed, 110 insertions, 66 deletions
@@ -1,80 +1,124 @@ -# Maintainer of this PKGBUILD file: Martino Pilia <martino.pilia@gmail.com> +# Maintainer: Butui Hu <hot123tea123@gmail.com> +# +# This PKGBUILD build itk-snap from the source according upstream Dockerfile +# https://github.com/pyushkevich/itksnap/blob/master/Utilities/Docker/itksnap-base/Dockerfile +# and https://github.com/pyushkevich/itksnap/blob/master/Utilities/Docker/itksnap/Dockerfile +# +# upstream use itk 5.2.1, and itk > 5.2.1 is not working +_itkver=5.2.1 +# upstream uses vtk 9.1.0, but 9.2.6 also works with qt6 +# vtk from community repo is build with qt5, here we need to build it with qt6 +# _vtkver=9.1.0 +_vtkver=9.2.6 pkgname=itk-snap -pkgver=3.6.0 -pkgrel=4 -pkgdesc='ITK-SNAP is a software application used to segment structures in 3D medical images' +pkgver=4.2.0alpha.3 +pkgrel=1 +pkgdesc="A software application used to segment structures in 3D medical images" arch=('x86_64') -url='http://www.itksnap.org' -license=('GPL3') +url="https://www.itksnap.org" +license=('GPL-3.0-or-later') depends=( - 'ffmpeg' - 'fltk' - 'gdal' - 'glew' - 'insight-toolkit' - 'libogg' - 'libtheora' - 'netcdf' - 'openmpi' - 'proj' - 'pugixml' - 'python' - 'qt5-declarative' - 'qt5-x11extras' - 'unixodbc' - 'vtk' + curl + expat + gcc-libs + glibc + hdf5 + libglvnd + libjpeg-turbo + libpng + libtiff + libx11 + qt6-base + qt6-declarative + zlib ) -optdepends=() -makedepends=('cmake' 'git') -source=("$pkgname::git+git://git.code.sf.net/p/itk-snap/src" - "itkKernelFunction.h" - "itksnap.png" - "itksnap.desktop") -sha256sums=('SKIP' - 'f88fce76c3a0a3bf72deba15e901945f89df422db27e09b75fdd1a169a856e3d' - 'ee2f8698bf751cb3e1e6520e99c0c761f996fd3707f4155d126e7ecc0a6d6884' - '2c23d817b14df70d9561ff601509f1e0899881e37598048e551dc2161f78b1b2') - -_release_commit='562f52acab8668bae681e206b20d559e59e2ef37' +makedepends=( + cmake + eigen + fftw + gcc12 + gendesk + git + gtest +) +options=(!emptydirs) +# upstream did not create a git tag for 4.2.0alpha.3 +# but according to the git log message, this commit should be release 4.2.0alpha.3 +source=( + "vtk-${_vtkver}.tar.gz::https://github.com/Kitware/VTK/archive/refs/tags/v${_vtkver}.tar.gz" + "itk-${_itkver}.tar.gz::https://github.com/InsightSoftwareConsortium/ITK/archive/refs/tags/v${_itkver}.tar.gz" + "${pkgname}-${pkgver}::git+https://github.com/pyushkevich/itksnap.git#commit=b534d3066cb885062a3cb8d16d48f3835ac273e0" +) +sha512sums=('3ccb19cd98e691828e285d2d85aef890c4796d91588e02c401102feefb26c120f9d5195a79d1e7a04b037bf0bf0898b9791a341e0733d92234ca644e62da19b0' + 'cccb64766acaebe49ee2dd8b82b7b5aaa6a35e97f2cc7738ad7f3cd65006b73b880ac59341cd640abd64c2ac665633f01504760071f5492e40aa97e7ba6db2a9' + 'SKIP') prepare() { - cd "$srcdir/$pkgname" - - git checkout $_release_commit - - # Replace relative with absolute location of the repo - sed -i 's,../../c3d/git,git://git.code.sf.net/p/c3d/git,' .gitmodules - - git submodule init - git submodule update - - mkdir build || : - cd build - - # Ship a deprecated ITKv3 compatibility header - # The v3 compatibility module will be soon removed from ITK 5.0, - # so better to not add it as a dependency - mkdir itkv3 || : - cp "$srcdir/itkKernelFunction.h" itkv3/. - - cmake .. \ - -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_CXX_FLAGS="-fPIC -I'$srcdir/$pkgname/build/itkv3' -DITKV3_COMPATIBILITY=1" \ - -DBUILD_OUTSIDE_INSIGHT_APPLICATIONS=ON \ - -DBUILD_TESTING=OFF \ - -DFLTK_FLUID_EXECUTABLE="/usr/bin/fluid" + # we need to build itk 5.2.1 with gcc 12, gcc 13 is not working + # we could just export these envs + export CC=gcc-12 + export CXX=g++-12 + echo "Creating desktop file" + gendesk -f -n --pkgname ${pkgname} \ + --pkgdesc "${pkgdesc}" \ + --categories "Education;Graphics;Science;DataVisualization;MedicalSoftware;Viewer" \ + --icon "${pkgname}" \ + --exec "itksnap" + cd ${pkgname}-${pkgver} + git submodule update --init --recursive } build() { - cd "$srcdir/$pkgname/build" - make + # build itk + cmake \ + -B ${srcdir}/build-itk \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTING=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DITK_USE_SYSTEM_LIBRARIES=ON \ + -DModule_MorphologicalContourInterpolation=ON \ + -S ${srcdir}/ITK-${_itkver} + make -C ${srcdir}/build-itk + + # build vtk with qt6 + cmake \ + -B ${srcdir}/build-vtk \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DVTK_BUILD_EXAMPLES=OFF \ + -DVTK_BUILD_TESTING=OFF \ + -DVTK_GROUP_ENABLE_Qt=YES \ + -DVTK_MODULE_ENABLE_VTK_GUISupportQtQuick=NO \ + -DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL=NO \ + -DVTK_QT_VERSION=6 \ + -S ${srcdir}/VTK-${_vtkver} + make -C ${srcdir}/build-vtk + + # build itk-snap + cmake \ + -B ${srcdir}/build \ + -DBUILD_TESTING=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DITK_DIR=${srcdir}/build-itk \ + -DVTK_DIR=${srcdir}/build-vtk \ + -S ${pkgname}-${pkgver} + make -C ${srcdir}/build + make -C ${srcdir}/build package } package() { - cd "$srcdir/$pkgname/build" - make install DESTDIR="$pkgdir" + # make install is not working in a clean chroot + # make DESTDIR=${pkgdir} -C ${srcdir}/build install - install -D -m644 "$srcdir/itksnap.png" "${pkgdir}/usr/share/icons/hicolor/128x128/apps/itksnap.png" - install -D -m644 "$srcdir/itksnap.desktop" "${pkgdir}/usr/share/applications/itksnap.desktop" -} + # we install all the files manaully by extracting the tarball to destdir + mkdir -p ${srcdir}/destdir + tar xfv ${srcdir}/build/*.tar.gz -C ${srcdir}/destdir --strip-components 1 + cp -r ${srcdir}/destdir ${pkgdir}/usr + install -Dm644 "${srcdir}/${pkgname}-${pkgver}/GUI/Qt/Resources/logo_square.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png" + install -Dm644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop" +} +# vim:set ts=2 sw=2 et: |