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