libradius is expected to be in /usr/lib/
[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),)
241 # Make sure the options below are enabled when building with the SDK
242 CONFIG_PACKAGE_freeradius-mod-ldap:=m
243 CONFIG_PACKAGE_freeradius-mod-sql-mysql:=m
244 CONFIG_PACKAGE_freeradius-mod-sql-pgsql:=m
245 endif
246
247 ifneq ($(CONFIG_PACKAGE_freeradius-mod-ldap),)
248 PKG_CONFIGURE_LIBS+= -lcrypto -lssl
249 PKG_CONFIGURE_OPTIONS+= \
250 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
251 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
252 else
253 PKG_CONFIGURE_OPTIONS+= --without-rlm_ldap
254 endif
255
256 ifneq ($(CONFIG_PACKAGE_freeradius-mod-sql-mysql),)
257 PKG_CONFIGURE_LIBS+= -lz
258 PKG_CONFIGURE_OPTIONS+= \
259 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
260 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
261 --without-threads
262 else
263 PKG_CONFIGURE_OPTIONS+= --without-rlm_sql_mysql
264 endif
265
266 ifneq ($(CONFIG_PACKAGE_freeradius-mod-sql-pgsql),)
267 PKG_CONFIGURE_OPTIONS+= \
268 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
269 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
270 else
271 PKG_CONFIGURE_OPTIONS+= --without-rlm_sql_postgresql
272 endif
273
274 ifneq ($(CONFIG_PACKAGE_freeradius-mod-eap-tls),)
275 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_tls
276 else
277 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_tls
278 endif
279
280 ifneq ($(CONFIG_PACKAGE_freeradius-mod-eap-peap),)
281 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_peap
282 else
283 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_peap
284 endif
285
286 ifneq ($(CONFIG_PACKAGE_freeradius-mod-eap-ttls),)
287 PKG_CONFIGURE_OPTIONS+= --with-rlm_eap_ttls
288 else
289 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_ttls
290 endif
291
292 define Build/Configure
293 $(call Build/Configure/Default, \
294 --libdir=/usr/lib/freeradius \
295 --libexecdir=/usr/lib/freeradius \
296 $(PKG_CONFIGURE_OPTIONS) \
297 , \
298 LDFLAGS="$$$$LDFLAGS -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
299 LIBS="$(PKG_CONFIGURE_LIBS)" \
300 sys_lib_search_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
301 MYSQL_CONFIG="no" \
302 )
303 endef
304
305 define Build/Compile
306 $(MAKE) -C $(PKG_BUILD_DIR) \
307 R="$(PKG_INSTALL_DIR)" \
308 INSTALLSTRIP="" \
309 all install
310 endef
311
312 define Package/freeradius/install
313 $(INSTALL_DIR) $(1)/etc/freeradius
314 for f in clients.conf dictionary radiusd.conf; do \
315 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} $(1)/etc/freeradius/ ; \
316 done
317 $(INSTALL_DIR) $(1)/usr/share/freeradius
318 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius/
319 for f in $(PKG_DICTIONARIES); do \
320 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius/ ; \
321 done
322 $(INSTALL_DIR) $(1)/usr/lib/freeradius
323 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/
324 $(INSTALL_DIR) $(1)/usr/sbin
325 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
326 $(INSTALL_DIR) $(1)/etc/init.d
327 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
328 endef
329
330 define Package/freeradius-democerts/install
331 $(INSTALL_DIR) $(1)/etc/freeradius
332 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/certs $(1)/etc/freeradius/
333 rm -rf $(1)/etc/freeradius/certs/README
334 rm -rf $(1)/etc/freeradius/certs/new*
335 rm -rf $(1)/etc/freeradius/certs/demoCA/index*
336 rm -rf $(1)/etc/freeradius/certs/demoCA/serial*
337 endef
338
339 define Package/freeradius-utils/install
340 $(INSTALL_DIR) $(1)/usr/bin
341 for f in radclient radeapclient; do \
342 $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
343 done
344 endef
345
346 define BuildPlugin
347 define Package/$(1)/install
348 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius
349 for m in $(2); do \
350 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius/ ; \
351 done
352 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius
353 for f in $(3); do \
354 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$$$$$${f} $$(1)/etc/freeradius/ ; \
355 done
356 endef
357
358 $$(eval $$(call BuildPackage,$(1)))
359 endef
360
361 $(eval $(call BuildPackage,freeradius))
362 $(eval $(call BuildPackage,freeradius-democerts))
363 $(eval $(call BuildPlugin,freeradius-mod-chap,rlm_chap,))
364 $(eval $(call BuildPlugin,freeradius-mod-detail,rlm_detail,))
365 $(eval $(call BuildPlugin,freeradius-mod-eap,libeap rlm_eap,eap.conf))
366 $(eval $(call BuildPlugin,freeradius-mod-eap-gtc,rlm_eap_gtc,))
367 $(eval $(call BuildPlugin,freeradius-mod-eap-md5,rlm_eap_md5,))
368 $(eval $(call BuildPlugin,freeradius-mod-eap-mschapv2,rlm_eap_mschapv2,))
369 $(eval $(call BuildPlugin,freeradius-mod-eap-peap,rlm_eap_peap,))
370 $(eval $(call BuildPlugin,freeradius-mod-eap-tls,rlm_eap_tls,))
371 $(eval $(call BuildPlugin,freeradius-mod-eap-ttls,rlm_eap_ttls,))
372 $(eval $(call BuildPlugin,freeradius-mod-files,rlm_files,acct_users preproxy_users users))
373 $(eval $(call BuildPlugin,freeradius-mod-ldap,rlm_ldap,ldap.attrmap))
374 $(eval $(call BuildPlugin,freeradius-mod-mschap,rlm_mschap,))
375 $(eval $(call BuildPlugin,freeradius-mod-pap,rlm_pap,))
376 $(eval $(call BuildPlugin,freeradius-mod-preprocess,rlm_preprocess,hints huntgroups))
377 $(eval $(call BuildPlugin,freeradius-mod-realm,rlm_realm,proxy.conf))
378 $(eval $(call BuildPlugin,freeradius-mod-sql,rlm_sql,sql.conf))
379 $(eval $(call BuildPlugin,freeradius-mod-sql-mysql,rlm_sql_mysql,))
380 $(eval $(call BuildPlugin,freeradius-mod-sql-pgsql,rlm_sql_postgresql,))
381 $(eval $(call BuildPlugin,freeradius-mod-sqlcounter,rlm_sqlcounter,))
382 $(eval $(call BuildPackage,freeradius-utils))