summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 430c400a5d6c47b0923917d78a0562b3325f9abc (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
# Maintainer:
# Contributor: rustemb

_pkgname="shadowsocks-rust"
pkgname="$_pkgname-git"
pkgver=1.21.2.r38.g6900136
pkgrel=2
pkgdesc="A Rust port of shadowsocks"
url="https://github.com/shadowsocks/shadowsocks-rust"
license=('MIT')
arch=('x86_64')

depends=(
  'gcc-libs'
  'glibc'
)
makedepends=(
  'cargo'
  'git'
)

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

options=('!lto')

_pkgsrc="$_pkgname"
source=(
  "$_pkgname"::"git+$url.git"
  'shadowsocks-rust@.service'
  'shadowsocks-rust-server@.service'
)
sha256sums=(
  'SKIP'
  '93cd4fffaaf326beefd2657ed4f3c239d85c207210c63882c71ef0d724304da2'
  'cc1c7c30137e720500206cf0ba4e798ced439e8a01639d28064468e4a1205070'
)

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

prepare() {
  cd "$_pkgsrc"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "$_pkgsrc"
  cargo build --release --frozen --features full-extra
}

package() {
  cd "$_pkgsrc"
  install -Dm755 target/release/{sslocal,ssserver,ssurl,ssmanager,ssservice} -t "$pkgdir"/usr/bin/
  install -Dm644 "$srcdir"/$_pkgname{@,-server@}.service -t "$pkgdir"/usr/lib/systemd/system/
  install -Dm644 examples/config_ext.json "$pkgdir"/etc/$_pkgname/config_ext_rust.json.example
  install -Dm644 examples/config.json "$pkgdir"/etc/$_pkgname/config_rust.json.example
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}