[packages] replace @LINUX_2_6 with @!LINUX_2_4, fixes fallout after r23246
[openwrt/svn-archive/archive.git] / net / freeradius2 / Makefile
1 #
2 # Copyright (C) 2008-2010 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
10 PKG_NAME:=freeradius2
11 PKG_VERSION:=2.1.9
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=freeradius-server-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/freeradius/
16 PKG_MD5SUM:=5e16a0869acdf448b191c7e30f6507d8
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/freeradius-server-$(PKG_VERSION)
19 PKG_FIXUP:=libtool
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/freeradius2/Default
24 SECTION:=net
25 CATEGORY:=Network
26 URL:=http://freeradius.org/
27 endef
28
29 define Package/freeradius2
30 $(call Package/freeradius2/Default)
31 DEPENDS:=+libltdl +libopenssl +libpthread +libreadline
32 TITLE:=A flexible RADIUS server (version 2)
33 MENU:=1
34 endef
35
36 define Package/freeradius2/conffiles
37 /etc/freeradius2/clients.conf
38 /etc/freeradius2/radiusd.conf
39 /etc/freeradius2/sites/default
40 endef
41
42 define Package/freeradius2-democerts
43 $(call Package/freeradius2/Default)
44 DEPENDS:=freeradius2
45 TITLE:=Demo certificates to test the server
46 endef
47
48 define Package/freeradius2-mod-chap
49 $(call Package/freeradius2/Default)
50 DEPENDS:=freeradius2
51 TITLE:=CHAP module
52 endef
53
54 define Package/freeradius2-mod-chap/conffiles
55 /etc/freeradius2/modules/chap
56 endef
57
58 define Package/freeradius2-mod-detail
59 $(call Package/freeradius2/Default)
60 DEPENDS:=freeradius2
61 TITLE:=Detailed accounting module
62 endef
63
64 define Package/freeradius2-mod-detail/conffiles
65 /etc/freeradius2/modules/detail
66 endef
67
68 define Package/freeradius2-mod-eap
69 $(call Package/freeradius2/Default)
70 DEPENDS:=freeradius2
71 TITLE:=Base EAP module
72 endef
73
74 define Package/freeradius2-mod-eap/conffiles
75 /etc/freeradius2/eap.conf
76 endef
77
78 define Package/freeradius2-mod-eap-gtc
79 $(call Package/freeradius2/Default)
80 DEPENDS:=freeradius2-mod-eap
81 TITLE:=EAP/GTC module
82 endef
83
84 define Package/freeradius2-mod-eap-md5
85 $(call Package/freeradius2/Default)
86 DEPENDS:=freeradius2-mod-eap
87 TITLE:=EAP/MD5 module
88 endef
89
90 define Package/freeradius2-mod-eap-mschapv2
91 $(call Package/freeradius2/Default)
92 DEPENDS:=freeradius2-mod-eap
93 TITLE:=EAP/MS-CHAPv2 module
94 endef
95
96 define Package/freeradius2-mod-eap-peap
97 $(call Package/freeradius2/Default)
98 DEPENDS:=freeradius2-mod-eap
99 TITLE:=EAP/PEAP module
100 endef
101
102 define Package/freeradius2-mod-eap-tls
103 $(call Package/freeradius2/Default)
104 DEPENDS:=freeradius2-mod-eap
105 TITLE:=EAP/TLS module
106 endef
107
108 define Package/freeradius2-mod-eap-ttls
109 $(call Package/freeradius2/Default)
110 DEPENDS:=freeradius2-mod-eap-tls
111 TITLE:=EAP/TTLS module
112 endef
113
114 define Package/freeradius2-mod-exec
115 $(call Package/freeradius2/Default)
116 DEPENDS:=freeradius2
117 TITLE:=EXEC module
118 endef
119
120 define Package/freeradius2-mod-exec/conffiles
121 /etc/freeradius2/modules/exec
122 endef
123
124 define Package/freeradius2-mod-expiration
125 $(call Package/freeradius2/Default)
126 DEPENDS:=freeradius2
127 TITLE:=Expiration module
128 endef
129
130 define Package/freeradius2-mod-expiration/conffiles
131 /etc/freeradius2/modules/expiration
132 endef
133
134 define Package/freeradius2-mod-expr
135 $(call Package/freeradius2/Default)
136 DEPENDS:=freeradius2
137 TITLE:=EXPR module
138 endef
139
140 define Package/freeradius2-mod-expr/conffiles
141 /etc/freeradius2/modules/expr
142 endef
143
144 define Package/freeradius2-mod-attr-filter
145 $(call Package/freeradius2/Default)
146 DEPENDS:=freeradius2
147 TITLE:=ATTR filter module
148 endef
149
150 define Package/freeradius2-mod-attr-filter/conffiles
151 /etc/freeradius2/modules/attr_filter
152 /etc/freeradius2/attrs
153 /etc/freeradius2/attrs.access_reject
154 /etc/freeradius2/attrs.accounting_response
155 /etc/freeradius2/attrs.pre-proxy
156 endef
157
158 define Package/freeradius2-mod-attr-rewrite
159 $(call Package/freeradius2/Default)
160 DEPENDS:=freeradius2
161 TITLE:=ATTR rewrite module
162 endef
163
164 define Package/freeradius2-mod-attr-rewrite/conffiles
165 /etc/freeradius2/modules/attr_rewrite
166 endef
167
168 define Package/freeradius2-mod-files
169 $(call Package/freeradius2/Default)
170 DEPENDS:=freeradius2
171 TITLE:=Module using local files for authorization
172 endef
173
174 define Package/freeradius2-mod-files/conffiles
175 /etc/freeradius2/acct_users
176 /etc/freeradius2/preproxy_users
177 /etc/freeradius2/users
178 /etc/freeradius2/modules/files
179 endef
180
181 define Package/freeradius2-mod-ldap
182 $(call Package/freeradius2/Default)
183 DEPENDS:=freeradius2 +libopenldap
184 TITLE:=LDAP module
185 endef
186
187 define Package/freeradius2-mod-ldap/conffiles
188 /etc/freeradius2/ldap.attrmap
189 /etc/freeradius2/modules/ldap
190 endef
191
192 define Package/freeradius2-mod-logintime
193 $(call Package/freeradius2/Default)
194 DEPENDS:=freeradius2
195 TITLE:=Logintime module
196 endef
197
198 define Package/freeradius2-mod-logintime/conffiles
199 /etc/freeradius2/modules/logintime
200 endef
201
202 define Package/freeradius2-mod-mschap
203 $(call Package/freeradius2/Default)
204 DEPENDS:=freeradius2
205 TITLE:=MS-CHAP and MS-CHAPv2 module
206 endef
207
208 define Package/freeradius2-mod-mschap/conffiles
209 /etc/freeradius2/modules/mschap
210 endef
211
212 define Package/freeradius2-mod-pap
213 $(call Package/freeradius2/Default)
214 DEPENDS:=freeradius2
215 TITLE:=PAP module
216 endef
217
218 define Package/freeradius2-mod-pap/conffiles
219 /etc/freeradius2/modules/pap
220 endef
221
222 define Package/freeradius2-mod-preprocess
223 $(call Package/freeradius2/Default)
224 DEPENDS:=freeradius2
225 TITLE:=Request pre-processing module
226 endef
227
228 define Package/freeradius2-mod-preprocess/conffiles
229 /etc/freeradius2/hints
230 /etc/freeradius2/huntgroups
231 /etc/freeradius2/modules/preprocess
232 endef
233
234 define Package/freeradius2-mod-realm
235 $(call Package/freeradius2/Default)
236 DEPENDS:=freeradius2
237 TITLE:=Realms handling module
238 endef
239
240 define Package/freeradius2-mod-realm/conffiles
241 /etc/freeradius2/proxy.conf
242 /etc/freeradius2/modules/realm
243 endef
244
245 define Package/freeradius2-mod-sql
246 $(call Package/freeradius2/Default)
247 DEPENDS:=freeradius2
248 TITLE:=Base SQL module
249 endef
250
251 define Package/freeradius2-mod-sql/conffiles
252 /etc/freeradius2/sql.conf
253 endef
254
255 define Package/freeradius2-mod-sql-mysql
256 $(call Package/freeradius2/Default)
257 DEPENDS:=freeradius2-mod-sql \
258 +PACKAGE_freeradius2-mod-sql-mysql:libmysqlclient
259 TITLE:=MySQL module
260 endef
261
262 define Package/freeradius2-mod-sql-pgsql
263 $(call Package/freeradius2/Default)
264 DEPENDS:=freeradius2-mod-sql \
265 +PACKAGE_freeradius2-mod-sql-pgsql:libpq
266 TITLE:=PostgreSQL module
267 endef
268
269 define Package/freeradius2-mod-sqlcounter
270 $(call Package/freeradius2/Default)
271 DEPENDS:=freeradius2-mod-sql
272 TITLE:=Generic SQL Counter module
273 endef
274
275 define Package/freeradius2-mod-radutmp
276 $(call Package/freeradius2/Default)
277 DEPENDS:=freeradius2
278 TITLE:=Radius UTMP module
279 endef
280
281 define Package/freeradius2-mod-radutmp/conffiles
282 /etc/freeradius2/modules/radutmp
283 /etc/freeradius2/modules/sradutmp
284 endef
285
286 define Package/freeradius2-utils
287 $(call Package/freeradius2/Default)
288 DEPENDS:=freeradius2
289 TITLE:=Misc. client utilities
290 endef
291
292 CONFIGURE_ARGS+= \
293 --libdir=/usr/lib/freeradius2 \
294 --libexecdir=/usr/lib/freeradius2 \
295 --enable-shared \
296 --disable-static \
297 --disable-developer \
298 --with-threads \
299 --with-openssl-includes="$(STAGING_DIR)/usr/include" \
300 --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
301 --with-system-libtool \
302 --with-system-libltdl \
303 --enable-strict-dependencies \
304 --with-raddbdir=/etc/freeradius2 \
305 --with-radacctdir=/var/db/radacct \
306 --with-logdir=/var/log \
307 --without-edir \
308 --without-snmp \
309 --without-rlm_checkval \
310 --without-rlm_dbm \
311 --without-rlm_counter \
312 --with-rlm_expr \
313 --with-rlm_eap \
314 --without-rlm_eap_sim \
315 --without-rlm_example \
316 --without-rlm_ippool \
317 --without-rlm_krb5 \
318 --without-rlm_otp \
319 --without-rlm_smsotp \
320 --without-rlm_pam \
321 --without-rlm_perl \
322 --without-rlm_python \
323 --without-rlm_smb \
324 --without-rlm_always \
325 --with-rlm_sql \
326 --with-rlm_sqlcounter \
327 --without-rlm_sqlhpwippool \
328 --without-rlm_sqlippool \
329 --without-rlm_sql_db2 \
330 --without-rlm_sql_firebird \
331 --without-rlm_sql_freetds \
332 --without-rlm_sql_iodbc \
333 --without-rlm_sql_oracle \
334 --without-rlm_sql_sybase \
335 --without-rlm_sql_unixodbc \
336 --without-rlm_sql_log \
337 --without-rlm_sql_sqlite \
338 --without-rlm_unix \
339 --without-rlm_eap_tnc \
340 --without-rlm_eap_ikev2 \
341 --without-rlm_opendirectory \
342 --without-rlm_wimax \
343
344 PKG_DICTIONARIES:= \
345 freeradius freeradius.internal \
346 rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
347 rfc4372 rfc4675 rfc4679 \
348 microsoft \
349 wispr \
350
351 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-ldap),)
352 CONFIGURE_ARGS+= \
353 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
354 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
355 CONFIGURE_LIBS+= -lcrypto -lssl
356 else
357 CONFIGURE_ARGS+= --without-rlm_ldap
358 endif
359
360 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-mysql),)
361 CONFIGURE_ARGS+= \
362 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
363 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql"
364 CONFIGURE_LIBS+= -lz
365 CONFIGURE_VARS+= ac_cv_lib_mysqlclient_r_mysql_init=yes
366 else
367 CONFIGURE_ARGS+= --without-rlm_sql_mysql
368 endif
369
370 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-pgsql),)
371 CONFIGURE_ARGS+= \
372 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
373 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
374 else
375 CONFIGURE_ARGS+= --without-rlm_sql_postgresql
376 endif
377
378 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-peap),)
379 CONFIGURE_ARGS+= \
380 --with-rlm_eap_peap \
381 --with-rlm_eap_peap-include-dir="$(STAGING_DIR)/usr/include" \
382 --with-rlm_eap_peap-lib-dir="$(STAGING_DIR)/usr/lib"
383 CONFIGURE_LIBS+= -lcrypto -lssl
384 else
385 CONFIGURE_ARGS+= --without-rlm_eap_peap
386 endif
387
388 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-tls),)
389 CONFIGURE_ARGS+= \
390 --with-rlm_eap_tls \
391 --with-rlm_eap_tls-include-dir="$(STAGING_DIR)/usr/include" \
392 --with-rlm_eap_tls-lib-dir="$(STAGING_DIR)/usr/lib"
393 CONFIGURE_LIBS+= -lcrypto -lssl
394 else
395 CONFIGURE_ARGS+= --without-rlm_eap_tls
396 endif
397
398 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-ttls),)
399 CONFIGURE_ARGS+= \
400 --with-rlm_eap_ttls \
401 --with-rlm_eap_ttls-include-dir="$(STAGING_DIR)/usr/include" \
402 --with-rlm_eap_ttls-lib-dir="$(STAGING_DIR)/usr/lib"
403 CONFIGURE_LIBS+= -lcrypto -lssl
404 else
405 CONFIGURE_ARGS+= --without-rlm_eap_ttls
406 endif
407
408 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-attr-rewrite),)
409 CONFIGURE_ARGS+= --with-rlm_attr-rewrite
410 else
411 CONFIGURE_ARGS+= --without-rlm_attr-rewrite
412 endif
413
414 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-radutmp),)
415 CONFIGURE_ARGS+= --with-rlm_radutmp
416 else
417 CONFIGURE_ARGS+= --without-rlm_radutmp
418 endif
419
420 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-logintime),)
421 CONFIGURE_ARGS+= --with-rlm_logintime
422 else
423 CONFIGURE_ARGS+= --without-rlm_logintime
424 endif
425
426 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-expiration),)
427 CONFIGURE_ARGS+= --with-rlm_expiration
428 else
429 CONFIGURE_ARGS+= --without-rlm_expiration
430 endif
431
432 CONFIGURE_VARS+= \
433 LDFLAGS="$$$$LDFLAGS" \
434 LIBS="$(CONFIGURE_LIBS)" \
435 MYSQL_CONFIG="no" \
436 ac_cv_lib_readline=no \
437
438 define Build/Compile
439 $(MAKE) -C $(PKG_BUILD_DIR) \
440 R="$(PKG_INSTALL_DIR)" \
441 INSTALLSTRIP="" \
442 all certs install
443 endef
444
445 define Package/freeradius2/install
446 $(INSTALL_DIR) $(1)/etc/freeradius2
447 $(INSTALL_DIR) $(1)/etc/freeradius2/modules
448 $(INSTALL_DIR) $(1)/etc/freeradius2/sites
449 chmod 771 $(1)/etc/freeradius2
450 for f in clients.conf dictionary radiusd.conf policy.conf; do \
451 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$${f} $(1)/etc/freeradius2/ ; \
452 done
453 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/sites-available/default $(1)/etc/freeradius2/sites/default
454 $(INSTALL_DIR) $(1)/usr/share/freeradius2
455 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius2/
456 $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius2/dictionary
457 for f in $(PKG_DICTIONARIES); do \
458 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius2/ ; \
459 $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius2/dictionary ; \
460 done
461 $(INSTALL_DIR) $(1)/usr/lib/freeradius2
462 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-radius{,-*}.so $(1)/usr/lib/freeradius2
463 ln -s freeradius2/libfreeradius-radius-$(PKG_VERSION).so $(1)/usr/lib/
464 ln -s freeradius2/libfreeradius-eap-$(PKG_VERSION).so $(1)/usr/lib/
465 $(INSTALL_DIR) $(1)/usr/sbin
466 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
467 $(INSTALL_DIR) $(1)/etc/init.d
468 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
469 endef
470
471 define Package/freeradius2-democerts/install
472 $(INSTALL_DIR) $(1)/etc/freeradius2/certs
473 $(CP) \
474 $(PKG_BUILD_DIR)/raddb/certs/ca.pem \
475 $(PKG_BUILD_DIR)/raddb/certs/dh \
476 $(PKG_BUILD_DIR)/raddb/certs/random \
477 $(PKG_BUILD_DIR)/raddb/certs/server.pem \
478 $(1)/etc/freeradius2/certs/
479 endef
480
481 define Package/freeradius2-utils/install
482 $(INSTALL_DIR) $(1)/usr/bin
483 for f in radclient radeapclient; do \
484 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
485 done
486 endef
487
488 define BuildPlugin
489 define Package/$(1)/install
490 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius2
491 for m in $(2); do \
492 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius2 ; \
493 done
494 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2
495 [ -z "$(4)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2/$(4)
496 for f in $(3); do \
497 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$$$$$${f} $$(1)/etc/freeradius2/$$$$$$$${f} ; \
498 done
499 endef
500
501 $$(eval $$(call BuildPackage,$(1)))
502 endef
503
504 $(eval $(call BuildPackage,freeradius2))
505 $(eval $(call BuildPackage,freeradius2-democerts))
506 $(eval $(call BuildPlugin,freeradius2-mod-chap,rlm_chap,modules/chap,modules,))
507 $(eval $(call BuildPlugin,freeradius2-mod-detail,rlm_detail,modules/detail,modules,))
508 $(eval $(call BuildPlugin,freeradius2-mod-eap,libfreeradius-eap rlm_eap,eap.conf))
509 $(eval $(call BuildPlugin,freeradius2-mod-eap-gtc,rlm_eap_gtc,))
510 $(eval $(call BuildPlugin,freeradius2-mod-eap-md5,rlm_eap_md5,))
511 $(eval $(call BuildPlugin,freeradius2-mod-eap-mschapv2,rlm_eap_mschapv2,))
512 $(eval $(call BuildPlugin,freeradius2-mod-eap-peap,rlm_eap_peap,))
513 $(eval $(call BuildPlugin,freeradius2-mod-eap-tls,rlm_eap_tls,))
514 $(eval $(call BuildPlugin,freeradius2-mod-eap-ttls,rlm_eap_ttls,))
515 $(eval $(call BuildPlugin,freeradius2-mod-exec,rlm_exec,modules/exec modules/echo ,modules,))
516 $(eval $(call BuildPlugin,freeradius2-mod-attr-rewrite,rlm_attr_rewrite,modules/attr_rewrite,modules,))
517 $(eval $(call BuildPlugin,freeradius2-mod-files,rlm_files,acct_users preproxy_users users modules/files,modules,))
518 $(eval $(call BuildPlugin,freeradius2-mod-ldap,rlm_ldap,ldap.attrmap modules/ldap,modules,))
519 $(eval $(call BuildPlugin,freeradius2-mod-mschap,rlm_mschap,modules/mschap,modules,))
520 $(eval $(call BuildPlugin,freeradius2-mod-pap,rlm_pap,modules/pap,modules,))
521 $(eval $(call BuildPlugin,freeradius2-mod-preprocess,rlm_preprocess,hints huntgroups modules/preprocess,modules,))
522 $(eval $(call BuildPlugin,freeradius2-mod-realm,rlm_realm,proxy.conf modules/realm modules/inner-eap,modules,))
523 $(eval $(call BuildPlugin,freeradius2-mod-sql,rlm_sql,sql.conf,))
524 $(eval $(call BuildPlugin,freeradius2-mod-sql-mysql,rlm_sql_mysql,))
525 $(eval $(call BuildPlugin,freeradius2-mod-sql-pgsql,rlm_sql_postgresql,))
526 $(eval $(call BuildPlugin,freeradius2-mod-sqlcounter,rlm_sqlcounter,))
527 $(eval $(call BuildPlugin,freeradius2-mod-radutmp,rlm_radutmp,modules/radutmp modules/sradutmp,modules,))
528 $(eval $(call BuildPlugin,freeradius2-mod-logintime,rlm_logintime,modules/logintime,modules,))
529 $(eval $(call BuildPlugin,freeradius2-mod-expr,rlm_expr,modules/expr,modules,))
530 $(eval $(call BuildPlugin,freeradius2-mod-attr-filter,rlm_attr_filter,modules/attr_filter attrs attrs.access_reject attrs.accounting_response attrs.pre-proxy,modules,,))
531 $(eval $(call BuildPlugin,freeradius2-mod-expiration,rlm_expiration,modules/expiration,modules,))
532 $(eval $(call BuildPackage,freeradius2-utils))