1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit linux-info multilib pam toolchain-funcs
9 DESCRIPTION="Point-to-Point Protocol (PPP)"
10 HOMEPAGE="https://ppp.samba.org/"
11 SRC_URI="https://download.samba.org/pub/ppp/${P}.tar.gz
12 https://dev.gentoo.org/~polynomial-c/${P}-patches-${PATCH_VER}.tar.xz
13 http://www.netservers.net.uk/gpl/ppp-dhcpc.tgz"
17 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~riscv ~s390 ~sh sparc x86"
18 IUSE="activefilter atm dhcp eap-tls gtk ipv6 libressl pam radius"
21 activefilter? ( net-libs/libpcap )
22 atm? ( net-dialup/linux-atm )
24 gtk? ( x11-libs/gtk+:2 )
25 !libressl? ( dev-libs/openssl:0= )
26 libressl? ( dev-libs/libressl:= )
29 PDEPEND="net-dialup/ppp-scripts"
32 mv "${WORKDIR}/dhcp" "${S}/pppd/plugins" || die
34 if ! use eap-tls ; then
35 rm "${WORKDIR}"/patch/8?_all_eaptls-* || die
37 eapply "${WORKDIR}"/patch
40 einfo "Enabling PPPoATM support"
41 sed -i '/^#HAVE_LIBATM=yes/s:#::' \
42 pppd/plugins/pppoatm/Makefile.linux || die
45 if ! use activefilter ; then
46 einfo "Disabling active filter"
47 sed -i '/^FILTER=y/s:^:#:' pppd/Makefile.linux || die
52 sed -i '/^#USE_PAM=y/s:^#::' pppd/Makefile.linux || die
57 sed -i '/#HAVE_INET6/s:#::' pppd/Makefile.linux || die
58 echo "+ipv6" >> etc.ppp/options || die
62 sed -i '/^#CBCP=y/s:#::' pppd/Makefile.linux || die
65 einfo "Adding ppp-dhcp plugin files"
67 -e '/^SUBDIRS :=/s:$: dhcp:' \
68 -i pppd/plugins/Makefile.linux || die
72 sed -i -e "s:/lib/pppd:/$(get_libdir)/pppd:" \
73 pppd/{pathnames.h,pppd.8} || die
76 #set the right paths in radiusclient.conf
77 sed -e "s:/usr/local/etc:/etc:" \
78 -e "s:/usr/local/sbin:/usr/sbin:" \
79 -i pppd/plugins/radius/etc/radiusclient.conf || die
80 #set config dir to /etc/ppp/radius
81 sed -i -e "s:/etc/radiusclient:/etc/ppp/radius:g" \
82 pppd/plugins/radius/{*.8,*.c,*.h} \
83 pppd/plugins/radius/etc/* || die
85 einfo "Disabling radius"
86 sed -i -e '/+= radius/s:^:#:' pppd/plugins/Makefile.linux || die
89 # Respect our pkg-config settings.
91 -e 's:pkg-config:$(PKG_CONFIG):' \
92 contrib/pppgetpass/Makefile.linux || die
94 -e '/^LIBS/{s:-L/usr/local/ssl/lib::;s:-lcrypto:`$(PKG_CONFIG) --libs libcrypto`:}' \
95 pppd/Makefile.linux || die
101 tc-export AR CC PKG_CONFIG
102 emake COPTS="${CFLAGS} -D_GNU_SOURCE"
105 cd contrib/pppgetpass || die
107 emake -f Makefile.linux
115 for i in chat pppd pppdump pppstats ; do
119 fperms u+s-w /usr/sbin/pppd
121 # Install pppd header files
122 emake -C pppd INSTROOT="${D}" install-devel
124 dosbin pppd/plugins/rp-pppoe/pppoe-discovery
129 newins etc.ppp/pap-secrets pap-secrets.example
130 newins etc.ppp/chap-secrets chap-secrets.example
133 doins etc.ppp/options
135 pamd_mimic_system ppp auth account session
137 local PLUGINS_DIR="/usr/$(get_libdir)/pppd/${PV}"
138 # closing " for syntax coloring
139 insinto "${PLUGINS_DIR}"
141 doins pppd/plugins/minconn.so
142 doins pppd/plugins/passprompt.so
143 doins pppd/plugins/passwordfd.so
144 doins pppd/plugins/winbind.so
145 doins pppd/plugins/rp-pppoe/rp-pppoe.so
146 doins pppd/plugins/pppol2tp/openl2tp.so
147 doins pppd/plugins/pppol2tp/pppol2tp.so
149 doins pppd/plugins/pppoatm/pppoatm.so
152 doins pppd/plugins/dhcp/dhcpc.so
155 doins pppd/plugins/radius/rad{ius,attr,realms}.so
157 #Copy radiusclient configuration files (#92878)
158 insinto /etc/ppp/radius
160 doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
162 doman pppd/plugins/radius/pppd-rad{ius,attr}.8
165 insinto /etc/modprobe.d
167 newins "${FILESDIR}/modules.ppp" ppp.conf
169 dodoc PLUGINS README* SETUP Changes-2.3 FAQ
170 dodoc "${FILESDIR}/README.mpls"
172 dosbin scripts/p{on,off,log}
175 # Adding misc. specialized scripts to doc dir
176 insinto /usr/share/doc/${PF}/scripts/chatchat
177 doins scripts/chatchat/*
178 insinto /usr/share/doc/${PF}/scripts
182 dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
183 newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
185 newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
187 doman contrib/pppgetpass/pppgetpass.8
191 if linux-info_get_any_version && linux_config_src_exists ; then
193 ewarn "If the following test report contains a missing kernel configuration option that you need,"
194 ewarn "you should reconfigure and rebuild your kernel before running pppd."
195 CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
196 local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
197 local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
198 local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
199 if use activefilter ; then
200 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
201 local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
203 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
204 local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
205 local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
206 local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
207 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
208 local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by rp-pppoe plugin)"
209 local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by rp-pppoe and dhcpc plugins)"
211 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
212 local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
217 # create *-secrets files if not exists
218 [ -f "${ROOT}/etc/ppp/pap-secrets" ] || \
219 cp -pP "${ROOT}/etc/ppp/pap-secrets.example" "${ROOT}/etc/ppp/pap-secrets"
220 [ -f "${ROOT}/etc/ppp/chap-secrets" ] || \
221 cp -pP "${ROOT}/etc/ppp/chap-secrets.example" "${ROOT}/etc/ppp/chap-secrets"
223 # lib name has changed
224 sed -i -e "s:^pppoe.so:rp-pppoe.so:" "${ROOT}/etc/ppp/options" || die
227 elog "Pon, poff and plog scripts have been supplied for experienced users."
228 elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
229 elog "/usr/share/doc/${PF}/scripts directory."