fix freeradius SDK builds
[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.2
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/radius/ \
17 http://freeradius.portal-to-web.de/ \
18 ftp://ftp.uk.freeradius.org/pub/radius/
19 PKG_MD5SUM:=6649ac5f9666b4a8cd55a837068ca61e
20 PKG_CAT:=zcat
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
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-files
110 $(call Package/freeradius/Default)
111 DEPENDS:=freeradius
112 TITLE:=Module using local files for authorization
113 endef
114
115 define Package/freeradius-mod-files/conffiles
116 /etc/freeradius/acct_users
117 /etc/freeradius/preproxy_users
118 /etc/freeradius/users
119 endef
120
121 define Package/freeradius-mod-ldap
122 $(call Package/freeradius/Default)
123 DEPENDS:=freeradius +libopenldap
124 TITLE:=LDAP module
125 endef
126
127 define Package/freeradius-mod-ldap/conffiles
128 /etc/freeradius/ldap.attrmap
129 endef
130
131 define Package/freeradius-mod-mschap
132 $(call Package/freeradius/Default)
133 DEPENDS:=freeradius
134 TITLE:=MS-CHAP and MS-CHAPv2 module
135 endef
136
137 define Package/freeradius-mod-pap
138 $(call Package/freeradius/Default)
139 DEPENDS:=freeradius
140 TITLE:=PAP module
141 endef
142
143 define Package/freeradius-mod-preprocess
144 $(call Package/freeradius/Default)
145 DEPENDS:=freeradius
146 TITLE:=Request pre-processing module
147 endef
148
149 define Package/freeradius-mod-preprocess/conffiles
150 /etc/freeradius/hints
151 /etc/freeradius/huntgroups
152 endef
153
154 define Package/freeradius-mod-realm
155 $(call Package/freeradius/Default)
156 DEPENDS:=freeradius
157 TITLE:=Realms handling module
158 endef
159
160 define Package/freeradius-mod-realm/conffiles
161 /etc/freeradius/proxy.conf
162 endef
163
164 define Package/freeradius-mod-sql
165 $(call Package/freeradius/Default)
166 DEPENDS:=freeradius
167 TITLE:=Base SQL module
168 endef
169
170 define Package/freeradius-mod-sql-mysql
171 $(call Package/freeradius/Default)
172 DEPENDS:=freeradius-mod-sql +libmysqlclient
173 TITLE:=MySQL module
174 endef
175
176 define Package/freeradius-mod-sql-pgsql
177 $(call Package/freeradius/Default)
178 DEPENDS:=freeradius-mod-sql +libpq
179 TITLE:=PostgreSQL module
180 endef
181
182 define Package/freeradius-mod-sqlcounter
183 $(call Package/freeradius/Default)
184 DEPENDS:=freeradius-mod-sql
185 TITLE:=Generic SQL Counter module
186 endef
187
188 define Package/freeradius-utils
189 $(call Package/freeradius/Default)
190 DEPENDS:=freeradius
191 TITLE:=Misc. client utilities
192 endef
193
194 PKG_CONFIGURE_OPTIONS:= \
195 --enable-shared \
196 --disable-static \
197 --disable-ltdl-install \
198 --with-ltdl-include="$(STAGING_DIR)/usr/include" \
199 --with-ltdl-lib="$(STAGING_DIR)/usr/lib" \
200 --with-openssl-includes="$(STAGING_DIR)/usr/include" \
201 --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
202 --enable-strict-dependencies \
203 --with-raddbdir=/etc/freeradius \
204 --without-edir \
205 --without-snmp \
206 --with-experimental-modules \
207 --without-rlm_attr-rewrite \
208 --without-rlm_checkval \
209 --without-rlm_counter \
210 --without-rlm_dbm \
211 --with-rlm_eap \
212 --without-rlm_eap_sim \
213 --without-rlm_example \
214 --without-rlm_ippool \
215 --without-rlm_krb5 \
216 --without-rlm_otp \
217 --without-rlm_pam \
218 --without-rlm_perl \
219 --without-rlm_python \
220 --without-rlm_radutmp \
221 --without-rlm_smb \
222 --with-rlm_sql \
223 --with-rlm_sqlcounter \
224 --without-rlm_sqlippool \
225 --without-rlm_sql_db2 \
226 --without-rlm_sql_freetds \
227 --without-rlm_sql_iodbc \
228 --without-rlm_sql_oracle \
229 --without-rlm_sql_sybase \
230 --without-rlm_sql_unixodbc \
231 --without-rlm_sql_log \
232 --without-rlm_unix \
233
234 PKG_DICTIONARIES:= \
235 freeradius freeradius.internal \
236 rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
237 microsoft \
238 wispr \
239
240 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-ldap),)
241 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
242 PKG_CONFIGURE_OPTIONS+= \
243 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
244 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
245 else
246 PKG_CONFIGURE_OPTIONS+= --without-rlm_ldap
247 endif
248
249 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-mysql),)
250 PKG_CONFIGURE_LIBS+= -lz
251 PKG_CONFIGURE_OPTIONS+= \
252 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
253 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
254 --without-threads
255 else
256 PKG_CONFIGURE_OPTIONS+= --without-rlm_sql_mysql
257 endif
258
259 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-pgsql),)
260 PKG_CONFIGURE_OPTIONS+= \
261 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
262 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
263 else
264 PKG_CONFIGURE_OPTIONS+= --without-rlm_sql_postgresql
265 endif
266
267 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-peap),)
268 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_peap
269 else
270 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_peap
271 endif
272
273 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-tls),)
274 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_tls
275 else
276 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_tls
277 endif
278
279 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-ttls),)
280 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_ttls
281 else
282 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_ttls
283 endif
284
285 define Build/Configure
286 $(call Build/Configure/Default, \
287 --libdir=/usr/lib/freeradius \
288 --libexecdir=/usr/lib/freeradius \
289 $(PKG_CONFIGURE_OPTIONS) \
290 , \
291 LDFLAGS="$$$$LDFLAGS -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
292 LIBS="$(PKG_CONFIGURE_LIBS)" \
293 sys_lib_search_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
294 MYSQL_CONFIG="no" \
295 )
296 endef
297
298 define Build/Compile
299 $(MAKE) -C $(PKG_BUILD_DIR) \
300 R="$(PKG_INSTALL_DIR)" \
301 INSTALLSTRIP="" \
302 all install
303 endef
304
305 define Package/freeradius/install
306 $(INSTALL_DIR) $(1)/etc/freeradius
307 for f in clients.conf dictionary radiusd.conf; do \
308 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} $(1)/etc/freeradius/ ; \
309 done
310 $(INSTALL_DIR) $(1)/usr/share/freeradius
311 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius/
312 for f in $(PKG_DICTIONARIES); do \
313 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius/ ; \
314 done
315 $(INSTALL_DIR) $(1)/usr/lib/freeradius
316 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/
317 $(INSTALL_DIR) $(1)/usr/sbin
318 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
319 $(INSTALL_DIR) $(1)/etc/init.d
320 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
321 endef
322
323 define Package/freeradius-democerts/install
324 $(INSTALL_DIR) $(1)/etc/freeradius
325 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/certs $(1)/etc/freeradius/
326 rm -rf $(1)/etc/freeradius/certs/README
327 rm -rf $(1)/etc/freeradius/certs/new*
328 rm -rf $(1)/etc/freeradius/certs/demoCA/index*
329 rm -rf $(1)/etc/freeradius/certs/demoCA/serial*
330 endef
331
332 define Package/freeradius-utils/install
333 $(INSTALL_DIR) $(1)/usr/bin
334 for f in radclient radeapclient; do \
335 $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
336 done
337 endef
338
339 define BuildPlugin
340 define Package/$(1)/install
341 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius
342 for m in $(2); do \
343 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius/ ; \
344 done
345 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius
346 for f in $(3); do \
347 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$$$$$${f} $$(1)/etc/freeradius/ ; \
348 done
349 endef
350
351 $$(eval $$(call BuildPackage,$(1)))
352 endef
353
354 $(eval $(call BuildPackage,freeradius))
355 $(eval $(call BuildPackage,freeradius-democerts))
356 $(eval $(call BuildPlugin,freeradius-mod-chap,rlm_chap,))
357 $(eval $(call BuildPlugin,freeradius-mod-detail,rlm_detail,))
358 $(eval $(call BuildPlugin,freeradius-mod-eap,libeap rlm_eap,eap.conf))
359 $(eval $(call BuildPlugin,freeradius-mod-eap-gtc,rlm_eap_gtc,))
360 $(eval $(call BuildPlugin,freeradius-mod-eap-md5,rlm_eap_md5,))
361 $(eval $(call BuildPlugin,freeradius-mod-eap-mschapv2,rlm_eap_mschapv2,))
362 $(eval $(call BuildPlugin,freeradius-mod-eap-peap,rlm_eap_peap,))
363 $(eval $(call BuildPlugin,freeradius-mod-eap-tls,rlm_eap_tls,))
364 $(eval $(call BuildPlugin,freeradius-mod-eap-ttls,rlm_eap_ttls,))
365 $(eval $(call BuildPlugin,freeradius-mod-files,rlm_files,acct_users preproxy_users users))
366 $(eval $(call BuildPlugin,freeradius-mod-ldap,rlm_ldap,ldap.attrmap))
367 $(eval $(call BuildPlugin,freeradius-mod-mschap,rlm_mschap,))
368 $(eval $(call BuildPlugin,freeradius-mod-pap,rlm_pap,))
369 $(eval $(call BuildPlugin,freeradius-mod-preprocess,rlm_preprocess,hints huntgroups))
370 $(eval $(call BuildPlugin,freeradius-mod-realm,rlm_realm,proxy.conf))
371 $(eval $(call BuildPlugin,freeradius-mod-sql,rlm_sql,sql.conf))
372 $(eval $(call BuildPlugin,freeradius-mod-sql-mysql,rlm_sql_mysql,))
373 $(eval $(call BuildPlugin,freeradius-mod-sql-pgsql,rlm_sql_postgresql,))
374 $(eval $(call BuildPlugin,freeradius-mod-sqlcounter,rlm_sqlcounter,))
375 $(eval $(call BuildPackage,freeradius-utils))