summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 94c8c2b5633de5581fcc2ee4d502af1cf8b20bab (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
# Maintainer: libook <libook7@gmail.com>
pkgname=net-ssr
pkgver=0.3.4
pkgrel=1
pkgdesc="Network Secondary Surveillance Radar"
arch=('x86_64' 'aarch64')
url="https://github.com/libook/net-ssr"
license=('GPL3')
makedepends=('rustup')
source=("git+https://github.com/libook/net-ssr.git#tag=v${pkgver}")
sha256sums=('SKIP')

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

    # Determine the target based on the architecture
    local _target=""
    case "${CARCH}" in
        x86_64)
            _target="x86_64-unknown-linux-gnu"
            ;;
        aarch64)
            _target="aarch64-unknown-linux-gnu"
            ;;
        *)
            echo "Unsupported architecture: ${CARCH}"
            return 1
            ;;
    esac

    # Run the build script with the target
    ./scripts/build.sh ${_target}
}

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

    # Determine the target based on the architecture
    local _target=""
    case "${CARCH}" in
        x86_64)
            _target="x86_64-unknown-linux-gnu"
            ;;
        aarch64)
            _target="aarch64-unknown-linux-gnu"
            ;;
        *)
            echo "Unsupported architecture: ${CARCH}"
            return 1
            ;;
    esac

    # Install the binaries
    install -Dm755 "target/${_target}/release/interrogator" "${pkgdir}/usr/bin/interrogator"
    install -Dm755 "target/${_target}/release/transponder" "${pkgdir}/usr/bin/transponder"

    # Install man pages
    install -Dm644 "man/interrogator.1" "${pkgdir}/usr/share/man/man1/interrogator.1"
    install -Dm644 "man/transponder.1" "${pkgdir}/usr/share/man/man1/transponder.1"

    # Install Systemd service
    install -Dm644 "systemd/transponder.service" "${pkgdir}/usr/lib/systemd/system/transponder.service"

    # Install shell completions
    install -Dm644 "completions/_interrogator" "${pkgdir}/usr/share/zsh/site-functions/_interrogator"
    install -Dm644 "completions/interrogator.bash" "${pkgdir}/usr/share/bash-completion/completions/interrogator"
    install -Dm644 "completions/interrogator.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/interrogator.fish"

    install -Dm644 "completions/_transponder" "${pkgdir}/usr/share/zsh/site-functions/_transponder"
    install -Dm644 "completions/transponder.bash" "${pkgdir}/usr/share/bash-completion/completions/transponder"
    install -Dm644 "completions/transponder.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/transponder.fish"
}