p910nd: Fix init script and make use use append_bool() and appand_string() functions
[openwrt/svn-archive/archive.git] / net / freeradius / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=freeradius
12 PKG_VERSION:=1.1.6
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/radius/old/ \
17 http://freeradius.portal-to-web.de/ \
18 ftp://ftp.uk.freeradius.org/pub/radius/
19 PKG_MD5SUM:=2c29ab90cc30aa3b92fbd78030ccc198
20 PKG_CAT:=bzcat
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/freeradius/Default
28 SECTION:=net
29 CATEGORY:=Network
30 URL:=http://www.freeradius.org/
31 endef
32
33 define Package/freeradius
34 $(call Package/freeradius/Default)
35 DEPENDS:=+libltdl +libopenssl +libpthread +libreadline
36 TITLE:=A flexible RADIUS server
37 MENU:=1
38 endef
39
40 define Package/freeradius/conffiles
41 /etc/freeradius/clients.conf
42 /etc/freeradius/radiusd.conf
43 endef
44
45 define Package/freeradius-democerts
46 $(call Package/freeradius/Default)
47 DEPENDS:=freeradius
48 TITLE:=Demo certificates to test the server
49 endef
50
51 define Package/freeradius-mod-chap
52 $(call Package/freeradius/Default)
53 DEPENDS:=freeradius
54 TITLE:=CHAP module
55 endef
56
57 define Package/freeradius-mod-detail
58 $(call Package/freeradius/Default)
59 DEPENDS:=freeradius
60 TITLE:=Detailed accounting module
61 endef
62
63 define Package/freeradius-mod-eap
64 $(call Package/freeradius/Default)
65 DEPENDS:=freeradius
66 TITLE:=Base EAP module
67 endef
68
69 define Package/freeradius-mod-eap/conffiles
70 /etc/freeradius/eap.conf
71 endef
72
73 define Package/freeradius-mod-eap-gtc
74 $(call Package/freeradius/Default)
75 DEPENDS:=freeradius-mod-eap
76 TITLE:=EAP/GTC module
77 endef
78
79 define Package/freeradius-mod-eap-md5
80 $(call Package/freeradius/Default)
81 DEPENDS:=freeradius-mod-eap
82 TITLE:=EAP/MD5 module
83 endef
84
85 define Package/freeradius-mod-eap-mschapv2
86 $(call Package/freeradius/Default)
87 DEPENDS:=freeradius-mod-eap
88 TITLE:=EAP/MS-CHAPv2 module
89 endef
90
91 define Package/freeradius-mod-eap-peap
92 $(call Package/freeradius/Default)
93 DEPENDS:=freeradius-mod-eap
94 TITLE:=EAP/PEAP module
95 endef
96
97 define Package/freeradius-mod-eap-tls
98 $(call Package/freeradius/Default)
99 DEPENDS:=freeradius-mod-eap
100 TITLE:=EAP/TLS module
101 endef
102
103 define Package/freeradius-mod-eap-ttls
104 $(call Package/freeradius/Default)
105 DEPENDS:=freeradius-mod-eap-tls
106 TITLE:=EAP/TTLS module
107 endef
108
109 define Package/freeradius-mod-exec
110 $(call Package/freeradius/Default)
111 DEPENDS:=freeradius
112 TITLE:=EXEC module
113 endef
114
115 define Package/freeradius-mod-attr-rewrite
116 $(call Package/freeradius/Default)
117 DEPENDS:=freeradius
118 TITLE:=ATTR rewrite module
119 endef
120
121 define Package/freeradius-mod-files
122 $(call Package/freeradius/Default)
123 DEPENDS:=freeradius
124 TITLE:=Module using local files for authorization
125 endef
126
127 define Package/freeradius-mod-files/conffiles
128 /etc/freeradius/acct_users
129 /etc/freeradius/preproxy_users
130 /etc/freeradius/users
131 endef
132
133 define Package/freeradius-mod-ldap
134 $(call Package/freeradius/Default)
135 DEPENDS:=freeradius +libopenldap
136 TITLE:=LDAP module
137 endef
138
139 define Package/freeradius-mod-ldap/conffiles
140 /etc/freeradius/ldap.attrmap
141 endef
142
143 define Package/freeradius-mod-mschap
144 $(call Package/freeradius/Default)
145 DEPENDS:=freeradius
146 TITLE:=MS-CHAP and MS-CHAPv2 module
147 endef
148
149 define Package/freeradius-mod-pap
150 $(call Package/freeradius/Default)
151 DEPENDS:=freeradius
152 TITLE:=PAP module
153 endef
154
155 define Package/freeradius-mod-preprocess
156 $(call Package/freeradius/Default)
157 DEPENDS:=freeradius
158 TITLE:=Request pre-processing module
159 endef
160
161 define Package/freeradius-mod-preprocess/conffiles
162 /etc/freeradius/hints
163 /etc/freeradius/huntgroups
164 endef
165
166 define Package/freeradius-mod-realm
167 $(call Package/freeradius/Default)
168 DEPENDS:=freeradius
169 TITLE:=Realms handling module
170 endef
171
172 define Package/freeradius-mod-realm/conffiles
173 /etc/freeradius/proxy.conf
174 endef
175
176 define Package/freeradius-mod-sql
177 $(call Package/freeradius/Default)
178 DEPENDS:=freeradius
179 TITLE:=Base SQL module
180 endef
181
182 define Package/freeradius-mod-sql-mysql
183 $(call Package/freeradius/Default)
184 DEPENDS:=freeradius-mod-sql +libmysqlclient
185 TITLE:=MySQL module
186 endef
187
188 define Package/freeradius-mod-sql-pgsql
189 $(call Package/freeradius/Default)
190 DEPENDS:=freeradius-mod-sql +libpq
191 TITLE:=PostgreSQL module
192 endef
193
194 define Package/freeradius-mod-sqlcounter
195 $(call Package/freeradius/Default)
196 DEPENDS:=freeradius-mod-sql
197 TITLE:=Generic SQL Counter module
198 endef
199
200 define Package/freeradius-mod-radutmp
201 $(call Package/freeradius/Default)
202 TITLE:=Radius UTMP module
203 endef
204
205 define Package/freeradius-utils
206 $(call Package/freeradius/Default)
207 DEPENDS:=freeradius
208 TITLE:=Misc. client utilities
209 endef
210
211 PKG_CONFIGURE_ARGS:= \
212 --enable-shared \
213 --disable-static \
214 --disable-developer \
215 --with-openssl-includes="$(STAGING_DIR)/usr/include" \
216 --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
217 --enable-strict-dependencies \
218 --with-raddbdir=/etc/freeradius \
219 --without-edir \
220 --without-snmp \
221 --with-experimental-modules \
222 --without-rlm_checkval \
223 --without-rlm_counter \
224 --without-rlm_dbm \
225 --with-rlm_eap \
226 --without-rlm_eap_sim \
227 --without-rlm_example \
228 --without-rlm_ippool \
229 --without-rlm_krb5 \
230 --without-rlm_otp \
231 --without-rlm_pam \
232 --without-rlm_perl \
233 --without-rlm_python \
234 --without-rlm_smb \
235 --with-rlm_sql \
236 --with-rlm_sqlcounter \
237 --without-rlm_sqlhpwippool \
238 --without-rlm_sqlippool \
239 --without-rlm_sql_db2 \
240 --without-rlm_sql_firebird \
241 --without-rlm_sql_freetds \
242 --without-rlm_sql_iodbc \
243 --without-rlm_sql_oracle \
244 --without-rlm_sql_sybase \
245 --without-rlm_sql_unixodbc \
246 --without-rlm_sql_log \
247 --without-rlm_unix \
248
249 PKG_DICTIONARIES:= \
250 freeradius freeradius.internal \
251 rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
252 rfc4372 rfc4675 rfc4679 \
253 microsoft \
254 wispr \
255
256 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-ldap),)
257 PKG_CONFIGURE_ARGS+= \
258 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
259 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
260 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
261 else
262 PKG_CONFIGURE_ARGS+= --without-rlm_ldap
263 endif
264
265 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-mysql),)
266 PKG_CONFIGURE_ARGS+= \
267 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
268 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
269 --without-threads
270 PKG_CONFIGURE_LIBS+= -lz
271 else
272 PKG_CONFIGURE_ARGS+= --without-rlm_sql_mysql
273 endif
274
275 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-pgsql),)
276 PKG_CONFIGURE_ARGS+= \
277 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
278 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
279 else
280 PKG_CONFIGURE_ARGS+= --without-rlm_sql_postgresql
281 endif
282
283 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-peap),)
284 PKG_CONFIGURE_ARGS+= --with-rlm_eap_peap
285 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
286 else
287 PKG_CONFIGURE_ARGS+= --without-rlm_eap_peap
288 endif
289
290 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-tls),)
291 PKG_CONFIGURE_ARGS+= --with-rlm_eap_tls
292 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
293 else
294 PKG_CONFIGURE_ARGS+= --without-rlm_eap_tls
295 endif
296
297 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-ttls),)
298 PKG_CONFIGURE_ARGS+= --with-rlm_eap_ttls
299 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
300 else
301 PKG_CONFIGURE_ARGS+= --without-rlm_eap_ttls
302 endif
303
304 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-attr-rewrite),)
305 PKG_CONFIGURE_ARGS+= --with-rlm_attr-rewrite
306 else
307 PKG_CONFIGURE_ARGS+= --without-rlm_attr-rewrite
308 endif
309
310 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-radutmp),)
311 PKG_CONFIGURE_ARGS+= --with-rlm_radutmp
312 else
313 PKG_CONFIGURE_ARGS+= --without-rlm_radutmp
314 endif
315
316 define Build/Configure
317 $(call Build/Configure/Default, \
318 --libdir=/usr/lib/freeradius \
319 --libexecdir=/usr/lib/freeradius \
320 $(PKG_CONFIGURE_ARGS) \
321 , \
322 LDFLAGS="$$$$LDFLAGS -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
323 LIBS="$(PKG_CONFIGURE_LIBS)" \
324 MYSQL_CONFIG="no" \
325 )
326 endef
327
328 define Build/Compile
329 $(MAKE) -C $(PKG_BUILD_DIR) \
330 R="$(PKG_INSTALL_DIR)" \
331 INSTALLSTRIP="" \
332 all install
333 endef
334
335 define Package/freeradius/install
336 $(INSTALL_DIR) $(1)/etc/freeradius
337 for f in clients.conf dictionary radiusd.conf; do \
338 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} $(1)/etc/freeradius/ ; \
339 done
340 $(INSTALL_DIR) $(1)/usr/share/freeradius
341 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius/
342 $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius/dictionary
343 for f in $(PKG_DICTIONARIES); do \
344 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius/ ; \
345 $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius/dictionary ; \
346 done
347 $(INSTALL_DIR) $(1)/usr/lib/freeradius
348 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/
349 $(INSTALL_DIR) $(1)/usr/sbin
350 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
351 $(INSTALL_DIR) $(1)/etc/init.d
352 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
353 endef
354
355 define Package/freeradius-democerts/install
356 $(INSTALL_DIR) $(1)/etc/freeradius
357 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/certs $(1)/etc/freeradius/
358 rm -rf $(1)/etc/freeradius/certs/README
359 rm -rf $(1)/etc/freeradius/certs/new*
360 rm -rf $(1)/etc/freeradius/certs/demoCA/index*
361 rm -rf $(1)/etc/freeradius/certs/demoCA/serial*
362 endef
363
364 define Package/freeradius-utils/install
365 $(INSTALL_DIR) $(1)/usr/bin
366 for f in radclient radeapclient; do \
367 $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
368 done
369 endef
370
371 define BuildPlugin
372 define Package/$(1)/install
373 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib
374 for m in $(2); do \
375 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/ ; \
376 done
377 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius
378 for f in $(3); do \
379 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$$$$$${f} $$(1)/etc/freeradius/ ; \
380 done
381 endef
382
383 $$(eval $$(call BuildPackage,$(1)))
384 endef
385
386 $(eval $(call BuildPackage,freeradius))
387 $(eval $(call BuildPackage,freeradius-democerts))
388 $(eval $(call BuildPlugin,freeradius-mod-chap,rlm_chap,))
389 $(eval $(call BuildPlugin,freeradius-mod-detail,rlm_detail,))
390 $(eval $(call BuildPlugin,freeradius-mod-eap,libeap rlm_eap,eap.conf))
391 $(eval $(call BuildPlugin,freeradius-mod-eap-gtc,rlm_eap_gtc,))
392 $(eval $(call BuildPlugin,freeradius-mod-eap-md5,rlm_eap_md5,))
393 $(eval $(call BuildPlugin,freeradius-mod-eap-mschapv2,rlm_eap_mschapv2,))
394 $(eval $(call BuildPlugin,freeradius-mod-eap-peap,rlm_eap_peap,))
395 $(eval $(call BuildPlugin,freeradius-mod-eap-tls,rlm_eap_tls,))
396 $(eval $(call BuildPlugin,freeradius-mod-eap-ttls,rlm_eap_ttls,))
397 $(eval $(call BuildPlugin,freeradius-mod-exec,rlm_exec,))
398 $(eval $(call BuildPlugin,freeradius-mod-attr-rewrite,rlm_attr_rewrite))
399 $(eval $(call BuildPlugin,freeradius-mod-files,rlm_files,acct_users preproxy_users users))
400 $(eval $(call BuildPlugin,freeradius-mod-ldap,rlm_ldap,ldap.attrmap))
401 $(eval $(call BuildPlugin,freeradius-mod-mschap,rlm_mschap,))
402 $(eval $(call BuildPlugin,freeradius-mod-pap,rlm_pap,))
403 $(eval $(call BuildPlugin,freeradius-mod-preprocess,rlm_preprocess,hints huntgroups))
404 $(eval $(call BuildPlugin,freeradius-mod-realm,rlm_realm,proxy.conf))
405 $(eval $(call BuildPlugin,freeradius-mod-sql,rlm_sql,sql.conf))
406 $(eval $(call BuildPlugin,freeradius-mod-sql-mysql,rlm_sql_mysql,))
407 $(eval $(call BuildPlugin,freeradius-mod-sql-pgsql,rlm_sql_postgresql,))
408 $(eval $(call BuildPlugin,freeradius-mod-sqlcounter,rlm_sqlcounter,))
409 $(eval $(call BuildPlugin,freeradius-mod-radutmp,rlm_radutmp,))
410 $(eval $(call BuildPackage,freeradius-utils))