summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3f03ce5ed4b42671a87cd186116f45c9c87f26a9 (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
60
61
62
63
64
65
66
# Maintainer: Reza Jahanbakhshi <reza dot jahanbakhshi at gmail dot com>

pkgname=candle2-git
pkgdesc="GRBL and GRBL-Advanced controller application with G-Code visualizer written in Qt - git version"
pkgver=V2.4.r15.da0155d.40.d41d8cd
pkgrel=1
arch=(x86_64 aarch64)
url="https://github.com/Schildkroet/Candle2.git"
license=('GPL3')
groups=()
depends=('qt5-serialport' 'qt5-base' 'hicolor-icon-theme')
makedepends=('git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}" "${pkgname%-git}-bin")
replaces=()
backup=()
options=()
install=
source=(
    "${pkgname%-git}"::'git+https://github.com/Schildkroet/Candle2.git'
    "${pkgname%-git}.desktop"
)
noextract=()
md5sums=('SKIP'
         '060580e207a2230c5182badf908d0bf9')

pkgver() {
	cd "$srcdir/${pkgname%-git}"

    local _patchver
    local _patchfile
    for _patchfile in "${source[@]}"; do
        _patchfile="${_patchfile%%::*}"
        _patchfile="${_patchfile##*/}"
        [[ $_patchfile = *.patch ]] || continue
        _patchver="${_patchver}$(md5sum ${srcdir}/${_patchfile} | cut -c1-32)"
    done
    _patchver="$(echo -n $_patchver | md5sum | cut -c1-7)"

    echo $(git describe --tags --match 'V*' | sed 's/\([^-]*-\)g/r\1/;s/-/./g').$(git rev-list --count HEAD).${_patchver}
}

prepare() {
    local _patchfile
    for _patchfile in "${source[@]}"; do
        _patchfile="${_patchfile%%::*}"
        _patchfile="${_patchfile##*/}"
        [[ $_patchfile = *.patch ]] || continue
        echo "Applying patch $_patchfile..."
        patch --directory="$srcdir/${pkgname%-git}" --forward --strip=1 --input="${srcdir}/${_patchfile}"
    done
}

build() {
	cd "$srcdir/${pkgname%-git}/src"
	qmake candle2.pro
	make
}

package() {
    install -m644 ../"${pkgname%-git}.desktop" -Dt "$pkgdir"/usr/share/applications
	cd "$srcdir/${pkgname%-git}"
    install -m644 src/images/icon.svg -D "$pkgdir"/usr/share/icons/hicolor/scalable/apps/candle2.svg
    install -m755 src/Candle2 -Dt "$pkgdir"/usr/bin
}