# Copyright 2025 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;e01409626a15a987b0174d8c78b8181031c37309;boring-noise-%commit%' [netstack-smoltcp]='https://github.com/automesh-network/netstack-smoltcp;62260478079d96b42fa524caa855609312c2cf43;netstack-smoltcp-%commit%' [network-interface]='https://github.com/Watfaq/network-interface;db9f1bcd2faa5122f694283bd300bf42d166d2f3;network-interface-%commit%' [tokio-watfaq-rustls]='https://github.com/Watfaq/tokio-rustls;638db32084d7ecf9c2660847b55d48d1186b4055;tokio-rustls-%commit%' [tracing-oslog]='https://github.com/Absolucy/tracing-oslog;b44d62871464e332249ae79e000dad9ebeb06434;tracing-oslog-%commit%' [tuic-quinn]='https://github.com/Itsusinn/tuic;17ee3f702e26aca048495d4c66ad5316bb8eaf98;tuic-%commit%/tuic-quinn' [tuic]='https://github.com/Itsusinn/tuic;17ee3f702e26aca048495d4c66ad5316bb8eaf98;tuic-%commit%/tuic' [unix-udp-sock]='https://github.com/Watfaq/unix-udp-sock;cd3e4eca43e6f3be82a2703c3d711b7e18fbfd18;unix-udp-sock-%commit%' [watfaq-rustls]='https://github.com/Watfaq/rustls;4cae3aa2e84ea29d8a74b495793773bdb0a72206;rustls-%commit%/rustls' ) 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 GPL-3+ ISC MIT MPL-2.0 Unicode-3.0 Unlicense WTFPL-2 ZLIB " SLOT="0" KEYWORDS="~amd64" # https://github.com/Watfaq/clash-rs/blob/v0.7.6/clash/Cargo.toml IUSE="doc +lto standard plus perf +shadowsocks ssh tuic onion jemallocator bench" REQUIRED_USE=" debug? ( !lto ) standard? ( shadowsocks ssh tuic ) plus? ( standard onion ) perf? ( plus jemallocator ) " BDEPEND="dev-libs/protobuf" PATCHES=( "${FILESDIR}/${P}-unstable-feature.patch" ) src_configure() { local myfeatures=( $(usev bench) $(usev onion) $(usev standard) $(usev plus) $(usev perf) $(usev shadowsocks) $(usev ssh) $(usev tuic) $(usev jemallocator) ) 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 # enable unstable features export RUSTC_BOOTSTRAP=1 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" }