summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 141ffcf61cb766b22498ab64c67112bd68e21419 (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
# Maintainer: Junaid Rahman <junaid.cloud2@gmail.com>
pkgname=guiman
pkgver=1.6.0
pkgrel=1
pkgdesc="The Ultimate Arch Linux Package Manager - GUI with 100% pacman & AUR feature parity"
arch=('x86_64')
url="https://github.com/Junaid433/guiman"
license=('MIT')
depends=(
    'webkit2gtk'
    'gtk3'
    'libayatana-appindicator'
    'pacman'
    'sudo'
)
makedepends=(
    'nodejs'
    'npm'
    'git'
    'ffmpeg'
    'pkgconf'
    'openssl'
    'rust'
    'cargo'
    'base-devel'
)
optdepends=(
    'yay: AUR helper support'
    'paru: AUR helper support'
    'reflector: Mirror management'
    'polkit: Password-free operations'
)
provides=('guiman')
conflicts=('guiman-bin' 'guiman-git')
source=("git+$url.git")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/guiman"
    git describe --tags --abbrev=0 | sed 's/^v//'
}

prepare() {
    cd "$srcdir/guiman"

    if [ -f "src-tauri/icons/icon.png" ]; then
        ffmpeg -y -loglevel error -i src-tauri/icons/icon.png -vf "format=rgba,scale=512:512:force_original_aspect_ratio=increase,crop=512:512" src-tauri/icons/icon_rgba.png
        mv src-tauri/icons/icon_rgba.png src-tauri/icons/icon.png
        echo "Icon converted to RGBA format and made square"
    fi

    if [ -f "src-tauri/tauri.conf.json" ]; then
        sed -i 's/"productName": "GuiMan"/"productName": "guiman"/' src-tauri/tauri.conf.json
        echo "Fixed productName in tauri.conf.json"
    fi
}

build() {
    cd "$srcdir/guiman"

    npm ci --silent || npm install --silent

    npm install --silent @tauri-apps/cli

    npx tauri build || {
        echo "Build failed" >&2
        exit 1
    }
}

package() {
    cd "$srcdir/guiman"

    install -Dm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" << 'EOF'
#!/bin/bash
export WEBKIT_DISABLE_COMPOSITING_MODE=0
export WEBKIT_USE_GPU=1
export WEBKIT_DISABLE_DMABUF_RENDERER=1
export GDK_BACKEND=x11
exec /usr/lib/guiman/guiman "$@"
EOF
    
    install -Dm755 "src-tauri/target/release/$pkgname" "$pkgdir/usr/lib/guiman/$pkgname"

    [ -f "$pkgname.desktop" ] && install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"

    [ -f "src-tauri/icons/icon.png" ] && install -Dm644 "src-tauri/icons/icon.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"

    if [ -f "polkit/com.guiman.pkexec.policy" ]; then
        install -Dm644 "polkit/com.guiman.pkexec.policy" "$pkgdir/usr/share/polkit-1/actions/com.guiman.pkexec.policy"
    fi

    [ -f LICENSE ] && install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    [ -f README.md ] && install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}