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