summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a9d66d57263b185022e9aeedd6be543b48d1a46e (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
# Maintainer: taotieren <admin@taotieren.com>

pkgname=opengnb-git
pkgver=1.4.5.b.1.gb668a52
pkgrel=1
pkgdesc="GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal."
arch=(x86_64
    aarch64
    riscv64)
url="https://github.com/gnbdev/opengnb"
license=('GPL-3.0-or-later')
provides=(${pkgname%-git})
conflicts=(${pkgname%-git})
replaces=()
depends=(
    bash
    glibc)
optdepends=()
makedepends=(git
    sed
    libnatpmp
    miniupnpc
    zlib)
backup=()
options=('!makeflags')
install=
source=("${pkgname}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${pkgname}"
    git describe --tags --always | sed 's/^v\{0,1\}ver\{0,1\}//' | sed 's|-|.|g'
}

prepare() {
    git -C "${srcdir}/${pkgname}" clean -dfx

    cd "${srcdir}/${pkgname}"
    sed -i  -e 's|-I./libs|-I./libs -I/usr/include|g' \
        -e 's|-I./libs/miniupnpc/|-I/usr/include/miniupnpc|g' \
        -e 's|-I./libs/libnatpmp | |g' \
        -e 's|-I./libs/zlib | |g' \
        -e 's| -pthread| -pthread -z relro -z now -z shstk|g' Makefile.linux

    sed -i -e 's|sbin|bin|g' scripts/opengnb\@.service
}

build() {
    cd "${srcdir}/${pkgname}"
    make -f Makefile.linux
}

package() {
    cd "${srcdir}/${pkgname}"
    make -f Makefile.linux install

    install -dm0755 "${pkgdir}/etc/opengnb"
    install -Dm0755  bin/* -t "${pkgdir}/usr/bin/"
    install -Dm0644  scripts/${pkgname%-git}@.service -t "${pkgdir}/usr/lib/systemd/system/"
    install -Dm0644  examples/node_config_example/*.conf -t "${pkgdir}/usr/share/${pkgname}/node_config_example/"
    install -Dm0644  examples/node_config_example/scripts/* -t "${pkgdir}/usr/share/${pkgname}/node_config_example/scripts/"
    install -Dm0644 docs/* -t "${pkgdir}/usr/share/doc/${pkgname}/docs/"
}