forked from microcai/gentoo-zh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: irort <[email protected]>
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
DIST dae-0.8.0.zip 124733240 BLAKE2B 938912224a0824b4f9190927c5153e3e3740109c14af6b42e4cca69a4eb62968a7a5d995298f967c724d1e643c1e567966a0cb541ec0509904ff049c7b70e883 SHA512 d39d0df09937e64551313a3eb464bac6be60aadeffffa1ea87229b3a5e0af672db47712da0d4f33872059c0ef26e640b88f06da21bf9710fa1f4205f9f745809 | ||
DIST dae-0.9.0_rc1.zip 132826351 BLAKE2B 2d44928966a98bd048db639a139d3067d7c0de492b978d87c3b5a28ca6fe4f12892b3481ff146560651ff6294f3b8754489fed3aa9899c03beb1b1d7798e73c6 SHA512 94ee21d1c46cc6c724f59553c840054b16fee80f9bbc65eba02ca46773cd8a88a1c0d16ad7e97ffc11b1064330507423d953da651aac372b616cb4125c73903c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Copyright 1999-2024 Gentoo Authors | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=8 | ||
|
||
inherit flag-o-matic linux-info go-module systemd shell-completion | ||
|
||
_MY_PV=${PV/_rc/rc} | ||
|
||
DESCRIPTION="A lightweight and high-performance transparent proxy solution based on eBPF" | ||
HOMEPAGE="https://github.com/daeuniverse/dae" | ||
SRC_URI=" | ||
https://github.com/daeuniverse/dae/releases/download/v${_MY_PV}/dae-full-src.zip -> ${P}.zip | ||
" | ||
|
||
S="${WORKDIR}" | ||
|
||
LICENSE="AGPL-3" | ||
SLOT="0" | ||
KEYWORDS="~amd64 ~riscv" | ||
MINKV="5.17" | ||
|
||
DEPEND=" | ||
app-alternatives/v2ray-geoip | ||
app-alternatives/v2ray-geosite | ||
" | ||
RDEPEND="$DEPEND" | ||
BDEPEND="sys-devel/clang" | ||
|
||
pkg_pretend() { | ||
local CONFIG_CHECK=" | ||
~BPF | ||
~BPF_SYSCALL | ||
~BPF_JIT | ||
~CGROUPS | ||
~KPROBES | ||
~NET_INGRESS | ||
~NET_EGRESS | ||
~NET_SCH_INGRESS | ||
~NET_CLS_BPF | ||
~NET_CLS_ACT | ||
~BPF_STREAM_PARSER | ||
~DEBUG_INFO | ||
~DEBUG_INFO_BTF | ||
~KPROBE_EVENTS | ||
~BPF_EVENTS | ||
" | ||
|
||
if kernel_is -lt ${MINKV//./ }; then | ||
ewarn "Kernel version at least ${MINKV} required" | ||
fi | ||
|
||
check_extra_config | ||
} | ||
|
||
src_prepare() { | ||
# Prevent conflicting with the user's flags | ||
sed -i -e 's/-O2//' "${S}/Makefile" || die 'Failed to remove -O2 via sed' | ||
sed -i -e 's/-Werror//' "${S}/Makefile" || die 'Failed to remove -Werror via sed' | ||
|
||
default | ||
} | ||
|
||
src_compile() { | ||
#-flto makes llvm-strip complains | ||
#llvm-strip: error: '*/control/bpf_bpfel.o': The file was not recognized as a valid object file | ||
filter-lto | ||
# for dae's ebpf target | ||
# gentoo-zh#3720 | ||
filter-flags "-march=*" "-mtune=*" | ||
append-cflags "-fno-stack-protector" | ||
|
||
emake VERSION="${PV}" GOFLAGS="-buildvcs=false -w" | ||
} | ||
|
||
src_install() { | ||
dobin dae | ||
|
||
systemd_dounit install/dae.service | ||
newinitd "${FILESDIR}"/dae.initd dae | ||
|
||
insinto /etc/dae | ||
newins example.dae config.dae.example | ||
newins install/empty.dae config.dae | ||
|
||
newbashcomp install/shell-completion/dae.bash dae | ||
newfishcomp install/shell-completion/dae.fish dae.fish | ||
newzshcomp install/shell-completion/dae.zsh _dae | ||
|
||
dosym -r "/usr/share/v2ray/geosite.dat" /usr/share/dae/geosite.dat | ||
dosym -r "/usr/share/v2ray/geoip.dat" /usr/share/dae/geoip.dat | ||
} |