summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4195fa7175ecee891607c42b535bcf8cfda5f8eb (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
# Maintainer: detiam <dehe_tian@outlook.com>

# pcap have more feature, but require libpcap
_use_pcap=${_use_pcap-y}

_pkgname=phantomsocks
pkgname=phantomsocks-ipv6-git
pkgver=r314.45a6f83
pkgrel=1
pkgdesc="A cross-platform proxy client/server for Linux/Windows/macOS (resolve both ipv4 and ipv6 dns record)"
arch=(i686 x86_64)
url="https://github.com/detiam/$_pkgname"
license=('LGPL-3.0')

provides=("$_pkgname")
conflicts=("$_pkgname")
replaces=("$_pkgname")
makedepends=('go' 'git')
depends=('systemd' 'jq')

install=$_pkgname.install
source=(
    "git+${url}.git"
    "$_pkgname-init.sh"
    "$_pkgname.service")
sha256sums=('SKIP'
            '22d5545c6bb8430cd8efd1452e0647ee0d3feab0c8e775167ec291e4fba24927'
            '4602cf1421b16780aea3eef1d69ed44197efa6cbfe5e64193a127852ba71750c')

pkgver() {
    cd "$_pkgname"
    ( set -o pipefail
        git describe --long --abbrev=7 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
    )
}

#prepare() {
#    cd "$_pkgname"
#}

build() {
    cd "$_pkgname"
    if [[ $_use_pcap == y ]]; then
        go build -tags pcap
    else
        go build -tags rawsocket
    fi
}

package() {
    if [[ $_use_pcap == y ]]; then
        depends+=('libpcap')
    fi

    install -dm755 "$pkgdir/usr/bin"
    install -dm755 "$pkgdir/usr/lib/systemd/user"
    install -dm755 "$pkgdir/usr/share/phantomsocks"

    install -Dm644 "$_pkgname.service" "$pkgdir/usr/lib/systemd/user/"
    install "$_pkgname-init.sh" "$pkgdir/usr/bin/$_pkgname-init"

    cd "$_pkgname"

    install -Dm644 "config.json" "$pkgdir/usr/share/phantomsocks"
    install -Dm644 "default.conf" "$pkgdir/usr/share/phantomsocks"

    install "$_pkgname" "$pkgdir/usr/bin/$_pkgname"
}