3b36444289bcad995fe94ce097d0af2e407dddef
[openwrt/openwrt.git] / package / network / services / ppp / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=ppp
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
16 PKG_SOURCE_DATE:=2019-05-25
17 PKG_SOURCE_VERSION:=8e77984ac5d7acbe68b2b2f590abd17564c9730d
18 PKG_MIRROR_HASH:=7e7e74f0261db2c45770d79c6114e768382e85bfeb3f5a83179f270d6c15006d
19 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
20 PKG_LICENSE:=BSD-4-Clause
21 PKG_CPE_ID:=cpe:/a:samba:ppp
22
23 PKG_RELEASE_VERSION:=2.4.7
24 PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE)
25
26 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
27
28 PKG_BUILD_DEPENDS:=libpcap
29
30 PKG_BUILD_PARALLEL:=1
31 PKG_INSTALL:=1
32
33 include $(INCLUDE_DIR)/package.mk
34
35 define Package/ppp/Default
36 SECTION:=net
37 CATEGORY:=Network
38 URL:=https://ppp.samba.org/
39 endef
40
41 define Package/ppp
42 $(call Package/ppp/Default)
43 DEPENDS:=+kmod-ppp
44 TITLE:=PPP daemon
45 VARIANT:=default
46 endef
47
48 define Package/ppp-multilink
49 $(call Package/ppp/Default)
50 DEPENDS:=+kmod-ppp
51 TITLE:=PPP daemon (with multilink support)
52 VARIANT:=multilink
53 endef
54
55 define Package/ppp/description
56 This package contains the PPP (Point-to-Point Protocol) daemon.
57 endef
58
59 define Package/ppp/conffiles
60 /etc/ppp/chap-secrets
61 /etc/ppp/filter
62 /etc/ppp/ip-down
63 /etc/ppp/ip-up
64 /etc/ppp/ipv6-down
65 /etc/ppp/ipv6-up
66 /etc/ppp/options
67 endef
68
69 define Package/ppp-mod-pppoa
70 $(call Package/ppp/Default)
71 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +linux-atm +kmod-pppoa
72 TITLE:=PPPoA plugin
73 endef
74
75 define Package/ppp-mod-pppoa/description
76 This package contains a PPPoA (PPP over ATM) plugin for ppp.
77 endef
78
79 define Package/ppp-mod-pppoe
80 $(call Package/ppp/Default)
81 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pppoe
82 TITLE:=PPPoE plugin
83 endef
84
85 define Package/ppp-mod-pppoe/description
86 This package contains a PPPoE (PPP over Ethernet) plugin for ppp.
87 endef
88
89 define Package/ppp-mod-radius
90 $(call Package/ppp/Default)
91 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
92 TITLE:=RADIUS plugin
93 endef
94
95 define Package/ppp-mod-radius/description
96 This package contains a RADIUS (Remote Authentication Dial-In User Service)
97 plugin for ppp.
98 endef
99
100 define Package/ppp-mod-radius/conffiles
101 /etc/ppp/radius.conf
102 /etc/ppp/radius/
103 endef
104
105 define Package/ppp-mod-pppol2tp
106 $(call Package/ppp/Default)
107 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pppol2tp
108 TITLE:=PPPoL2TP plugin
109 endef
110
111 define Package/ppp-mod-pppol2tp/description
112 This package contains a PPPoL2TP (PPP over L2TP) plugin for ppp.
113 endef
114
115 define Package/ppp-mod-pptp
116 $(call Package/ppp/Default)
117 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pptp +kmod-mppe +resolveip
118 TITLE:=PPtP plugin
119 endef
120
121 define Package/ppp-mod-pptp/description
122 This package contains a PPtP plugin for ppp.
123 endef
124
125 define Package/ppp-mod-passwordfd
126 $(call Package/ppp/Default)
127 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
128 TITLE:=pap/chap secret from filedescriptor
129 endef
130
131 define Package/ppp-mod-passwordfd/description
132 This package allows to pass the PAP/CHAP secret from a filedescriptor.
133 Eliminates the need for a secrets file.
134 endef
135
136 define Package/chat
137 $(call Package/ppp/Default)
138 TITLE:=Establish conversation with a modem
139 endef
140
141 define Package/chat/description
142 This package contains an utility to establish conversation with other PPP servers
143 (via a modem).
144 endef
145
146 define Package/pppdump
147 $(call Package/ppp/Default)
148 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
149 TITLE:=Read PPP record file
150 endef
151
152 define Package/pppdump/description
153 This package contains an utility to read PPP record file.
154 endef
155
156 define Package/pppstats
157 $(call Package/ppp/Default)
158 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
159 TITLE:=Report PPP statistics
160 endef
161
162 define Package/pppstats/description
163 This package contains an utility to report PPP statistics.
164 endef
165
166 define Package/pppoe-discovery
167 $(call Package/ppp/Default)
168 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +ppp-mod-pppoe
169 TITLE:=Perform a PPPoE-discovery process
170 endef
171
172 define Package/pppoe-discovery/description
173 This tool performs the same discovery process as pppoe, but does
174 not initiate a session. Can be useful to debug pppoe.
175 endef
176
177
178 define Build/Configure
179 $(call Build/Configure/Default,, \
180 UNAME_S="Linux" \
181 UNAME_R="$(LINUX_VERSION)" \
182 UNAME_M="$(ARCH)" \
183 )
184 mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux
185 $(CP) \
186 $(LINUX_DIR)/include/linux/compiler.h \
187 $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
188 $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
189
190 # Kernel 4.14.9+ only, ignore the exit status of cp in case the file
191 # doesn't exits
192 -$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \
193 $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
194 endef
195
196 TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
197 TARGET_LDFLAGS += -Wl,--gc-sections -flto -fuse-linker-plugin
198
199 MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \
200 PRECOMPILED_FILTER=1 \
201 STAGING_DIR="$(STAGING_DIR)"
202
203 ifeq ($(BUILD_VARIANT),multilink)
204 MAKE_FLAGS += HAVE_MULTILINK=y
205 else
206 MAKE_FLAGS += HAVE_MULTILINK=
207 endif
208
209 ifdef CONFIG_USE_MUSL
210 MAKE_FLAGS += USE_LIBUTIL=
211 endif
212
213 define Build/InstallDev
214 $(INSTALL_DIR) $(1)/usr/include
215 $(CP) $(PKG_INSTALL_DIR)/include/pppd $(1)/usr/include/
216 endef
217
218 define Package/ppp/script_install
219 endef
220
221 define Package/ppp/install
222 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
223 $(INSTALL_DIR) $(1)/usr/sbin
224 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/
225 $(INSTALL_DIR) $(1)/etc/ppp
226 $(INSTALL_CONF) ./files/etc/ppp/chap-secrets $(1)/etc/ppp/
227 $(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/
228 $(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
229 $(LN) /tmp/resolv.conf.ppp $(1)/etc/ppp/resolv.conf
230 $(INSTALL_DIR) $(1)/lib/netifd/proto
231 $(INSTALL_BIN) ./files/ppp.sh $(1)/lib/netifd/proto/
232 $(INSTALL_BIN) ./files/lib/netifd/ppp-up $(1)/lib/netifd/
233 $(INSTALL_BIN) ./files/lib/netifd/ppp6-up $(1)/lib/netifd/
234 $(INSTALL_BIN) ./files/lib/netifd/ppp-down $(1)/lib/netifd/
235 endef
236 Package/ppp-multilink/install=$(Package/ppp/install)
237
238 define Package/ppp-mod-pppoa/install
239 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
240 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoatm.so \
241 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
242 endef
243
244 define Package/ppp-mod-pppoe/install
245 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
246 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/rp-pppoe.so \
247 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
248 endef
249
250 define Package/ppp-mod-radius/install
251 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
252 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/radius.so \
253 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
254 $(INSTALL_DIR) $(1)/etc/ppp
255 $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/
256 $(INSTALL_DIR) $(1)/etc/ppp/radius
257 $(INSTALL_DATA) ./files/etc/ppp/radius/dictionary* \
258 $(1)/etc/ppp/radius/
259 $(INSTALL_CONF) ./files/etc/ppp/radius/servers \
260 $(1)/etc/ppp/radius/
261 endef
262
263 define Package/ppp-mod-pppol2tp/install
264 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
265 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppol2tp.so \
266 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
267 endef
268
269 define Package/ppp-mod-pptp/install
270 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
271 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pptp.so \
272 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
273 $(INSTALL_DIR) $(1)/etc/ppp
274 $(INSTALL_DATA) ./files/etc/ppp/options.pptp $(1)/etc/ppp/
275 endef
276
277 define Package/ppp-mod-passwordfd/install
278 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
279 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/passwordfd.so \
280 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
281 endef
282
283 define Package/chat/install
284 $(INSTALL_DIR) $(1)/usr/sbin
285 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/chat $(1)/usr/sbin/
286 endef
287
288 define Package/pppdump/install
289 $(INSTALL_DIR) $(1)/usr/sbin
290 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppdump $(1)/usr/sbin/
291 endef
292
293 define Package/pppstats/install
294 $(INSTALL_DIR) $(1)/usr/sbin
295 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppstats $(1)/usr/sbin/
296 endef
297
298 define Package/pppoe-discovery/install
299 $(INSTALL_DIR) $(1)/usr/sbin
300 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppoe-discovery $(1)/usr/sbin/
301 endef
302
303 $(eval $(call BuildPackage,ppp))
304 $(eval $(call BuildPackage,ppp-multilink))
305 $(eval $(call BuildPackage,ppp-mod-pppoa))
306 $(eval $(call BuildPackage,ppp-mod-pppoe))
307 $(eval $(call BuildPackage,ppp-mod-radius))
308 $(eval $(call BuildPackage,ppp-mod-pppol2tp))
309 $(eval $(call BuildPackage,ppp-mod-pptp))
310 $(eval $(call BuildPackage,ppp-mod-passwordfd))
311 $(eval $(call BuildPackage,chat))
312 $(eval $(call BuildPackage,pppdump))
313 $(eval $(call BuildPackage,pppstats))
314 $(eval $(call BuildPackage,pppoe-discovery))