summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a6c3179337a48e544f57aa488937cce1dfe45d5e (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: rg-Sens Contributors
pkgname=rg-sens-git
pkgver=0.7.2.r8.gb36f1a9
pkgrel=1
pkgdesc="A fast, customizable system monitoring dashboard for Linux (git version)"
arch=('x86_64')
url="https://github.com/hilgardt-collab/rg-Sens"
license=('MIT' 'Apache-2.0')
depends=(
    'gtk4'
    'cairo'
    'pango'
    'glib2'
    'hicolor-icon-theme'
)
makedepends=(
    'rust'
    'cargo'
    'pkgconf'
    'git'
)
optdepends=(
    'nvidia-utils: NVIDIA GPU monitoring support'
    'webkit2gtk-4.1: CSS Template panel with WebView support'
)
install=rg-sens.install
provides=('rg-sens')
conflicts=('rg-sens')
source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/$pkgname" || cd "$pkgname" || return 1
    # Try to get version from git tags first
    local ver
    ver=$(git describe --long --tags 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
    if [[ -n "$ver" ]]; then
        echo "$ver"
    else
        # Fallback: use base version + commit count + short hash
        local count hash
        count=$(git rev-list --count HEAD 2>/dev/null || echo "0")
        hash=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
        echo "0.7.4.r${count}.g${hash}"
    fi
}

build() {
    cd "$pkgname"

    export CARGO_HOME="$srcdir/cargo"
    export RUSTUP_TOOLCHAIN=stable

    cargo build --release
}

package() {
    cd "$pkgname"

    # Install binary
    install -Dm755 "target/release/rg-sens" "$pkgdir/usr/bin/rg-sens"

    # Install desktop file
    install -Dm644 "data/rg-sens.desktop" \
        "$pkgdir/usr/share/applications/rg-sens.desktop"

    # Install icon
    install -Dm644 "rg-sens.png" \
        "$pkgdir/usr/share/icons/hicolor/256x256/apps/rg-sens.png"

    # Install metainfo
    install -Dm644 "data/rg-sens.metainfo.xml" \
        "$pkgdir/usr/share/metainfo/rg-sens.metainfo.xml"

    # Install CSS template examples
    install -d "$pkgdir/usr/share/rg-sens/examples"
    install -Dm644 "examples/art_nouveau_panel.html" \
        "$pkgdir/usr/share/rg-sens/examples/art_nouveau_panel.html"
    install -Dm644 "examples/art_nouveau_panel.css" \
        "$pkgdir/usr/share/rg-sens/examples/art_nouveau_panel.css"
    install -Dm644 "examples/css_template_example.html" \
        "$pkgdir/usr/share/rg-sens/examples/css_template_example.html"
    install -Dm644 "examples/css_template_example.css" \
        "$pkgdir/usr/share/rg-sens/examples/css_template_example.css"

    # Install documentation
    install -d "$pkgdir/usr/share/doc/rg-sens"
    install -Dm644 "docs/css-template-panel-guide.md" \
        "$pkgdir/usr/share/doc/rg-sens/css-template-panel-guide.md"
    install -Dm644 "README.md" \
        "$pkgdir/usr/share/doc/rg-sens/README.md"

    # Install license
    install -Dm644 "LICENSE-MIT" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT" 2>/dev/null || true
    install -Dm644 "LICENSE-APACHE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE" 2>/dev/null || true
}