Fix freeradius compilation when not selecting all EAP modules (#1373)
[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 ifeq ($(CONFIG_PACKAGE_freeradius-mod-eap-tls),)
275 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_tls
276 endif
277
278 ifeq ($(CONFIG_PACKAGE_freeradius-mod-eap-peap),)
279 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_peap
280 endif
281
282 ifeq ($(CONFIG_PACKAGE_freeradius-mod-eap-ttls),)
283 PKG_CONFIGURE_OPTIONS+= --without-rlm_eap_ttls
284 endif
285
286 define Build/Configure
287 $(call Build/Configure/Default, \
288 --libdir=/usr/lib/freeradius \
289 --libexecdir=/usr/lib/freeradius \
290 $(PKG_CONFIGURE_OPTIONS) \
291 , \
292 LDFLAGS="$$$$LDFLAGS -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
293 LIBS="$(PKG_CONFIGURE_LIBS)" \
294 sys_lib_search_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
295 MYSQL_CONFIG="no" \
296 )
297 endef
298
299 define Build/Compile
300 $(MAKE) -C $(PKG_BUILD_DIR) \
301 R="$(PKG_INSTALL_DIR)" \
302 INSTALLSTRIP="" \
303 all install
304 endef
305
306 define Package/freeradius/install
307 $(INSTALL_DIR) $(1)/etc/freeradius
308 for f in clients.conf dictionary radiusd.conf; do \
309 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} $(1)/etc/freeradius/ ; \
310 done
311 $(INSTALL_DIR) $(1)/usr/share/freeradius
312 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius/
313 for f in $(PKG_DICTIONARIES); do \
314 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius/ ; \
315 done
316 $(INSTALL_DIR) $(1)/usr/lib/freeradius
317 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/freeradius/
318 $(INSTALL_DIR) $(1)/usr/sbin
319 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
320 $(INSTALL_DIR) $(1)/etc/init.d
321 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
322 endef
323
324 define Package/freeradius-democerts/install
325 $(INSTALL_DIR) $(1)/etc/freeradius
326 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/certs $(1)/etc/freeradius/
327 rm -rf $(1)/etc/freeradius/certs/README
328 rm -rf $(1)/etc/freeradius/certs/new*
329 rm -rf $(1)/etc/freeradius/certs/demoCA/index*
330 rm -rf $(1)/etc/freeradius/certs/demoCA/serial*
331 endef
332
333 define Package/freeradius-utils/install
334 $(INSTALL_DIR) $(1)/usr/bin
335 for f in radclient radeapclient; do \
336 $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
337 done
338 endef
339
340 define BuildPlugin
341 define Package/$(1)/install
342 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius
343 for m in $(2); do \
344 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius/ ; \
345 done
346 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius
347 for f in $(3); do \
348 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$$$$$${f} $$(1)/etc/freeradius/ ; \
349 done
350 endef
351
352 $$(eval $$(call BuildPackage,$(1)))
353 endef
354
355 $(eval $(call BuildPackage,freeradius))
356 $(eval $(call BuildPackage,freeradius-democerts))
357 $(eval $(call BuildPlugin,freeradius-mod-chap,rlm_chap,))
358 $(eval $(call BuildPlugin,freeradius-mod-detail,rlm_detail,))
359 $(eval $(call BuildPlugin,freeradius-mod-eap,libeap rlm_eap,eap.conf))
360 $(eval $(call BuildPlugin,freeradius-mod-eap-gtc,rlm_eap_gtc,))
361 $(eval $(call BuildPlugin,freeradius-mod-eap-md5,rlm_eap_md5,))
362 $(eval $(call BuildPlugin,freeradius-mod-eap-mschapv2,rlm_eap_mschapv2,))
363 $(eval $(call BuildPlugin,freeradius-mod-eap-peap,rlm_eap_peap,))
364 $(eval $(call BuildPlugin,freeradius-mod-eap-tls,rlm_eap_tls,))
365 $(eval $(call BuildPlugin,freeradius-mod-eap-ttls,rlm_eap_ttls,))
366 $(eval $(call BuildPlugin,freeradius-mod-files,rlm_files,acct_users preproxy_users users))
367 $(eval $(call BuildPlugin,freeradius-mod-ldap,rlm_ldap,ldap.attrmap))
368 $(eval $(call BuildPlugin,freeradius-mod-mschap,rlm_mschap,))
369 $(eval $(call BuildPlugin,freeradius-mod-pap,rlm_pap,))
370 $(eval $(call BuildPlugin,freeradius-mod-preprocess,rlm_preprocess,hints huntgroups))
371 $(eval $(call BuildPlugin,freeradius-mod-realm,rlm_realm,proxy.conf))
372 $(eval $(call BuildPlugin,freeradius-mod-sql,rlm_sql,sql.conf))
373 $(eval $(call BuildPlugin,freeradius-mod-sql-mysql,rlm_sql_mysql,))
374 $(eval $(call BuildPlugin,freeradius-mod-sql-pgsql,rlm_sql_postgresql,))
375 $(eval $(call BuildPlugin,freeradius-mod-sqlcounter,rlm_sqlcounter,))
376 $(eval $(call BuildPackage,freeradius-utils))