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