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