summaryrefslogtreecommitdiff
blob: c5805c7696e24975f99c099eead29bb2998ca143 (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
72
73
74
75
76
77
78
79
80
81
82
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools flag-o-matic toolchain-funcs

DESCRIPTION="Linux Point-to-Point Tunnelling Protocol Server"
HOMEPAGE="http://poptop.sourceforge.net/"
SRC_URI="mirror://sourceforge/poptop/${P}.tar.gz"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc x86"
IUSE="gre-extreme-debug tcpd"

RDEPEND="net-dialup/ppp:=
	tcpd? ( sys-apps/tcp-wrappers )"
DEPEND="${RDEPEND}
	elibc_musl? ( net-libs/ppp-defs )"

DOCS=( AUTHORS ChangeLog NEWS README TODO )

src_prepare() {
	# configure.in is actually configure.ac
	mv configure.in configure.ac || die

	# Automake 1.13 compatibility, bug #469476
	sed -i -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADER/' configure.ac || die 'sed on configure.ac failed'

	# remove 'missing' script to prevent warnings
	rm missing || die 'remove missing script failed'

	# respect compiler, bug #461722
	tc-export CC

	local PATCHES=(
		"${FILESDIR}/${P}-gentoo.patch"
		"${FILESDIR}/${P}-sandbox-fix.patch"
		"${FILESDIR}/${P}-pidfile.patch"
		"${FILESDIR}/${P}-libdir.patch"
		"${FILESDIR}/${P}-musl.patch"
		"${FILESDIR}/${P}-c99.patch"
	)

	if has_version -d ">=net-dialup/ppp-2.5.0"; then
		# https://bugs.gentoo.org/904877
		PATCHES+=( "${FILESDIR}/${P}-ppp-2.5.0.patch" )
	fi

	# Call to default src_prepare to apply patches
	default

	eautoreconf
}

src_configure() {
	use gre-extreme-debug && append-cppflags "-DLOG_DEBUG_GRE_ACCEPTING_PACKET"
	econf \
		--enable-bcrelay \
		$(use tcpd && echo "--with-libwrap")
}

src_compile() {
	emake COPTS="${CFLAGS}"
}

src_install() {
	default

	insinto /etc
	doins samples/pptpd.conf

	insinto /etc/ppp
	doins samples/options.pptpd

	newinitd "${FILESDIR}/pptpd-init-r2" pptpd
	newconfd "${FILESDIR}/pptpd-confd" pptpd

	dodoc README.*
	dodoc -r samples
}