summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6ca6dbc1fd460cda82f32e357f533c568f886558 (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
# Maintainer: Teoh Han Hui <teohhanhui@gmail.com>

_pkgname=makepad
pkgname=makepad-git
pkgver=0.1.0.r883.5c05e153
pkgrel=1
pkgdesc='VR, web and native collaborative shader programming environment'
arch=('i686' 'x86_64')
url='https://github.com/makepad/makepad'
license=('MIT')
depends=('libx11' 'libxcursor' 'mesa-libgl')
makedepends=('cargo' 'git')
provides=('makepad')
conflicts=('makepad')

source=("${pkgname}::git+https://github.com/makepad/makepad#branch=master"
        'adjust-makepad-workspace.patch'
        'adjust-resources-path.patch')
sha256sums=('SKIP'
            '29a82f1366817901481757fb2c9cab1f72eae80758e179b0d0342992334da3b9'
            '83f66d95a06b46a975171eea9ba32f50c1b3529f68257f820a455c39d9bc5601')

prepare() {
    cd "${srcdir}/${pkgname}"

    for patch in "${srcdir}/"*.patch; do
        sed -i -e "s#%%MAKEPAD_HOME%%#/opt/${_pkgname}#g" "${patch}"
        patch -p1 -i "${patch}"
    done
}

pkgver() {
    cd "${srcdir}/${pkgname}"

    printf "%s.r%s.%s" "$(grep '^version =' makepad/Cargo.toml | head -n1 | cut -d\" -f2 | cut -d- -f1)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "${srcdir}/${pkgname}"

    cargo build --release --package "${_pkgname}"
}

check() {
    cd "${srcdir}/${pkgname}"

    cargo test --release --package "${_pkgname}"
}

package() {
    cd "${srcdir}/${pkgname}"

    install -Dm755 "target/release/${_pkgname}" "${pkgdir}/opt/${_pkgname}/target/release/${_pkgname}"
    install -d "${pkgdir}/usr/bin"
    ln -s "/opt/${_pkgname}/target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
    find . \( -path ./.git -o -path ./.github -o -path ./target \) -prune -o -type f -exec install -Dm644 "{}" "${pkgdir}/opt/${_pkgname}/{}" \;
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}