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

pkgname=opengnb-git
pkgver=1.4.5.b.14.g17c2ab4
pkgrel=2
pkgdesc="GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal."
arch=($CARCH)
url="https://github.com/gnbdev/opengnb"
license=('GPL-3.0-or-later')
provides=(${pkgname%-git})
conflicts=(${pkgname%-git})
replaces=()
depends=(
    bash
    glibc)
makedepends=(git
    sed
    libnatpmp
    miniupnpc
    zlib)
optdepends=()
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| -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/"
}