summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ad669ef89b7b7cdc064138af631995fee1b25d43 (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
# Maintainer: Caltlgin Stsodaat <contact@fossdaily.xyz>

_name='RESTClient'
_pkgname='rest-client'
pkgname="${_pkgname}-bin"

pkgver=3.7.1
pkgrel=2
_commit_icon='bd592d85340958b72776569a67a0d8ebfa4ab15b'

pkgdesc='Tool to test HTTP/RESTful webservices'
arch=('any')
url='https://github.com/wiztools/rest-client'
license=('APACHE')
depends=('hicolor-icon-theme' 'java-runtime')
makedepends=('gendesk' 'imagemagick' 'libicns')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
noextract=("${_pkgname/-/}-cli-fat-${pkgver}.jar"
        "${_pkgname/-/}-ui-fat-${pkgver}.jar")
source=("${url}/releases/download/${pkgver}/${_pkgname/-/}-"{'cli','ui'}"-fat-${pkgver}.jar"
        "${_pkgname}-icon-${_commit_icon}::${url}/raw/${_commit_icon}/${_pkgname/-/}-ui/src/main/app-resources/${_pkgname}_30.icns")
sha256sums=('f85f2c0d516f1834745e50567f6f347b30de0531a2aca8f5476f0f973f9fe819'
            'ea575df3f96841fbe6a294c04e0357a75f3541dab8d418e0f49e43a393a3daee'
            '173cfd6c315b7e85dea2d7afb8c1d6ea0c4ece3014a1a7e5b4153bef3156ad77')

prepare() {
  echo -e "#!/bin/sh\ncd /usr/share/${_pkgname} && java -jar ./${_pkgname}-cli.jar" > "${_pkgname}-cli"
  echo -e "#!/bin/sh\ncd /usr/share/${_pkgname} && java -jar ./${_pkgname}-ui.jar" > "${_pkgname}-ui"
  gendesk -f -n \
    --pkgname="${_pkgname/-/_}" \
    --pkgdesc="${pkgdesc}" \
    --name="${_name}" \
    --comment="${pkgdesc}" \
    --exec="${_pkgname}-ui" \
    --icon="${_pkgname}" \
    --categories='Development'
}

package() {
  install -Dvm755 "${_pkgname}-cli" -t "${pkgdir}/usr/bin"
  install -Dvm755 "${_pkgname}-ui" -t "${pkgdir}/usr/bin"
  install -Dvm644 "${_pkgname/-/_}.desktop" -t "${pkgdir}/usr/share/applications"

  icns2png --extract "${_pkgname}-icon-${_commit_icon}"
  for i in 16 22 24 32 48 64 96 128 256 512; do
    convert "${_pkgname}-icon-${_commit_icon}_512x512x32.png" -resize "${i}x${i}" "icon${i}.png"
    install -Dvm644 "icon${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/${_pkgname}.png"
  done

  install -Dvm755 "${_pkgname/-/}-cli-fat-${pkgver}.jar" "${pkgdir}/usr/share/${_pkgname}/${_pkgname}-cli.jar"
  install -Dvm755 "${_pkgname/-/}-ui-fat-${pkgver}.jar" "${pkgdir}/usr/share/${_pkgname}/${_pkgname}-ui.jar"
}

# vim: ts=2 sw=2 et: