1 # Copyright 1999-2018 Gentoo Foundation
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 ~s390 ~sh ~sparc ~x86"
18 IUSE="activefilter atm dhcp eap-tls gtk ipv6 libressl pam radius"
20 DEPEND="activefilter? ( net-libs/libpcap )
21 atm? ( net-dialup/linux-atm )
23 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
94 emake COPTS="${CFLAGS} -D_GNU_SOURCE"
97 cd contrib/pppgetpass || die
99 emake -f Makefile.linux
107 for i in chat pppd pppdump pppstats ; do
111 fperms u+s-w /usr/sbin/pppd
113 # Install pppd header files
114 emake -C pppd INSTROOT="${D}" install-devel
116 dosbin pppd/plugins/rp-pppoe/pppoe-discovery
121 newins etc.ppp/pap-secrets pap-secrets.example
122 newins etc.ppp/chap-secrets chap-secrets.example
125 doins etc.ppp/options
127 pamd_mimic_system ppp auth account session
129 local PLUGINS_DIR="/usr/$(get_libdir)/pppd/${PV}"
130 # closing " for syntax coloring
131 insinto "${PLUGINS_DIR}"
133 doins pppd/plugins/minconn.so
134 doins pppd/plugins/passprompt.so
135 doins pppd/plugins/passwordfd.so
136 doins pppd/plugins/winbind.so
137 doins pppd/plugins/rp-pppoe/rp-pppoe.so
138 doins pppd/plugins/pppol2tp/openl2tp.so
139 doins pppd/plugins/pppol2tp/pppol2tp.so
141 doins pppd/plugins/pppoatm/pppoatm.so
144 doins pppd/plugins/dhcp/dhcpc.so
147 doins pppd/plugins/radius/rad{ius,attr,realms}.so
149 #Copy radiusclient configuration files (#92878)
150 insinto /etc/ppp/radius
152 doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
154 doman pppd/plugins/radius/pppd-rad{ius,attr}.8
157 insinto /etc/modprobe.d
159 newins "${FILESDIR}/modules.ppp" ppp.conf
161 dodoc PLUGINS README* SETUP Changes-2.3 FAQ
162 dodoc "${FILESDIR}/README.mpls"
164 dosbin scripts/p{on,off,log}
167 # Adding misc. specialized scripts to doc dir
168 insinto /usr/share/doc/${PF}/scripts/chatchat
169 doins scripts/chatchat/*
170 insinto /usr/share/doc/${PF}/scripts
174 dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
175 newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
177 newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
179 doman contrib/pppgetpass/pppgetpass.8
183 if linux-info_get_any_version && linux_config_src_exists ; then
185 ewarn "If the following test report contains a missing kernel configuration option that you need,"
186 ewarn "you should reconfigure and rebuild your kernel before running pppd."
187 CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
188 local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
189 local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
190 local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
191 if use activefilter ; then
192 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
193 local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
195 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
196 local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
197 local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
198 local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
199 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
200 local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by rp-pppoe plugin)"
201 local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by rp-pppoe and dhcpc plugins)"
203 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
204 local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
209 # create *-secrets files if not exists
210 [ -f "${ROOT}/etc/ppp/pap-secrets" ] || \
211 cp -pP "${ROOT}/etc/ppp/pap-secrets.example" "${ROOT}/etc/ppp/pap-secrets"
212 [ -f "${ROOT}/etc/ppp/chap-secrets" ] || \
213 cp -pP "${ROOT}/etc/ppp/chap-secrets.example" "${ROOT}/etc/ppp/chap-secrets"
215 # lib name has changed
216 sed -i -e "s:^pppoe.so:rp-pppoe.so:" "${ROOT}/etc/ppp/options" || die
219 elog "Pon, poff and plog scripts have been supplied for experienced users."
220 elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
221 elog "/usr/share/doc/${PF}/scripts directory."