1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit go-module systemd
7 DESCRIPTION="A powerful, lightning fast and censorship resistant proxy."
8 HOMEPAGE="https://github.com/apernet/hysteria"
11 https://github.com/apernet/${PN}/archive/refs/tags/app/v${PV}.tar.gz -> ${P}.tar.gz
12 https://github.com/peeweep/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
15 S="${WORKDIR}/${PN}-app-v${PV}"
32 IUSE="+goamd64 ${GO_CPU_FLAGS_X86[@]}"
44 "$@" || die -n "${*} failed"
50 if use cpu_flags_x86_sse3 && use cpu_flags_x86_sse4_1 && use cpu_flags_x86_sse4_2 && use cpu_flags_x86_ssse3
53 if use cpu_flags_x86_avx && use cpu_flags_x86_avx2 && use cpu_flags_x86_f16c && \
54 (use cpu_flags_x86_fma4 || use cpu_flags_x86_fma3)
59 export GOAMD64="${GOAMD64_V}"
60 einfo "building with GOAMD64=${GOAMD64_V}"
65 local APP_SRC_CMD_PKG="github.com/apernet/hysteria/app/cmd"
67 APP_DATE=$(LC_ALL=C date -u +'%Y-%m-%dT%H:%M:%SZ' || die)
68 local APP_ARCH="Unknown"
70 APP_ARCH="amd64-${GOAMD64}"
73 CGO_ENABLED=1 ego build \
75 -ldflags "-s -w -extldflags \"${LDFLAGS}\" \
76 -X \"${APP_SRC_CMD_PKG}.appVersion=${PV}\" \
77 -X \"${APP_SRC_CMD_PKG}.appDate=${APP_DATE}\" \
78 -X \"${APP_SRC_CMD_PKG}.appType=release\" \
79 -X \"${APP_SRC_CMD_PKG}.appPlatform=linux\" \
80 -X \"${APP_SRC_CMD_PKG}.appArch=${APP_ARCH}\" \
89 systemd_dounit "${FILESDIR}/${PN}-server.service"
90 systemd_dounit "${FILESDIR}/${PN}-client.service"
91 newinitd "${FILESDIR}/${PN}-server.initd" "${PN}-server"
92 newinitd "${FILESDIR}/${PN}-client.initd" "${PN}-client"