Diff ppp-2.4.9-r9 with a ppp-2.5.0-r2

/usr/portage/net-dialup/ppp/ppp-2.5.0-r2.ebuild 2023-10-09 14:52:33.352368447 +0300
1 1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
inherit linux-info pam toolchain-funcs
6
inherit linux-info pam tmpfiles
7 7

  
8 8
PATCH_TARBALL_NAME="${PN}-2.4.9-patches-03"
9 9
DESCRIPTION="Point-to-Point Protocol (PPP)"
10 10
HOMEPAGE="https://ppp.samba.org/"
11
SRC_URI="https://github.com/paulusmack/ppp/archive/${P}.tar.gz
12
	https://dev.gentoo.org/~polynomial-c/${PATCH_TARBALL_NAME}.tar.xz
13
	http://www.netservers.net.uk/gpl/ppp-dhcpc.tgz"
11
SRC_URI="https://download.samba.org/pub/ppp/${P}.tar.gz
12
	https://raw.githubusercontent.com/ppp-project/ppp/${P}/contrib/pppgetpass/pppgetpass.8"
14 13

  
15 14
LICENSE="BSD GPL-2"
16 15
SLOT="0/${PV}"
17
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
18
IUSE="activefilter atm dhcp +eap-tls gtk ipv6 pam radius systemd"
16
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
17
IUSE="activefilter atm gtk pam systemd"
19 18

  
20 19
DEPEND="
21 20
	dev-libs/openssl:0=
......
31 30
BDEPEND="virtual/pkgconfig"
32 31
PDEPEND="net-dialup/ppp-scripts"
33 32

  
34
S="${WORKDIR}/${PN}-${P}"
35

  
36
src_prepare() {
37
	mv "${WORKDIR}/dhcp" "${S}/pppd/plugins" || die
38

  
39
	eapply "${WORKDIR}"/patches
40
	eapply "${FILESDIR}"/${P}-fix-MPPE-sstpc.patch
41
	eapply "${FILESDIR}"/${P}-fix-clang-nested-functions.patch
42
	eapply "${FILESDIR}"/${P}-fix-openssl-sysroot-clang.patch
43
	eapply "${FILESDIR}"/${P}-pppol2tp-ipv6.patch
44

  
45
	#IPX Support is removed in kernel >= 5.15
46
	sed -i 's/-DIPX_CHANGE //' pppd/Makefile.linux || die
47

  
33
PATCHES=(
34
	"${FILESDIR}"/ppp-2.5.0-passwordfd-read-early.patch
35
)
36

  
37
pkg_setup() {
38
	local CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
39
	local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
40
	local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline"
41
	ERROR_PPP_ASYNC+=" (optional, but highly recommended)"
42
	local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline"
43
	WARNING_PPP_SYNC_TTY+=" (optional; used by 'sync' pppd option)"
44
	if use activefilter ; then
45
		CONFIG_CHECK+=" ~PPP_FILTER"
46
		local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
47
	fi
48
	CONFIG_CHECK+=" ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
49
	local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
50
	local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
51
	local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
52
	CONFIG_CHECK+=" ~PPPOE ~PACKET"
53
	local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by pppoe plugin)"
54
	local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by pppoe plugin)"
48 55
	if use atm ; then
49
		einfo "Enabling PPPoATM support"
50
		sed -i '/^#HAVE_LIBATM=yes/s:#::' \
51
			pppd/plugins/pppoatm/Makefile.linux || die
52
	fi
53

  
54
	if ! use activefilter ; then
55
		einfo "Disabling active filter"
56
		sed -i '/^FILTER=y/s:^:#:' pppd/Makefile.linux || die
57
	fi
58

  
59
	if use pam ; then
60
		einfo "Enabling PAM"
61
		sed -i '/^#USE_PAM=y/s:^#::' pppd/Makefile.linux || die
62
	fi
63

  
64
	if ! use ipv6 ; then
65
		einfo "Disabling IPv6"
66
		sed -i '/^HAVE_INET6/s:^:#:' pppd/Makefile.linux || die
67
	else
68
		echo "+ipv6" >> etc.ppp/options || die
69
	fi
70

  
71
	einfo "Enabling CBCP"
72
	sed -i '/^#CBCP=y/s:#::' pppd/Makefile.linux || die
73

  
74
	if use dhcp ; then
