Skip to content

Commit

Permalink
Merge pull request #3786 from liuyujielol/clash1180
Browse files Browse the repository at this point in the history
net-proxy/clash: add 1.18.0
  • Loading branch information
tlze authored Nov 2, 2023
2 parents 3954797 + 6a534fd commit b8dedf4
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 42 deletions.
2 changes: 2 additions & 0 deletions net-proxy/clash/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
DIST clash-1.17.0-deps.tar.xz 84573276 BLAKE2B dab84f79a07ba253d3ce8c2aa53f49312314c51cd2b2897141c9de1e92d6ef4fe565f29dd7adb575199077088bd37cddea79913b6d6e70e34c07440d8ec8456b SHA512 8bb1ed9fed29aa073a76d44250d2248e14f98225e6695b1d4837761d860d9e9a4ddde9712ffc62a7d3e99562754660a623987beade7c67e406dccd13a1369599
DIST clash-1.17.0.tar.gz 295770 BLAKE2B 3c2f05ffb2662bbc633606eefb5e26af1cdc66990cda3f5de1b91f0cca92e8bd59a93c9ce2b419d6607cfb7a20223e4f4505b54054fc1a0947bf324b6b3e3684 SHA512 c2e6438f2c7f3ccec6d746e30d9d526431eb1639d7f2af0c13d5e15936fd86adf43a7d7362ede46ca3cf2a83d97a0e3c9f67d5a75b56411422a83bd0b22941a6
DIST clash-1.18.0-deps.tar.xz 82209412 BLAKE2B 946cad9ac54c72d47577b26cab52a3db0c7f70eaf874b6d4eeaf612eadc7104c67ef4fb0e59c885aaa7289b1010b5de08155d1c89f3343d503d98618b5831045 SHA512 1604c3f35ec0ceac126a67056bfe3db3a8882148b4c7493541940ef5ff2666ce813baa1cf83ccac5cb5de8e98e9febd63ede47f68c0363258a5a1e1648e018e9
DIST clash-1.18.0.tar.gz 323277 BLAKE2B 4f75240bd180ccf9ebcd855b2e246c0ff2a0745cbd5dc81a0ca375c5874dbd8a55f2b2da64eed94724a07e9eb754c3a8735305bd983e5b42ad5eafb2c43e8e46 SHA512 b062b477ea23860d400b6d9280d0cf53d8e0b41a5105ce3b9cb374288087bcefd21949b89434a3dde151ea58d27574c0e97369d64fa9090b712182f14bb71380
98 changes: 98 additions & 0 deletions net-proxy/clash/clash-1.18.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
inherit go-module systemd

DESCRIPTION="A rule-based tunnel in Go."
HOMEPAGE="https://github.com/Dreamacro/clash"

SRC_URI="
https://github.com/Dreamacro/clash/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/liuyujielol/vendors/releases/download/${PN}/${P}-deps.tar.xz
"

RESTRICT="mirror"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc64 ~s390 ~x86"

GO_CPU_FLAGS_X86="
cpu_flags_x86_avx2
cpu_flags_x86_fma4
cpu_flags_x86_fma3
cpu_flags_x86_f16c
cpu_flags_x86_avx
cpu_flags_x86_sse4_2
cpu_flags_x86_sse4_1
cpu_flags_x86_ssse3
cpu_flags_x86_sse3
"

IUSE="goamd64 geoip ${GO_CPU_FLAGS_X86[@]}"
REQUIRED_USE="!amd64? ( !goamd64 )"

BDEPEND=">=dev-lang/go-1.21:="
RDEPEND="!arm64? (
geoip? ( net-misc/geoipupdate )
)"

pkg_setup() {
if use goamd64; then
# default value of GOAMD64
GOAMD64_V="v1"
if use cpu_flags_x86_sse3 && use cpu_flags_x86_sse4_1 && use cpu_flags_x86_sse4_2 && use cpu_flags_x86_ssse3
then
GOAMD64_V="v2"
if use cpu_flags_x86_avx && use cpu_flags_x86_avx2 && use cpu_flags_x86_f16c && \
(use cpu_flags_x86_fma4 || use cpu_flags_x86_fma3)
then
GOAMD64_V="v3"
fi
# v4 generates AVX512 instructions thus
# GOAMD64=v4 is currently not used on go-1.18
fi
export GOAMD64="${GOAMD64_V}"
einfo "building with GOAMD64=${GOAMD64_V}"
fi
}

src_compile() {
local Version="${PV}" BuildTime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
local ldflags="\
-X \"github.com/Dreamacro/clash/constant.Version=v${Version}\" \
-X \"github.com/Dreamacro/clash/constant.BuildTime=${BuildTime}\" \
-w -s -buildid="
ego build -o bin/clash -trimpath -ldflags "${ldflags}"
}

src_test() {
ego test github.com/Dreamacro/clash/...
}

src_install() {
dobin bin/clash

systemd_newunit "${FILESDIR}/clash-r1.service" clash.service
#systemd_newunit "${FILESDIR}/clash_at.service" [email protected]

newinitd "${FILESDIR}"/${PN}.initd ${PN}
newconfd "${FILESDIR}"/${PN}.confd ${PN}

keepdir /etc/clash
}

pkg_postinst() {
elog
elog "Follow the instructions of https://dreamacro.github.io/clash"
elog
elog "If started by systemd, by default clash will"
elog "try to download Country.mmdb to ${EROOT}/var/cache/clash"
elog "If it fails to do so,You may need to get Country.mmdb file from"
elog ""
elog "https://github.com/Dreamacro/maxmind-geoip"
elog "or"
elog "https://dev.maxmind.com/geoip/geoip2/geolite2"
elog
}
21 changes: 0 additions & 21 deletions net-proxy/clash/files/clash.service

This file was deleted.

21 changes: 0 additions & 21 deletions net-proxy/clash/files/clash_at.service

This file was deleted.

0 comments on commit b8dedf4

Please sign in to comment.