summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7855da191c384b09ad8186bcb986d8e79cdd667c (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
# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=gcap2022
pkgver=2022.1.3
pkgrel=1
pkgdesc='Brazilian physical person income tax (IRPF) auxiliary program for calculation of capital gains (2022 version)'
arch=('any')
url='https://www.gov.br/pt-br/servicos/apurar-imposto-sobre-ganhos-de-capital'
license=('custom')
depends=('sh' 'java-runtime=11' 'hicolor-icon-theme')
makedepends=('icoutils')
source=("https://downloadirpf.receita.fazenda.gov.br/irpf/${pkgver%%.*}/gcap/GCAP${pkgver%%.*}v${pkgver#*.}-v2.zip"
        'gcap.desktop'
        'gcap.sh'
        'LICENSE')
sha256sums=('4f03d397e05b53f364b36084e2174584470263261c61f8acb97a1b74704ba5f2'
            '79e86047741ccc153c2e6b6842cbf8725977c9202a0b9081f647e3c30fde1e43'
            'fbe0d3aa1e0260200f0465a0f12434c6fdf5e7dc28d65e47adf1dc21dbd7b539'
            'a406e102e2c10c202bd7a0ba775b004c0f04440544db73ce6923172a62aacd67')

prepare() {
    icotool -x -o "GCAP${pkgver%%.*}" "GCAP${pkgver%%.*}/RFB_GCAP.ico"
}

package() {
    install -D -m755 gcap.sh "${pkgdir}/usr/bin/gcap-${pkgver%%.*}"
    install -D -m644 gcap.desktop "${pkgdir}/usr/share/applications/gcap-${pkgver%%.*}.desktop"
    install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -D -m644 "GCAP${pkgver%%.*}/GCAP.jar" "${pkgdir}/usr/share/java/gcap-${pkgver%%.*}/gcap.jar"
    install -D -m644 "GCAP${pkgver%%.*}/pgd-updater.jar" -t "${pkgdir}/usr/share/java/gcap-${pkgver%%.*}"
    install -D -m644 "GCAP${pkgver%%.*}/Leia_me.htm" -t "${pkgdir}/usr/share/doc/gcap-${pkgver%%.*}"
    cp -dr --no-preserve='ownership' "GCAP${pkgver%%.*}/help" "${pkgdir}/usr/share/doc/gcap-${pkgver%%.*}"
    cp -dr --no-preserve='ownership' "GCAP${pkgver%%.*}/lib" "${pkgdir}/usr/share/java/gcap-${pkgver%%.*}"
    ln -s "../../doc/gcap-${pkgver%%.*}/help" "${pkgdir}/usr/share/java/gcap-${pkgver%%.*}/help"
    
    local _file
    local _res
    while read -r -d '' _file
    do
        _res="$(sed 's/\.png$//;s/^.*_//;s/x.*$//' <<< "$_file")"
        install -D -m644 "$_file" "${pkgdir}/usr/share/icons/hicolor/${_res}x${_res}/apps/gcap-${pkgver%%.*}.png"
    done < <(find "GCAP${pkgver%%.*}" -maxdepth 1 -type f -name 'RFB_GCAP_*_*x*x*.png' -print0)
}