archrelease: copy trunk to community-any
[ArchLinux/community.git] / clash / repos / community-x86_64 / PKGBUILD
blob02066a28ad188a8650eb90bc43103facb0ecbe3c
1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Contributor: Ariel AxionL <i@axionl.me>
3 # Contributor: Luke Yue <lukedyue@gmail.com>
5 pkgname=clash
6 pkgver=1.15.1
7 pkgrel=1
8 pkgdesc="A rule based proxy in Go"
9 arch=('x86_64')
10 url="https://github.com/Dreamacro/clash"
11 license=('GPL3')
12 options=('!lto')
13 depends=('glibc')
14 makedepends=('go' 'git')
15 source=("clash@.service"
16         "clash_user.service"
17         "${pkgname}-${pkgver}.tar.gz::https://github.com/Dreamacro/clash/archive/v${pkgver}.tar.gz")
18 sha512sums=('5b53faea10bba16df98a74fcbffebb6c8b7f8c238999a147bb848b2c30732688813915fd6bc32f44ec6f90024ad29dbde059e70760c91ccea198dd05da52d077'
19             '3ae61e1c6f0213ea8c3113c62f27c704f04f657cda8c726c0e487194dd5c1ce36e448f6e22b61aeef65f4a1910a2df62a3798f0cba9bae10c8e80a7cb1cfb7b3'
20             '20b8b50952cd7e5b9eae43a062e6cd58d9b6e5fb202366b356f82b66c8c7bd07d618b842c1b66e8d69e8855065420b045e2628e5fe23226f5a255d62bc00c465')
22 build() {
23     export CGO_CPPFLAGS="${CPPFLAGS}"
24     export CGO_CFLAGS="${CFLAGS}"
25     export CGO_CXXFLAGS="${CXXFLAGS}"
26     export CGO_LDFLAGS="${LDFLAGS}"
27     export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
29     cd "${pkgname}-${pkgver}"
30     go build -trimpath -ldflags "-X github.com/Dreamacro/clash/constant.Version=${pkgver}" -mod=readonly
33 check() {
34     cd "${pkgname}-${pkgver}"
35     go test github.com/Dreamacro/clash/...
38 package() {
39     cd "${srcdir}/${pkgname}-${pkgver}"
40     install -Dm755 "clash" "${pkgdir}/usr/bin/clash"
41     install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/clash/LICENSE"
42     install -Dm644 "${srcdir}/clash@.service" "${pkgdir}/usr/lib/systemd/system/clash@.service"
43     install -Dm644 "${srcdir}/clash_user.service" "${pkgdir}/usr/lib/systemd/user/clash.service"