75
		einfo "Adding ppp-dhcp plugin files"
76
		sed \
77
			-e '/^SUBDIRS :=/s:$: dhcp:' \
78
			-i pppd/plugins/Makefile.linux || die
79
	fi
80

  
81
	if ! use eap-tls ; then
82
		einfo "Disabling EAP-TLS pppd auth support"
83
		sed -i '/^USE_EAPTLS=y/s:^:#:' pppd/Makefile.linux || die
84
		einfo "Disabling EAP-TLS plugin support"
85
		sed -i '/^CFLAGS += -DUSE_EAPTLS=1/s:^:#:' \
86
			pppd/plugins/Makefile.linux || die
87
	fi
88

  
89
	# Set correct libdir
90
	sed -i -e "s:/lib/pppd:/$(get_libdir)/pppd:" \
91
		pppd/{pathnames.h,pppd.8} || die
92

  
93
	if use radius ; then
94
		# Set the right paths in radiusclient.conf
95
		sed -e "s:/usr/local/etc:/etc:" \
96
			-e "s:/usr/local/sbin:/usr/sbin:" \
97
			-i pppd/plugins/radius/etc/radiusclient.conf || die
98
		# Set config dir to /etc/ppp/radius
99
		sed -i -e "s:/etc/radiusclient:/etc/ppp/radius:g" \
100
			pppd/plugins/radius/{*.8,*.c,*.h} \
