summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authortaotieren2022-01-06 22:47:09 +0800
committertaotieren2022-01-06 22:47:09 +0800
commit9a1366559424233c3f3d681e8eb39ab2feab3b50 (patch)
tree2651496e6f6664e564952d332b9866b0bc73f1b1 /PKGBUILD
downloadaur-9a1366559424233c3f3d681e8eb39ab2feab3b50.tar.gz
update 2.0.2+10+gb2422ca
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD58
1 files changed, 58 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..b21645b56c6d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,58 @@
+# Contributor: taotieren <admin@taotieren.com>
+
+pkgname=cloudflarespeedtest-git
+pkgver=2.0.2+10+gb2422ca
+pkgrel=1
+pkgdesc="「自选优选 IP / 过滤假墙」测试 Cloudflare CDN 延迟和速度,获取最快 IP (IPv4+IPv6)! "
+arch=('any')
+url="https://github.com/XIU2/CloudflareSpeedTest"
+license=('GPLv3')
+provides=(${pkgname})
+conflicts=(${pkgname} ${pkgname%-git})
+#replaces=(${pkgname})
+depends=(go git)
+optdepends=()
+makedepends=('git')
+backup=()
+options=('!strip')
+#install=${pkgname}.install
+source=("${pkgname%-git}::git+https://ghproxy.com/${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
+}