xref: /OK3568_Linux_fs/buildroot/package/pppd/pppd.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# pppd
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunPPPD_VERSION = 2.4.8
8*4882a593SmuzhiyunPPPD_SITE = $(call github,paulusmack,ppp,ppp-$(PPPD_VERSION))
9*4882a593SmuzhiyunPPPD_LICENSE = LGPL-2.0+, LGPL, BSD-4-Clause, BSD-3-Clause, GPL-2.0+
10*4882a593SmuzhiyunPPPD_LICENSE_FILES = \
11*4882a593Smuzhiyun	pppd/tdb.c pppd/plugins/pppoatm/COPYING \
12*4882a593Smuzhiyun	pppdump/bsd-comp.c pppd/ccp.c pppd/plugins/passprompt.c
13*4882a593SmuzhiyunPPPD_CPE_ID_VENDOR = samba
14*4882a593SmuzhiyunPPPD_CPE_ID_PRODUCT = ppp
15*4882a593SmuzhiyunPPPD_SELINUX_MODULES = ppp
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun# 0001-pppd-Fix-bounds-check.patch
18*4882a593SmuzhiyunPPPD_IGNORE_CVES += CVE-2020-8597
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunPPPD_MAKE_OPTS = HAVE_INET6=y
21*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
22*4882a593SmuzhiyunPPPD_DEPENDENCIES += openssl
23*4882a593Smuzhiyunelse
24*4882a593SmuzhiyunPPPD_MAKE_OPTS += USE_CRYPT=y
25*4882a593Smuzhiyunendif
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunPPPD_INSTALL_STAGING = YES
28*4882a593SmuzhiyunPPPD_TARGET_BINS = chat pppd pppdump pppstats
29*4882a593SmuzhiyunPPPD_RADIUS_CONF = \
30*4882a593Smuzhiyun	dictionary dictionary.ascend dictionary.compat \
31*4882a593Smuzhiyun	dictionary.merit dictionary.microsoft \
32*4882a593Smuzhiyun	issue port-id-map realms servers radiusclient.conf
33*4882a593Smuzhiyun
34*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PPPD_FILTER),y)
35*4882a593SmuzhiyunPPPD_DEPENDENCIES += libpcap
36*4882a593SmuzhiyunPPPD_MAKE_OPTS += FILTER=y
37*4882a593Smuzhiyunendif
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun# pppd bundles some but not all of the needed kernel headers. The embedded
40*4882a593Smuzhiyun# if_pppol2tp.h is unfortunately not compatible with kernel headers > 2.6.34,
41*4882a593Smuzhiyun# and has been part of the kernel headers since 2.6.23, so drop it
42*4882a593Smuzhiyundefine PPPD_DROP_INTERNAL_IF_PPOL2TP_H
43*4882a593Smuzhiyun	$(RM) $(@D)/include/linux/if_pppol2tp.h
44*4882a593Smuzhiyunendef
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunPPPD_POST_EXTRACT_HOOKS += PPPD_DROP_INTERNAL_IF_PPOL2TP_H
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun# pppd defaults to /etc/ppp/resolv.conf, which not be writable and is
49*4882a593Smuzhiyun# definitely not useful since the C library only uses
50*4882a593Smuzhiyun# /etc/resolv.conf. Therefore, we change pppd to use /etc/resolv.conf
51*4882a593Smuzhiyun# instead.
52*4882a593Smuzhiyundefine PPPD_SET_RESOLV_CONF
53*4882a593Smuzhiyun	$(SED) 's,ppp/resolv.conf,resolv.conf,' $(@D)/pppd/pathnames.h
54*4882a593Smuzhiyunendef
55*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PPPD_OVERWRITE_RESOLV_CONF),y)
56*4882a593SmuzhiyunPPPD_POST_EXTRACT_HOOKS += PPPD_SET_RESOLV_CONF
57*4882a593Smuzhiyunendif
58*4882a593Smuzhiyun
59*4882a593Smuzhiyundefine PPPD_CONFIGURE_CMDS
60*4882a593Smuzhiyun	$(SED) 's/FILTER=y/#FILTER=y/' $(PPPD_DIR)/pppd/Makefile.linux
61*4882a593Smuzhiyun	$(SED) 's/ifneq ($$(wildcard \/usr\/include\/pcap-bpf.h),)/ifdef FILTER/' $(PPPD_DIR)/*/Makefile.linux
62*4882a593Smuzhiyun	( cd $(@D); $(TARGET_MAKE_ENV) ./configure --prefix=/usr )
63*4882a593Smuzhiyunendef
64*4882a593Smuzhiyun
65*4882a593Smuzhiyundefine PPPD_BUILD_CMDS
66*4882a593Smuzhiyun	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" COPTS="$(TARGET_CFLAGS)" \
67*4882a593Smuzhiyun		-C $(@D) $(PPPD_MAKE_OPTS)
68*4882a593Smuzhiyunendef
69*4882a593Smuzhiyun
70*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PPPD_RADIUS),y)
71*4882a593Smuzhiyundefine PPPD_INSTALL_RADIUS
72*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/radius/radattr.so \
73*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/radattr.so
74*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/radius/radius.so \
75*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/radius.so
76*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/radius/radrealms.so \
77*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/radrealms.so
78*4882a593Smuzhiyun	for m in $(PPPD_RADIUS_CONF); do \
79*4882a593Smuzhiyun		$(INSTALL) -m 644 -D $(PPPD_DIR)/pppd/plugins/radius/etc/$$m \
80*4882a593Smuzhiyun			$(TARGET_DIR)/etc/ppp/radius/$$m; \
81*4882a593Smuzhiyun	done
82*4882a593Smuzhiyun	$(SED) 's:/usr/local/etc:/etc:' \
83*4882a593Smuzhiyun		$(TARGET_DIR)/etc/ppp/radius/radiusclient.conf
84*4882a593Smuzhiyun	$(SED) 's:/usr/local/sbin:/usr/sbin:' \
85*4882a593Smuzhiyun		$(TARGET_DIR)/etc/ppp/radius/radiusclient.conf
86*4882a593Smuzhiyun	$(SED) 's:/etc/radiusclient:/etc/ppp/radius:g' \
87*4882a593Smuzhiyun		$(TARGET_DIR)/etc/ppp/radius/*
88*4882a593Smuzhiyunendef
89*4882a593Smuzhiyunendif
90*4882a593Smuzhiyun
91*4882a593Smuzhiyundefine PPPD_INSTALL_TARGET_CMDS
92*4882a593Smuzhiyun	for sbin in $(PPPD_TARGET_BINS); do \
93*4882a593Smuzhiyun		$(INSTALL) -D $(PPPD_DIR)/$$sbin/$$sbin \
94*4882a593Smuzhiyun			$(TARGET_DIR)/usr/sbin/$$sbin; \
95*4882a593Smuzhiyun	done
96*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/minconn.so \
97*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/minconn.so
98*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/passprompt.so \
99*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/passprompt.so
100*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/passwordfd.so \
101*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/passwordfd.so
102*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/pppoatm/pppoatm.so \
103*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/pppoatm.so
104*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/rp-pppoe/rp-pppoe.so \
105*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/rp-pppoe.so
106*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/rp-pppoe/pppoe-discovery \
107*4882a593Smuzhiyun		$(TARGET_DIR)/usr/sbin/pppoe-discovery
108*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/winbind.so \
109*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/winbind.so
110*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/pppol2tp/openl2tp.so \
111*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/openl2tp.so
112*4882a593Smuzhiyun	$(INSTALL) -D $(PPPD_DIR)/pppd/plugins/pppol2tp/pppol2tp.so \
113*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/pppd/$(PPPD_VERSION)/pppol2tp.so
114*4882a593Smuzhiyun	$(INSTALL) -D -m 0755 $(PPPD_DIR)/scripts/pon $(TARGET_DIR)/usr/bin/pon
115*4882a593Smuzhiyun	$(INSTALL) -D -m 0755 $(PPPD_DIR)/scripts/poff $(TARGET_DIR)/usr/bin/poff
116*4882a593Smuzhiyun	$(PPPD_INSTALL_RADIUS)
117*4882a593Smuzhiyunendef
118*4882a593Smuzhiyun
119*4882a593Smuzhiyundefine PPPD_INSTALL_STAGING_CMDS
120*4882a593Smuzhiyun	$(TARGET_MAKE_ENV) $(MAKE) INSTROOT=$(STAGING_DIR)/ -C $(@D) $(PPPD_MAKE_OPTS) install-devel
121*4882a593Smuzhiyunendef
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun$(eval $(generic-package))
124