blob: 62f44516a39e19ec00c921e087c4fa4003388662 (
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
|
# Contributor: taotieren <admin@taotieren.com>
pkgname=cloudflarespeedtest-git
pkgver=2.2.5.25.g1d9d742
pkgrel=1
pkgdesc="XIU2/CloudflareSpeedTest 🌩 “Choose Your Own Preferred IP” Test Cloudflare CDN latency and speed, get the fastest IP! Written in go."
arch=($CARCH)
url="https://github.com/XIU2/CloudflareSpeedTest"
license=('GPL-3.0-only')
provides=(${pkgname%-git})
conflicts=(${pkgname%-git})
#replaces=(${pkgname})
depends=(go)
optdepends=()
makedepends=('git')
backup=()
options=()
#install=${pkgname}.install
source=("${pkgname%-git}::git+${url}.git")
sha256sums=('SKIP')
pkgver() {
cd "${srcdir}/${pkgname%-git}"
git describe --tags | sed 's/^v//;s/-/./g'
}
prepare() {
cd "${srcdir}/${pkgname%-git}"
go mod tidy
mkdir -p build/
}
build() {
cd "${srcdir}/${pkgname%-git}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build -o build
}
package() {
cd "${srcdir}/${pkgname%-git}"
install -Dm0755 build/CloudflareSpeedTest "${pkgdir}"/usr/share/${pkgname%-git}/${pkgname%-git}
install -Dm0755 script/cfst_hosts.sh "${pkgdir}"/usr/share/${pkgname%-git}/cfst-hosts
cp -rv *.txt "${pkgdir}"/usr/share/${pkgname%-git}/
install -Dm0644 "${srcdir}/${pkgname%-git}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname%-git}/LICENSE"
install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/CloudflareST" <<EOF
#!/bin/sh
cd /usr/share/${pkgname%-git}/
./${pkgname%-git} "\$@"
EOF
ln -sf /usr/share/${pkgname%-git}/cfst-hosts "${pkgdir}"/usr/bin/cfst-hosts
}
|