101
			pppd/plugins/radius/etc/* || die
102
	else
103
		einfo "Disabling radius"
104
		sed -i -e '/+= radius/s:^:#:' pppd/plugins/Makefile.linux || die
105
	fi
106

  
107
	if use systemd ; then
108
		einfo "Enabling systemd notification"
109
		sed '/SYSTEMD=/s@^#@@' -i pppd/Makefile.linux || die
56
		CONFIG_CHECK+=" ~PPPOATM"
57
		local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
110 58
	fi
111 59

  
112
	# Respect our pkg-config settings.
113
	sed -i \
114
		-e 's:pkg-config:$(PKG_CONFIG):' \
115
		contrib/pppgetpass/Makefile.linux || die
116
	sed -i \
117
		-e '/^LIBS/{s:-L/usr/local/ssl/lib::;s:-lcrypto:`$(PKG_CONFIG) --libs libcrypto`:}' \
118
		pppd/Makefile.linux || die
119

  
120
	eapply_user #549588
60
	linux-info_pkg_setup
121 61
}
122 62

  
123
src_compile() {
124
	tc-export AR CC PKG_CONFIG
125
	emake CC="${CC}" COPTS="${CFLAGS} -D_GNU_SOURCE"
126

  
127
	# build pppgetpass
128
	cd contrib/pppgetpass || die
129
	if use gtk ; then
130
		emake -f Makefile.linux
131
	else
132
		emake pppgetpass.vt
133
	fi
63
src_configure() {
64
	local args=(
65
		--localstatedir="${EPREFIX}"/var
66
		--runstatedir="${EPREFIX}"/run
67
		$(use_enable systemd)
68
		$(use_with atm)
69
		$(use_with pam)
70
		$(use_with activefilter pcap)
71
		$(use_with gtk)
72
		--enable-cbcp
73
	)
74
	econf "${args[@]}"
134 75
}
135 76

  
136 77
src_install() {
137
	local i
138
	for i in chat pppd pppdump pppstats ; do
139
		doman ${i}/${i}.8
140
		dosbin ${i}/${i}
141
	done
142
	fperms u+s-w /usr/sbin/pppd
143

  
144
	# Install pppd header files
145
	emake -C pppd INSTROOT="${D}" install-devel
146

  
147
	dosbin pppd/plugins/pppoe/pppoe-discovery
148

  
149
	dodir /etc/ppp/peers
150
	insinto /etc/ppp
151
	insopts -m0600
152
	newins etc.ppp/pap-secrets pap-secrets.example
153
	newins etc.ppp/chap-secrets chap-secrets.example
78
	default
154 79

  
155
	insopts -m0644
156
	doins etc.ppp/options
80
	find "${ED}" -name '*.la' -type f -delete || die
157 81

  
158 82
	if use pam; then
159 83
		pamd_mimic_system ppp auth account session
160 84
	fi
161 85

  
162
	local PLUGINS_DIR="/usr/$(get_libdir)/pppd/${PV}"
163
	insinto "${PLUGINS_DIR}"
164
	insopts -m0755
165
	doins pppd/plugins/minconn.so
166
	doins pppd/plugins/passprompt.so
167
	doins pppd/plugins/passwordfd.so
168
	doins pppd/plugins/winbind.so
169
	doins pppd/plugins/pppoe/pppoe.so
170
	doins pppd/plugins/pppol2tp/openl2tp.so
171
	doins pppd/plugins/pppol2tp/pppol2tp.so
172
	if use atm ; then
173
		doins pppd/plugins/pppoatm/pppoatm.so
174
	fi
175
	if use dhcp ; then
176
		doins pppd/plugins/dhcp/dhcpc.so
177
	fi
178
	if use radius ; then
179
		doins pppd/plugins/radius/rad{ius,attr,realms}.so
180

  
181
		#Copy radiusclient configuration files (#92878)
182
		insinto /etc/ppp/radius
183
		insopts -m0644
184
		doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
185

  
186
		doman pppd/plugins/radius/pppd-rad{ius,attr}.8
187
	fi
188

  
189 86
	insinto /etc/modprobe.d
190
	insopts -m0644
191 87
	newins "${FILESDIR}/modules.ppp" ppp.conf
192 88

  
193
	dodoc PLUGINS README* SETUP Changes-2.3 FAQ
194
	dodoc "${FILESDIR}/README.mpls"
195

  
196 89
	dosbin scripts/p{on,off,log}
197 90
	doman scripts/pon.1
91
	dosym pon.1 /usr/share/man/man1/poff.1
92
	dosym pon.1 /usr/share/man/man1/plog.1
198 93

  
199 94
	# Adding misc. specialized scripts to doc dir
200 95
	dodoc -r scripts
201
	docinto scripts
202
	dodoc -r scripts/chatchat
203 96

  
204 97
	if use gtk ; then
205
		dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
98
		dosbin contrib/pppgetpass/pppgetpass.{gtk,vt}
206 99
		newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
207 100
	else
208 101
		newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
209 102
	fi
210
	doman contrib/pppgetpass/pppgetpass.8
211
}
212 103

  
213
pkg_postinst() {
214
	if linux-info_get_any_version && linux_config_src_exists ; then
215
		echo
216
		ewarn "If the following test report contains a missing kernel configuration option that you need,"
217
		ewarn "you should reconfigure and rebuild your kernel before running pppd."
218
		CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
219
		local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
220
		local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
221
		local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
222
		if use activefilter ; then
223
			CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
224
			local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
225
		fi
226
		CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
227
		local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
228
		local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
229
		local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
230
		CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
231
		local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by pppoe plugin)"
232
		local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by pppoe and dhcpc plugins)"
233
		if use atm ; then
234
			CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
235
			local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
236
		fi
237
		check_extra_config
238
	fi
104
	newtmpfiles "${FILESDIR}/pppd.tmpfiles" pppd.conf
239 105

  
240
	# create *-secrets files if not exists
241
	[[ -f "${EROOT}/etc/ppp/pap-secrets" ]] || \
242
		cp -pP "${EROOT}/etc/ppp/pap-secrets.example" "${EROOT}/etc/ppp/pap-secrets"
243
	[[ -f "${EROOT}/etc/ppp/chap-secrets" ]] || \
244
		cp -pP "${EROOT}/etc/ppp/chap-secrets.example" "${EROOT}/etc/ppp/chap-secrets"
245

  
246
	# lib name has changed
247
	sed -i -e "s:^rp-\(pppoe.so\):\1:" "${EROOT}/etc/ppp/options" || die
248

  
249
	echo
250
	elog "Pon, poff and plog scripts have been supplied for experienced users."
251
	elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
252
	elog "/usr/share/doc/${PF}/scripts directory."
106
	# Missing from upstream tarball
107
	# https://github.com/ppp-project/ppp/pull/412
108
	#doman contrib/pppgetpass/pppgetpass.8
109
	doman "${DISTDIR}/pppgetpass.8"
110
}
253 111

  
254
	if [[ -n ${REPLACING_VERSIONS} ]] ; then
255
		ewarn '"rp-pppoe.so" plugin has been renamed to "pppoe.so"'
256
	fi
112
pkg_postinst() {
113
	tmpfiles_process pppd.conf
257 114
}
Thank you!