summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 49e591fc67317b10fb013f6cdc702d4cf58503ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Maintainer: Butui Hu <hot123tea123@gmail.com>

pkgname=itk-snap-nightly-bin
_pkgname=itk-snap
pkgver=3.8.0.r5.f4a3d448
_pkgver=3.8.0
pkgrel=1
pkgdesc='A software application used to segment structures in 3D medical images (nightly build)'
arch=('x86_64')
url='https://www.itksnap.org'
license=('GPL')
depends=(
  'curl'
  'glib2'
  'libpng12'
)
makedepends=(
  'gendesk'
  'git'
)
provides=(itk-snap=${pkgver})
conflicts=('itk-snap')
source=(
  "${_pkgname}-git::git+https://git.code.sf.net/p/itk-snap/src"
  "${_pkgname}.tar.gz::https://sourceforge.net/projects/itk-snap/files/itk-snap/Nightly/itksnap-nightly-master-Linux-gcc64.tar.gz"
  "${_pkgname}.png::https://sourceforge.net/p/itk-snap/src/ci/master/tree/GUI/Qt/Resources/logo_square.png?format=raw"
)
sha512sums=('SKIP'
            '9e5d4964e182303f1aacb207ed23e00a9421c79e678d3185d6740036f321380a5afbb915f5758f0e870232751a84bf6e958d5cddc86a021b81b50372ff510a97'
            '7d7866a4f28ee645cf4a454488d197a776475d2959d0f9d4d34cf534f34a73ffbb1b92430518f36948b4c25b736990693be07dd345600ed8292e526e2846fca1')
noextract=("${_pkgname}.tar.gz")

pkgver() {
  cd "${srcdir}/${_pkgname}-git"
  printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g' | sed 's/^v//')"
}

prepare() {
  # manually extract tarball due to their unpredicted name
  mkdir "${srcdir}/${_pkgname}"
  tar xvf "${srcdir}/${_pkgname}.tar.gz" -C "${srcdir}/${_pkgname}" --strip-components 1
  echo "Creating desktop file"
  gendesk -f -n --pkgname ${_pkgname} \
    --pkgdesc "${pkgdesc}" \
    --categories "Education;Graphics;Science;DataVisualization;MedicalSoftware;Viewer" \
    --icon "${_pkgname}" \
    --exec "itksnap"
}

package() {
  install -d "${pkgdir}/usr"
  for item in $(ls "${srcdir}/${_pkgname}"); do
    mv -v "${srcdir}/${_pkgname}/${item}" "${pkgdir}/usr"
  done
  install -Dm644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
  install -Dm644 "${srcdir}/${_pkgname}.png" "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
}
# vim:set ts=2 sw=2 et: