summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8fef52cf51519de380f6ce8e80192a9756fcca1f (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
# Maintainer: nekohasekai <contact-archlinux@sekai.icu>

pkgname=sing-ss-server-git
pkgver=r25.7311f6d
pkgrel=1
pkgdesc="A simple shadowsocks server."
arch=(x86_64)
url="https://github.com/sagernet/sing-tools"
license=(GPL3)
depends=(glibc)
makedepends=(go git)
provides=(ss-server)
conflicts=(sing-ss-server-dev-git)
source=("$pkgname::git+$url.git")
sha512sums=('SKIP')
install=".install"

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

pkgver() {
  cd "$srcdir/$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  export CGO_ENABLED=1
  cd "$srcdir/$pkgname"
  go build -v -o ss-server -buildmode=pie -trimpath -ldflags "-s -w -buildid=" ./cli/ss-server
  go build -v -o ss-server-gencfg -buildmode=pie -trimpath -ldflags "-s -w -buildid=" ./cli/ss-server-gencfg
}

package() {
  cd "$srcdir/$pkgname"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/ss-server/LICENSE"
  install -Dm644 release/ss-server/systemd/ss-server.service "$pkgdir/usr/lib/systemd/system/ss-server.service"
  install -Dm644 release/ss-server/systemd/ss-server@.service "$pkgdir/usr/lib/systemd/system/ss-server@.service"
  install -Dm755 ss-server -t "$pkgdir/usr/bin/"
  install -Dm755 ss-server-gencfg -t "$pkgdir/usr/bin/"
}