summaryrefslogtreecommitdiff
blob: aeebc636d14f0f5a11ae609c2a97a7f395eb3a3c (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit linux-info

DESCRIPTION="Create tunnels over TCP/IP networks with shaping, encryption, and compression"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
HOMEPAGE="http://vtun.sourceforge.net/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ppc ~sparc x86"
IUSE="lzo socks5 ssl zlib"

RDEPEND="
	lzo? ( dev-libs/lzo:2 )
	socks5? ( net-proxy/dante )
	ssl? ( dev-libs/openssl:0= )
	zlib? ( sys-libs/zlib )
	dev-libs/libbsd"
DEPEND="${RDEPEND}"
BDEPEND="sys-devel/bison"

DOCS=( ChangeLog Credits FAQ README README.Setup README.Shaper TODO )
CONFIG_CHECK="~TUN"

PATCHES=(
	"${FILESDIR}"/${P}-includes.patch
	# remove unneeded checking for /etc/vtund.conf
	"${FILESDIR}"/${PN}-3.0.2-remove-config-presence-check.patch
	# GCC 5 compatibility, patch from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=778164
	"${FILESDIR}"/${P}-gcc5.patch
	# openssl 1.1 compatibility, bug 674280
	"${FILESDIR}"/${PN}-libssl-1.1.patch
	"${FILESDIR}"/${P}-fno-common.patch
	"${FILESDIR}"/${P}-C99-inline.patch
)

src_prepare() {
	default
	sed -i -e '/^LDFLAGS/s|=|+=|g' Makefile.in || die
	sed -i 's:$(BIN_DIR)/strip $(DESTDIR)$(SBIN_DIR)/vtund::' Makefile.in || die
}

src_configure() {
	econf \
		$(use_enable ssl) \
		$(use_enable zlib) \
		$(use_enable lzo) \
		$(use_enable socks5 socks) \
		--enable-shaper
}

src_install() {
	default
	newinitd "${FILESDIR}"/vtun.rc vtun
	insinto /etc
	doins "${FILESDIR}"/vtund-start.conf
	rm -r "${ED}"/var || die
}