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