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