summaryrefslogtreecommitdiff
blob: 4cacbb0f887b65a1181d2d9c369e229e514cfa3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools flag-o-matic

if [[ ${PV} == 9999 ]]; then
	EGIT_REPO_URI="https://github.com/virtualsquare/vde-2"
	inherit git-r3
elif [[ ${PV} == *_p* ]]; then
	MY_COMMIT="c7b36a57831a9067c8619c3e17a03e595623b3eb"
	SRC_URI="https://github.com/virtualsquare/vde-2/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/vde-2-${COMMIT}"
else
	MY_P="${PN}2-${PV}"
	SRC_URI="https://github.com/virtualsquare/vde-2/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/vde-2-${PV}"
fi

DESCRIPTION="Virtual distributed ethernet emulator for emulators like qemu, bochs, and uml"
HOMEPAGE="https://virtualsquare.org/"

LICENSE="GPL-2"
SLOT="0"
if [[ ${PV} != 9999 ]] ; then
	KEYWORDS="~amd64 ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
fi
IUSE="pcap selinux static-libs"

DEPEND="pcap? ( net-libs/libpcap )"
RDEPEND="
	${DEPEND}
	acct-group/qemu
	selinux? ( sec-policy/selinux-vde )
"

src_prepare() {
	default

	eautoreconf
}

src_configure() {
	filter-flags -O0 -Os

	local myeconfargs=(
		# Upstream switched to wolfssl, so no SSL support for now
		--disable-cryptcab
		$(use_enable pcap)
		$(use_enable static-libs static)
	)

	econf "${myeconfargs[@]}"
}

src_install() {
	default

	find "${ED}" -name '*.la' -type f -delete || die

	newinitd "${FILESDIR}"/vde.init-r1 vde
	newconfd "${FILESDIR}"/vde.conf-r1 vde
}

pkg_postinst() {
	einfo "To start vde automatically, add it to the default runlevel:"
	einfo "# rc-update add vde default"
	einfo "You need to setup tap0 in ${EROOT}/etc/conf.d/net"
	einfo "To use it as an user, be sure to set a group in ${EROOT}/etc/conf.d/vde"
}