net-proxy/clash-rs - 0.10.3 (gentoo-zh)

Search

Install

Install this version:

emerge -a =net-proxy/clash-rs-0.10.3

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =net-proxy/clash-rs-0.10.3

Or alternatively:

emerge --autounmask-write -a =net-proxy/clash-rs-0.10.3

Package Information

Description:
Custom protocol, rule based network proxy
Homepage:
https://watfaq.gitbook.io/clashrs-user-manual/ https://github.com/Watfaq/clash-rs/
License:
0BSD Apache-2.0 BSD-2 BSD CC0-1.0 CDLA-Permissive-2.0 GPL-3+ ISC MIT MPL-2.0 Unicode-3.0 Unlicense ZLIB

Ebuild Details

Version EAPI Keywords Slot
0.10.3 8 ~amd64 0
View Raw Ebuild
# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.13.4

EAPI=8

CRATES="
"

declare -A GIT_CRATES=(
	[boring-noise]='https://github.com/Watfaq/boring-noise;9ddf1b54d0c9679e7bc50e9151f72d526190db1a;boring-noise-%commit%'
	[console-api]='https://github.com/tokio-rs/console;59e23edf17b0e42e87e315bfc9cbb8a6ba2f401f;console-%commit%/console-api'
	[console-subscriber]='https://github.com/tokio-rs/console;59e23edf17b0e42e87e315bfc9cbb8a6ba2f401f;console-%commit%/console-subscriber'
	[netstack-lwip]='https://github.com/eycorsican/netstack-lwip;f434fefd6c227c9dfbec84c364452ba6c1532779;netstack-lwip-%commit%'
	[quinn-proto]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn-proto'
	[quinn-udp]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn-udp'
	[quinn]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn'
	[shadowsocks]='https://github.com/Watfaq/shadowsocks-rust;dee2d932dc580e0e1b7a5a591ff5f8c51f70495e;shadowsocks-rust-%commit%/crates/shadowsocks'
	[smoltcp]='https://github.com/smoltcp-rs/smoltcp;ac32e643a4b7e09161193071526b3ca5a0deedb5;smoltcp-%commit%'
	[sock2proc]='https://github.com/Watfaq/sock2proc;9f9e6304d62285115b2e4fa632527ae563bf0fcc;sock2proc-%commit%'
	[tokio-watfaq-rustls]='https://github.com/Watfaq/tokio-rustls;cf8961ac1a36e580d0e38bedc8a41ca4a9b301e8;tokio-rustls-%commit%'
	[tuic-core]='https://github.com/Itsusinn/tuic;18b74bcf11fe33caf9dcfc9e2d6685c5230a2e0a;tuic-%commit%/tuic-core'
	[unix-udp-sock]='https://github.com/Watfaq/unix-udp-sock;847c80b519f0fd8cff5c887ae708429897d08671;unix-udp-sock-%commit%'
	[watfaq-rustls]='https://github.com/Watfaq/rustls;c3ab043d673029d245fd618b9bc86fd6a6109bae;rustls-%commit%/rustls'
)

RUST_MIN_VER="1.91.0"

inherit cargo systemd

DESCRIPTION="Custom protocol, rule based network proxy"
HOMEPAGE="
	https://watfaq.gitbook.io/clashrs-user-manual/
	https://github.com/Watfaq/clash-rs/
"
SRC_URI="
	https://github.com/Watfaq/clash-rs/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://github.com/gentoo-zh-drafts/${PN}/releases/download/v${PV}/${P}-crates.tar.xz
	${CARGO_CRATE_URIS}
"

# Dependent crate licenses
LICENSE+="
	0BSD Apache-2.0 BSD-2 BSD CC0-1.0 CDLA-Permissive-2.0 GPL-3+ ISC MIT
	MPL-2.0 Unicode-3.0 Unlicense ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

IUSE="+lto +standard plus perf bench"
REQUIRED_USE="
	debug? ( !lto )
"

BDEPEND="
	llvm-core/clang
	dev-libs/protobuf
"

PATCHES=(
	"${FILESDIR}/${PN}-0.10.2-remove-default-dashboard.patch"
)

gen_git_crate_dir() {
	# https://github.com/gentoo/gentoo/blob/b09dd88412fe2d5eee5a8891e08bfa2d67848da3/eclass/cargo.eclass#L442
	IFS=';' read -r crate_uri commit crate_dir <<<"${GIT_CRATES[$1]}"
	echo "${WORKDIR}/${crate_dir//%commit%/${commit}}"
}

src_prepare() {
	default
	# Remove the [patch.crates-io] section and add path-based patches
	sed -i '/^\[patch\.crates-io\]/,/^$/d' "${S}/Cargo.toml" || die

	# Add new patch section with local paths
	cat >> "${S}/Cargo.toml" <<-EOF || die
	[patch.crates-io]
	shadowsocks = { path = "$(gen_git_crate_dir shadowsocks)" }
	EOF
}

src_configure() {
	local myfeatures=(
		$(usev standard)
		$(usev plus)
		$(usev perf)
		$(usev bench)
	)
	cargo_src_configure
}

src_compile() {
	if use !debug; then
		# let portage do the strip
		export CARGO_PROFILE_RELEASE_STRIP=false
		if use !lto; then
			export CARGO_PROFILE_RELEASE_LTO=false
		fi
	fi

	cargo_src_compile --package=clash-rs --bin=clash-rs
}

src_install() {
	dobin "$(cargo_target_dir)"/clash-rs
	insinto "/etc/clash-rs"
	doins "${FILESDIR}/config.example.yaml"
	systemd_dounit "${FILESDIR}/clash-rs.service"
}

USE Flags

Manage flags for this package: euse -i <flag> -p net-proxy/clash-rs | euse -E <flag> -p net-proxy/clash-rs | euse -D <flag> -p net-proxy/clash-rs

Global/Standard Flags

lto
Default: Enabled (+)
standard
Default: Enabled (+)

Inherited Eclasses

Dependencies

BDEPEND

	llvm-core/clang
	dev-libs/protobuf

Manifest for 0.10.3

Type File Size Source URLs
DIST clash-rs-0.10.3-crates.tar.xz 73870328 bytes https://github.com/gentoo-zh-drafts/clash-rs/releases/download/v0.10.3/clash-rs-0.10.3-crates.tar.xz
DIST clash-rs-0.10.3.tar.gz 901542 bytes https://github.com/Watfaq/clash-rs/archive/refs/tags/v0.10.3.tar.gz