diff options
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | PKGBUILD | 91 | ||||
-rw-r--r-- | clash.service | 13 | ||||
-rw-r--r-- | clash@.service | 14 | ||||
-rw-r--r-- | config.yaml | 73 |
5 files changed, 71 insertions, 148 deletions
@@ -1,26 +1,20 @@ pkgbase = clash-meta-alpha-git - pkgdesc = A rule-based tunnel in Go - pkgver = Prerelease.Alpha.r0.g2899a12 + pkgdesc = Another Clash Kernel by MetaCubeX (git virsion) + pkgver = 2024032823.11f0983e pkgrel = 1 - url = https://github.com/MetaCubeX/Clash.Meta + url = https://github.com/MetaCubeX/mihomo arch = x86_64 - license = GPL3 + license = GPL-3.0-or-later makedepends = git makedepends = go + depends = clash-geoip depends = glibc - provides = clash - provides = clash-dev - conflicts = clash - conflicts = clash-dev - options = !lto - backup = etc/clash/config.yaml - source = git+https://github.com/MetaCubeX/Clash.Meta.git#branch=Alpha - source = config.yaml - source = clash.service - source = clash@.service + provides = clash-meta + provides = clash-meta-alpha + conflicts = clash-meta + conflicts = clash-meta-alpha + backup = etc/clash-meta/config.yaml + source = clash-meta::git+https://github.com/MetaCubeX/mihomo.git#branch=Alpha sha256sums = SKIP - sha256sums = c4af03523b8006d206440163406ee9b4de1a10bb5023fb3194490b8225a5e481 - sha256sums = e7370a0c60147839d923a61189968a0e781857d036c9e0751b16ddce1fb61b0c - sha256sums = 3ba4a71955e8f4676eda68e7c5a1d9c02ad9d8e9fd4bbf8f35487bdc768290ef pkgname = clash-meta-alpha-git @@ -1,43 +1,72 @@ -# Maintainer: txyyh <zjh330726@gmail.com> +# Maintainer: sukanka <su975853527 at gmail dot com> +# Maintainer: Roald Clark <roaldclark at gmail dot com> pkgname=clash-meta-alpha-git -_pkgname=Clash.Meta -pkgver=Prerelease.Alpha.r0.g2899a12 +_pkgname=clash-meta +pkgver=2024032823.11f0983e pkgrel=1 -pkgdesc="A rule-based tunnel in Go" -arch=('x86_64') -url="https://github.com/MetaCubeX/Clash.Meta" -license=('GPL3') -depends=('glibc') -makedepends=('git' 'go') -provides=('clash' 'clash-dev') -conflicts=('clash' 'clash-dev') -backup=("etc/clash/config.yaml") -options=('!lto') -source=("git+${url}.git#branch=Alpha" - "config.yaml" - "clash.service" - "clash@.service") -sha256sums=('SKIP' - 'c4af03523b8006d206440163406ee9b4de1a10bb5023fb3194490b8225a5e481' - 'e7370a0c60147839d923a61189968a0e781857d036c9e0751b16ddce1fb61b0c' - '3ba4a71955e8f4676eda68e7c5a1d9c02ad9d8e9fd4bbf8f35487bdc768290ef') +pkgdesc="Another Clash Kernel by MetaCubeX (git virsion)" +arch=(x86_64) +url="https://github.com/MetaCubeX/mihomo" +license=(GPL-3.0-or-later) +depends=(clash-geoip glibc) +makedepends=(git go) +provides=(clash-meta clash-meta-alpha) +conflicts=(clash-meta clash-meta-alpha) +backup=('etc/clash-meta/config.yaml') +source=("$_pkgname::git+$url.git#branch=Alpha") +sha256sums=('SKIP') pkgver() { - cd "${srcdir}"/"${_pkgname}"/ - git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' + cd "$_pkgname" + TZ=UTC git log -1 --pretty=format:"%cd.%h" --date=format:"%Y%m%d%H" +} + +prepare() { + cd "$_pkgname" + mv .github/mihomo.service "$_pkgname.service" } build() { - cd "${srcdir}"/"${_pkgname}"/ - make linux-amd64 + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export CGO_ENABLED=1 + cd "$_pkgname" + BUILDTIME=$(date -u --rfc-3339=seconds) + LDFLAGS="-linkmode external -extldflags \"${LDFLAGS}\"" + OTHER_FLAGS="-X \"github.com/metacubex/mihomo/constant.Version=${pkgver}\" \ + -X \"github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}\"" + GOOS=linux go build \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags "$LDFLAGS $OTHER_FLAGS" \ + -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" "$_pkgname.service" +} + +check() { + cd "$_pkgname" + go test ./... } package() { - cd "${srcdir}"/"${_pkgname}"/ - mv bin/Clash.Meta-linux-amd64 bin/clash - install -Dm 755 bin/clash -t "${pkgdir}"/usr/bin/ - install -Dm 644 "${srcdir}"/config.yaml -t "${pkgdir}"/etc/clash/ - install -Dm 644 "${srcdir}"/clash.service -t "${pkgdir}"/usr/lib/systemd/system/ - install -Dm 644 "${srcdir}"/clash@.service -t "${pkgdir}"/usr/lib/systemd/system/ + cd "$_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 docs/config.yaml "$pkgdir/etc/clash-meta/config.yaml" + install -Dm644 "$_pkgname.service" "$pkgdir/usr/lib/systemd/system/$_pkgname.service" + ln -s /etc/clash/Country.mmdb "$pkgdir/etc/$_pkgname/Country.mmdb" } diff --git a/clash.service b/clash.service deleted file mode 100644 index 9e0daa905b74..000000000000 --- a/clash.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Clash-Meta Daemon, Another Clash Kernel. -After=network.target NetworkManager.service systemd-networkd.service iwd.service - -[Service] -Type=exec -CapabilityBoundingSet=cap_net_admin cap_sys_admin -AmbientCapabilities=cap_net_admin cap_sys_admin -Restart=on-abort -ExecStart=/usr/bin/clash -d /etc/clash - -[Install] -WantedBy=multi-user.target diff --git a/clash@.service b/clash@.service deleted file mode 100644 index bfa55da22955..000000000000 --- a/clash@.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Clash-Meta Daemon, Another Clash Kernel. -After=network.target NetworkManager.service systemd-networkd.service iwd.service - -[Service] -Type=exec -User=%i -CapabilityBoundingSet=cap_net_admin -AmbientCapabilities=cap_net_admin -Restart=on-abort -ExecStart=/usr/bin/clash - -[Install] -WantedBy=multi-user.target diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 4b69b9b7d5cb..000000000000 --- a/config.yaml +++ /dev/null @@ -1,73 +0,0 @@ -# ipv6: false # When set to false, resolver won't translate hostnames to IPv6 addresses -# tcp-concurrent: true # default false -# geodata-mode: true -# external-controller: 127.0.0.1:9090 -# external-ui: dashboard -# secret: '' -log-level: info - - -dns: - enable: true - # listen: 0.0.0.0:53 - # ipv6: false # when the false, response to AAAA questions will be empty - - # These nameservers are used to resolve the DNS nameserver hostnames below. - # Specify IP addresses only - enhanced-mode: fake-ip # redir-host # (not recommended) - # fake-ip-range: 198.18.0.1/16 # Fake IP addresses pool CIDR - # use-hosts: true # lookup hosts and return IP record - - # Hostnames in this list will not be resolved with fake IPs - # i.e. questions to these domain names will always be answered with their - # real IP addresses - # fake-ip-filter: - # - '*.lan' - # - localhost.ptlogin2.qq.com - - # Supports UDP, TCP, DoT, DoH. You can specify the port to connect to. - # All DNS questions are sent directly to the nameserver, without proxies - # involved. Clash answers the DNS question with the first result gathered. - nameserver: - - tls://1dot1dot1dot1.cloudflare-dns.com # DNS over TLS - - https://1.1.1.1/dns-query # DNS over HTTPS - - 1.1.1.1 # Cloudflare - - 1.0.0.1 # Cloudflare - - # When `fallback` is present, the DNS server will send concurrent requests - # to the servers in this section along with servers in `nameservers`. - # The answers from fallback servers are used when the GEOIP country - # is not `CN`. - # fallback: - # - tcp://1.1.1.1 - - # If IP addresses resolved with servers in `nameservers` are in the specified - # subnets below, they are considered invalid and results from `fallback` - # servers are used instead. - # - # IP address resolved with servers in `nameserver` is used when - # `fallback-filter.geoip` is true and when GEOIP of the IP address is `CN`. - # - # If `fallback-filter.geoip` is false, results from `nameserver` nameservers - # are always used if not match `fallback-filter.ipcidr`. - # - # This is a countermeasure against DNS pollution attacks. - # fallback-filter: - # geoip: true - # ipcidr: - # - 240.0.0.0/4 - # domain: - # - '+.google.com' - # - '+.facebook.com' - # - '+.youtube.com' - -# Enable the TUN listener -tun: - enable: true - stack: system # or gvisor - device: Meta - dns-hijack: - - any:53 - auto-route: true # auto set global route - auto-detect-interface: true # conflict with interface-name - |