summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a37cdd036462ed58c9356cc3653f414f61627cd9 (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
67
68
69
70
71
72
73
74
75
76
77
78
# Maintainer: Tenchirox <tenchirox@github.com>
pkgname=all4laser-git
pkgver=0.1
pkgrel=1
pkgdesc="Open-source laser engraver controller built with Rust and egui"
arch=('x86_64' 'aarch64')
url="https://github.com/Tenchirox/All4Laser"
license=('GPL-3.0-only')
depends=(
    'gcc-libs'
    'glibc'
    'libxcb'
    'libxkbcommon'
    'libglvnd'
    'mesa'
    'fontconfig'
    'freetype2'
    'systemd-libs'
    'v4l-utils'
    'gtk3'
    'openssl'
)
makedepends=(
    'git'
    'rust'
    'cargo'
    'pkg-config'
    'cmake'
)
provides=("all4laser=${pkgver}")
conflicts=('all4laser')
source=("${pkgname}::git+https://github.com/Tenchirox/All4Laser.git")
sha256sums=('SKIP')

pkgver() {
    cd "${pkgname}"
    git describe --long --tags 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' \
        || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "${pkgname}"
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "${pkgname}"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --release
}

check() {
    cd "${pkgname}"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo test --release
}

package() {
    cd "${pkgname}"

    # Binary
    install -Dm755 "target/release/all4laser" "${pkgdir}/usr/bin/all4laser"

    # Desktop entry
    install -Dm644 "assets/all4laser.desktop" "${pkgdir}/usr/share/applications/all4laser.desktop"

    # Icon
    install -Dm644 "A4L.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/all4laser.png"

    # License
    install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    # Documentation
    install -Dm644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}