1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils multilib toolchain-funcs linux-info pam
10 DESCRIPTION="Point-to-Point Protocol (PPP)"
11 HOMEPAGE="http://www.samba.org/ppp"
12 SRC_URI="ftp://ftp.samba.org/pub/ppp/${P}.tar.gz
13 https://dev.gentoo.org/~floppym/dist/${P}-patches-${PATCH_VER}.tar.xz
14 http://www.netservers.co.uk/gpl/ppp-dhcpc.tgz"
18 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
19 IUSE="activefilter atm dhcp eap-tls gtk ipv6 pam radius"
21 DEPEND="activefilter? ( net-libs/libpcap )
22 atm? ( net-dialup/linux-atm )
24 gtk? ( x11-libs/gtk+:2 )
25 eap-tls? ( net-misc/curl dev-libs/openssl )"
29 # Use the headers from the kernel #427684
30 rm include/linux/if_pppol2tp.h || die
32 mv "${WORKDIR}/dhcp" "${S}/pppd/plugins" || die
34 use eap-tls || EPATCH_EXCLUDE+=" 8?_all_eaptls-*"
35 EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
38 einfo "Enabling PPPoATM support"
39 sed -i '/^#HAVE_LIBATM=yes/s:#::' pppd/plugins/pppoatm/Makefile.linux || die
42 if ! use activefilter ; then
43 einfo "Disabling active filter"
44 sed -i '/^FILTER=y/s:^:#:' pppd/Makefile.linux || die
49 sed -i '/^#USE_PAM=y/s:^#::' pppd/Makefile.linux || die
54 sed -i '/#HAVE_INET6/s:#::' pppd/Makefile.linux || die
58 sed -i '/^#CBCP=y/s:#::' pppd/Makefile.linux || die
61 einfo "Adding ppp-dhcp plugin files"
63 -e '/^SUBDIRS :=/s:$: dhcp:' \
64 pppd/plugins/Makefile.linux || die
68 sed -i -e "s:/lib/pppd:/$(get_libdir)/pppd:" \
69 pppd/{pathnames.h,pppd.8}
72 #set the right paths in radiusclient.conf
73 sed -i -e "s:/usr/local/etc:/etc:" \
74 -e "s:/usr/local/sbin:/usr/sbin:" pppd/plugins/radius/etc/radiusclient.conf
75 #set config dir to /etc/ppp/radius
76 sed -i -e "s:/etc/radiusclient:/etc/ppp/radius:g" \
77 pppd/plugins/radius/{*.8,*.c,*.h} \
78 pppd/plugins/radius/etc/*
80 einfo "Disabling radius"
81 sed -i -e '/+= radius/s:^:#:' pppd/plugins/Makefile.linux
87 emake COPTS="${CFLAGS} -D_GNU_SOURCE"
92 emake -f Makefile.linux
100 for i in chat pppd pppdump pppstats ; do
104 fperms u+s-w /usr/sbin/pppd
106 # Install pppd header files
107 emake -C pppd INSTROOT="${D}" install-devel
109 dosbin pppd/plugins/rp-pppoe/pppoe-discovery
114 newins etc.ppp/pap-secrets pap-secrets.example
115 newins etc.ppp/chap-secrets chap-secrets.example
118 doins etc.ppp/options
121 for i in ip-up ip-down ; do
122 doexe "${WORKDIR}/scripts/${i}"
123 insinto /etc/ppp/${i}.d
124 use ipv6 && dosym ${i} /etc/ppp/${i/ip/ipv6}
125 doins "${WORKDIR}/scripts/${i}.d"/*
128 pamd_mimic_system ppp auth account session
130 local PLUGINS_DIR=/usr/$(get_libdir)/pppd/$(awk -F '"' '/VERSION/ {print $2}' pppd/patchlevel.h)
131 # closing " for syntax coloring
132 insinto "${PLUGINS_DIR}"
134 doins pppd/plugins/minconn.so
135 doins pppd/plugins/passprompt.so
136 doins pppd/plugins/passwordfd.so
137 doins pppd/plugins/winbind.so
138 doins pppd/plugins/rp-pppoe/rp-pppoe.so
139 doins pppd/plugins/pppol2tp/openl2tp.so
140 doins pppd/plugins/pppol2tp/pppol2tp.so
142 doins pppd/plugins/pppoatm/pppoatm.so
145 doins pppd/plugins/dhcp/dhcpc.so
148 doins pppd/plugins/radius/rad{ius,attr,realms}.so
150 #Copy radiusclient configuration files (#92878)
151 insinto /etc/ppp/radius
153 doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
155 doman pppd/plugins/radius/pppd-rad{ius,attr}.8
158 insinto /etc/modprobe.d
160 newins "${FILESDIR}/modules.ppp" ppp.conf
162 dodoc PLUGINS README* SETUP Changes-2.3 FAQ
163 dodoc "${FILESDIR}/README.mpls"
165 dosbin scripts/p{on,off,log}
168 # Adding misc. specialized scripts to doc dir
169 insinto /usr/share/doc/${PF}/scripts/chatchat
170 doins scripts/chatchat/*
171 insinto /usr/share/doc/${PF}/scripts
175 dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
176 newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
178 newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
180 doman contrib/pppgetpass/pppgetpass.8
184 if linux-info_get_any_version && linux_config_src_exists ; then
186 ewarn "If the following test report contains a missing kernel configuration option that you need,"
187 ewarn "you should reconfigure and rebuild your kernel before running pppd."
188 CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
189 local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
190 local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
191 local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
192 if use activefilter ; then
193 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
194 local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
196 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
197 local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
198 local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
199 local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
200 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
201 local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by rp-pppoe plugin)"
202 local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by rp-pppoe and dhcpc plugins)"
204 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
205 local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
210 # create *-secrets files if not exists
211 [ -f "${ROOT}/etc/ppp/pap-secrets" ] || \
212 cp -pP "${ROOT}/etc/ppp/pap-secrets.example" "${ROOT}/etc/ppp/pap-secrets"
213 [ -f "${ROOT}/etc/ppp/chap-secrets" ] || \
214 cp -pP "${ROOT}/etc/ppp/chap-secrets.example" "${ROOT}/etc/ppp/chap-secrets"
216 # lib name has changed
217 sed -i -e "s:^pppoe.so:rp-pppoe.so:" "${ROOT}/etc/ppp/options"
220 elog "Pon, poff and plog scripts have been supplied for experienced users."
221 elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
222 elog "/usr/share/doc/${PF}/scripts directory."