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