diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 102 |
1 files changed, 56 insertions, 46 deletions
@@ -1,59 +1,69 @@ # Maintainer: sukanka <su975853527 at gmail dot com> pkgname=clash-meta -pkgver=1.18.1 +pkgver=1.18.2 pkgrel=1 -pkgdesc="Another Clash Kernel by MetaCubeX" -arch=('x86_64' 'aarch64' 'riscv64' 'loong64') -url="https://github.com/MetaCubeX/Clash.Meta" -license=("GPL3") -depends=('glibc' 'clash-geoip') -makedepends=('go') -conflicts=(clash-meta) +pkgdesc="Another Clash Kernel" +arch=(x86_64) +url="https://github.com/MetaCubeX/mihomo" +license=(GPL-3.0-or-later) +depends=(clash-geoip glibc) +makedepends=(go) backup=('etc/clash-meta/config.yaml') -source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz" - "clash-meta.service" - "clash-meta@.service" - "${pkgname}.sysusers" - "${pkgname}.tmpfiles" -) -sha256sums=('ddca7b6c9131ee067b906cc91360837a0e5bdee08a89851226aaed0adc71c086' - 'b6b7ce11489a6f6322a41ce840b3f999b1ec88914f8bd6864c220269231bf759' - 'ec4de877464e595124a5f2752c3f4be157adc85ec5f7f8392c0331cb70fc906a' - '655e8e2edcd82a6bdf2fd12430b7ab6f8e32db8dffce70e7342685a7cc65ebfb' - '50737592c7bd743fe8f543924034718337477a203fa11ef4272cae496df3769c') +source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz" + "https://raw.githubusercontent.com/MetaCubeX/Meta-Docs/main/docs/example/yaml" + "https://raw.githubusercontent.com/MetaCubeX/mihomo/Alpha/.github/mihomo.service") + # Please remove the line once the upstream Meta branch contains mihomo.service file +sha256sums=('49855c53e5717932b9cb933e7f42f58155b52a42bf7db7f35f1fb1d4baa7ee00' + '25a125934bf524b340ec0bfe9be258f41b3ee55b0b23555f1c83ea3a3e776c4f' + '7d2f6de01adbb5dbe7e0d2a00582467faafdb08dce74dd32675cfd94dcbae014') prepare(){ - cd "${srcdir}" - mv mihomo-${pkgver} Clash.Meta-${pkgver} - cd Clash.Meta-${pkgver} - sed -i 's|^const.*|const Name = "clash"|g' constant/path.go + cd "$srcdir" + mv mihomo-$pkgver $pkgname + mv yaml $pkgname/config.yaml + mv mihomo.service $pkgname/mihomo.service } + build(){ - cd "${srcdir}"/Clash.Meta-${pkgver} + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export CGO_ENABLED=1 + cd "$srcdir/$pkgname" BUILDTIME=$(date -u) - NAME=clash-meta - GOOS=linux CGO_ENABLED=0 go build \ - -trimpath \ - -buildmode=pie \ - -mod=readonly \ - -modcacherw \ - -ldflags "-linkmode external -extldflags '${LDFLAGS}' \ - -X 'github.com/metacubex/mihomo/constant.Version=${pkgver}' \ - -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' \ - " \ - -tags with_gvisor -o ${pkgname}-${pkgver} + GOOS=linux go build \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags "-linkmode external -extldflags \"${LDFLAGS}\" \ + -X \"github.com/metacubex/mihomo/constant.Version=${pkgver}\" \ + -X \"github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}\" \ + " \ + -tags with_gvisor -o $pkgname-$pkgver + + echo "u $_pkgname - \"Clash-Meta Service\" - -" > "$_pkgname.sysusers" + echo "d /etc/$_pkgname 0755 $_pkgname $_pkgname -" > "$_pkgname.tmpfiles" + echo "d /var/log/$_pkgname 0700 $_pkgname $_pkgname -" >> "$_pkgname.tmpfiles" + sed -i -e '/Description/s/mihomo/Clash-Meta/' \ + -e "s/mihomo/$_pkgname/g" \ + -e "/^Type=simple/a User=$_pkgname" \ + -e "/^Type=simple/a Group=$_pkgname" mihomo.service +} + +check() { + cd "$srcdir/$pkgname" + go test ./... } + package() { - cd "${srcdir}"/Clash.Meta-${pkgver} - install -Dm755 "${pkgname}-${pkgver}" "${pkgdir}/usr/bin/clash-meta" - install -Dm644 "docs/config.yaml" -t "${pkgdir}/etc/clash-meta" - cd $srcdir - install -Dm644 ${pkgname}.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" - install -Dm644 ${pkgname}.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" - install -Dm644 "clash-meta.service" -t "${pkgdir}/usr/lib/systemd/system" - install -Dm644 "clash-meta@.service" -t "${pkgdir}/usr/lib/systemd/system" - ln -sf /etc/clash/Country.mmdb ${pkgdir}/etc/${pkgname}/Country.mmdb - #geosite.dat from community repo does not work - # ln -sf /usr/share/v2ray/geosite.dat ${pkgdir}/etc/${pkgname}/GeoSite.dat + cd "$srcdir/$pkgname" + install -Dm755 "$pkgname-$pkgver" "$pkgdir/usr/bin/clash-meta" + install -Dm644 "$_pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$_pkgname.conf" + install -Dm644 "$_pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$_pkgname.conf" + install -Dm644 config.yaml "$pkgdir/etc/clash-meta/config.yaml" + install -Dm644 mihomo.service "$pkgdir/usr/lib/systemd/system/clash-meta.service" + ln -s /etc/clash/Country.mmdb "$pkgdir/etc/$_pkgname/Country.mmdb" } |