summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 98187a93493e039150006203ec29f27a315ca5db (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
# Maintainer: Matthew Kavanagh (https://github.com/mkavanagh-23)
# Original Author: Aditya Singh (https://github.com/s-adi-dev)

pkgname=nmgui-git
pkgver=r7.5e12fd0 # Will be overwritten by pkgver()
pkgrel=3
pkgdesc="A simple and lightweight GTK4-based GUI for managing Wi-Fi and network connections using NetworkManager (nmcli) under the hood."
arch=('x86_64')
url="https://github.com/s-adi-dev/nmgui"
license=('GPL3')
depends=('gtk4' 'networkmanager' 'python-gobject')
makedepends=('git' 'nuitka' 'python-pip' 'python-virtualenv')
optdepends=('python-nmcli: for enhanced NetworkManager integration')
options=('!strip' '!debug') # Keep all symbols
provides=('nmgui')
conflicts=('nmgui' 'nmgui-bin')
source=("git+${url}.git#branch=main")
sha256sums=('SKIP')

# Dynamic version based on git commit
pkgver() {
    cd "$srcdir/nmgui"
    printf "r%s.%s" \
        "$(git rev-list --count HEAD)" \
        "$(git rev-parse --short HEAD)"
}

build() {
    cd "$srcdir/nmgui/build"

    # Set up the python build environment (include system packages)
    python -m venv --system-site-packages build_env
    source build_env/bin/activate

    # Check for system-installed python-nmcli
    if ! python -c "import nmcli" 2>/dev/null; then
      echo "Package python-nmcli not found. Installing via pip"
      pip install nmcli
    else
      echo "Package python-nmcli found. Using system package"
    fi
    export PYTHONPATH="$(python -c 'import site; print(site.getsitepackages()[0])'):$PYTHONPATH"

    # Build the executable
    chmod +x build.bin
    ./build.bin

    # Deactivate the venv
    deactivate
}

package() {
    cd "$srcdir/nmgui"
    
    # Install the compiled binary
    install -Dm755 dist/main.bin "$pkgdir/usr/bin/nmgui"
    
    # Install desktop file
    if [ -f "nmgui.desktop" ]; then
        install -Dm644 nmgui.desktop "$pkgdir/usr/share/applications/nmgui.desktop"
    fi
    
    # Install documentation
    if [ -f "README.md" ]; then
        install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
    fi
    if [ -f "LICENSE" ]; then
        install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    fi
}