55798727be81fe9f4ba910156307b84f13e47ded
[openwrt/svn-archive/archive.git] / openwrt / package / freeradius / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=freeradius
6 PKG_VERSION:=1.0.4
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=edb5c3af6fabeff7b8e1131b6fa33e24
9
10 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/radius/ \
11 http://freeradius.portal-to-web.de/ \
12 ftp://ftp.uk.freeradius.org/pub/radius/
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
14 PKG_CAT:=zcat
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
18
19 PKG_CONFIGURE_OPTIONS := \
20 --enable-shared \
21 --disable-static \
22 --disable-ltdl-install \
23 --with-ltdl-include="$(STAGING_DIR)/usr/include" \
24 --with-ltdl-lib="$(STAGING_DIR)/usr/lib" \
25 --with-openssl-includes="$(STAGING_DIR)/usr/include" \
26 --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
27 --enable-strict-dependencies \
28 --with-raddbdir=/etc/freeradius \
29 --without-edir \
30 --without-snmp \
31 --with-experimental-modules \
32 --without-rlm_attr-rewrite \
33 --without-rlm_checkval \
34 --without-rlm_counter \
35 --without-rlm_dbm \
36 --with-rlm_eap \
37 --without-rlm_eap_sim \
38 --without-rlm_example \
39 --without-rlm_ippool \
40 --without-rlm_krb5 \
41 --without-rlm_pam \
42 --without-rlm_perl \
43 --without-rlm_python \
44 --without-rlm_radutmp \
45 --without-rlm_smb \
46 --with-rlm_sql \
47 --with-rlm_sqlcounter \
48 --without-rlm_sql_db2 \
49 --without-rlm_sql_freetds \
50 --without-rlm_sql_iodbc \
51 --without-rlm_sql_oracle \
52 --without-rlm_sql_sybase \
53 --without-rlm_sql_unixodbc \
54 --without-rlm_unix \
55 --without-rlm_x99-token \
56
57 ifneq ($(BR2_PACKAGE_FREERADIUS_MOD_LDAP),)
58 PKG_CONFIGURE_OPTIONS += \
59 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
60 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
61 else
62 PKG_CONFIGURE_OPTIONS += --without-rlm_ldap
63 endif
64 ifneq ($(BR2_PACKAGE_FREERADIUS_MOD_SQL_MYSQL),)
65 PKG_CONFIGURE_OPTIONS += \
66 --with-mysql-include-dir="$(STAGING_DIR)/usr/include/mysql" \
67 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql"
68 else
69 PKG_CONFIGURE_OPTIONS += --without-rlm_sql_mysql
70 endif
71 ifneq ($(BR2_PACKAGE_FREERADIUS_MOD_SQL_PGSQL),)
72 PKG_CONFIGURE_OPTIONS += \
73 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
74 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
75 else
76 PKG_CONFIGURE_OPTIONS += --without-rlm_sql_postgresql
77 endif
78
79 include $(TOPDIR)/package/rules.mk
80
81 define PKG_mod_template
82
83 $$(IPKG_$(1)):
84 [ -z "$(2)" ] || install -d -m0755 $$(IDIR_$(1))/usr/lib/freeradius
85 for m in $(2); do \
86 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$${m}{,-*}.so \
87 $$(IDIR_$(1))/usr/lib/freeradius/ ; \
88 done
89 [ -z "$(3)" ] || install -d -m0755 $$(IDIR_$(1))/etc/freeradius
90 for f in $(3); do \
91 cp -fpR $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} \
92 $$(IDIR_$(1))/etc/freeradius/ ; \
93 done
94 $(RSTRIP) $$(IDIR_$(1))
95 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
96
97 endef
98
99 $(eval $(call PKG_template,FREERADIUS,freeradius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
100 $(eval $(call PKG_template,FREERADIUS_DEMOCERTS,freeradius-democerts,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
101 $(eval $(call PKG_template,FREERADIUS_MOD_CHAP,freeradius-mod-chap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
102 $(eval $(call PKG_template,FREERADIUS_MOD_EAP,freeradius-mod-eap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
103 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_GTC,freeradius-mod-eap-gtc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
104 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_MD5,freeradius-mod-eap-md5,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
105 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_MSCHAPV2,freeradius-mod-eap-mschapv2,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
106 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_PEAP,freeradius-mod-eap-peap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
107 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_TLS,freeradius-mod-eap-tls,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
108 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_TTLS,freeradius-mod-eap-ttls,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
109 $(eval $(call PKG_template,FREERADIUS_MOD_FILES,freeradius-mod-files,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
110 $(eval $(call PKG_template,FREERADIUS_MOD_LDAP,freeradius-mod-ldap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
111 $(eval $(call PKG_template,FREERADIUS_MOD_MSCHAP,freeradius-mod-mschap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
112 $(eval $(call PKG_template,FREERADIUS_MOD_PAP,freeradius-mod-pap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
113 $(eval $(call PKG_template,FREERADIUS_MOD_SQL,freeradius-mod-sql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
114 $(eval $(call PKG_template,FREERADIUS_MOD_SQL_MYSQL,freeradius-mod-sql-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
115 $(eval $(call PKG_template,FREERADIUS_MOD_SQL_PGSQL,freeradius-mod-sql-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
116 $(eval $(call PKG_template,FREERADIUS_MOD_SQLCOUNTER,freeradius-mod-sqlcounter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
117 $(eval $(call PKG_template,FREERADIUS_UTILS,freeradius-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
118
119 $(eval $(call PKG_mod_template,FREERADIUS_MOD_CHAP,rlm_chap,))
120 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP,libeap rlm_eap,eap.conf))
121 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_GTC,rlm_eap_gtc,))
122 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_MD5,rlm_eap_md5,))
123 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_MSCHAPV2,rlm_eap_mschapv2,))
124 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_PEAP,rlm_eap_peap,))
125 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_TLS,rlm_eap_tls,))
126 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_TTLS,rlm_eap_ttls,))
127 $(eval $(call PKG_mod_template,FREERADIUS_MOD_FILES,rlm_files,acct_users preproxy_users users))
128 $(eval $(call PKG_mod_template,FREERADIUS_MOD_LDAP,rlm_ldap,ldap.attrmap))
129 $(eval $(call PKG_mod_template,FREERADIUS_MOD_MSCHAP,rlm_mschap,))
130 $(eval $(call PKG_mod_template,FREERADIUS_MOD_PAP,rlm_pap,))
131 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL,rlm_sql,sql.conf))
132 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL_MYSQL,rlm_sql_mysql,))
133 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL_PGSQL,rlm_sql_postgresql,))
134 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQLCOUNTER,rlm_sqlcounter,))
135
136 $(PKG_BUILD_DIR)/.configured:
137 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
138 $(TARGET_CONFIGURE_OPTS) \
139 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
140 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
141 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
142 sys_lib_dlsearch_path_spec="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
143 sys_lib_search_path_spec="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
144 MYSQL_CONFIG="no" \
145 ./configure \
146 --target=$(GNU_TARGET_NAME) \
147 --host=$(GNU_TARGET_NAME) \
148 --build=$(GNU_HOST_NAME) \
149 --program-prefix="" \
150 --program-suffix="" \
151 --prefix=/usr \
152 --exec-prefix=/usr \
153 --bindir=/usr/bin \
154 --datadir=/usr/share \
155 --includedir=/usr/include \
156 --infodir=/usr/share/info \
157 --libdir=/usr/lib/freeradius \
158 --libexecdir=/usr/lib/freeradius \
159 --localstatedir=/var \
160 --mandir=/usr/share/man \
161 --sbindir=/usr/sbin \
162 --sysconfdir=/etc \
163 $(DISABLE_LARGEFILE) \
164 $(DISABLE_NLS) \
165 $(PKG_CONFIGURE_OPTIONS) \
166 )
167 touch $@
168
169 $(PKG_BUILD_DIR)/.built:
170 rm -rf $(PKG_INSTALL_DIR)
171 mkdir -p $(PKG_INSTALL_DIR)
172 $(MAKE) -C $(PKG_BUILD_DIR) \
173 R="$(PKG_INSTALL_DIR)" \
174 INSTALLSTRIP="" \
175 all install
176 touch $@
177
178 $(IPKG_FREERADIUS):
179 install -m0755 -d $(IDIR_FREERADIUS)/etc/init.d
180 install -m0755 ./files/radiusd.init $(IDIR_FREERADIUS)/etc/init.d/radiusd
181 install -m0755 -d $(IDIR_FREERADIUS)/etc/freeradius
182 for f in clients.conf dictionary radiusd.conf; do \
183 cp -fpR $(PKG_INSTALL_DIR)/etc/freeradius/$${f} \
184 $(IDIR_FREERADIUS)/etc/freeradius/ ; \
185 done
186 install -m0755 -d $(IDIR_FREERADIUS)/usr/share/freeradius
187 cp -fpR $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary \
188 $(IDIR_FREERADIUS)/usr/share/freeradius/
189 for f in cisco freeradius microsoft tunnel wispr; do \
190 cp -fpR $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$${f} \
191 $(IDIR_FREERADIUS)/usr/share/freeradius/ ; \
192 done
193 install -m0755 -d $(IDIR_FREERADIUS)/usr/lib/freeradius
194 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so \
195 $(IDIR_FREERADIUS)/usr/lib/freeradius/
196 install -m0755 -d $(IDIR_FREERADIUS)/usr/sbin
197 cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/radiusd \
198 $(IDIR_FREERADIUS)/usr/sbin/
199 $(RSTRIP) $(IDIR_FREERADIUS)
200 $(IPKG_BUILD) $(IDIR_FREERADIUS) $(PACKAGE_DIR)
201
202 $(IPKG_FREERADIUS_DEMOCERTS):
203 install -m0755 -d $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius
204 cp -fpR $(PKG_INSTALL_DIR)/etc/freeradius/certs \
205 $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/
206 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/README
207 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/new*
208 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/demoCA/index*
209 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/demoCA/serial*
210 $(RSTRIP) $(IDIR_FREERADIUS_DEMOCERTS)
211 $(IPKG_BUILD) $(IDIR_FREERADIUS_DEMOCERTS) $(PACKAGE_DIR)
212
213 $(IPKG_FREERADIUS_UTILS):
214 install -m0755 -d $(IDIR_FREERADIUS_UTILS)/usr/bin
215 for f in radclient radeapclient; do \
216 cp -fpR $(PKG_INSTALL_DIR)/usr/bin/$${f} \
217 $(IDIR_FREERADIUS_UTILS)/usr/bin/ ; \
218 done
219 $(RSTRIP) $(IDIR_FREERADIUS_UTILS)
220 $(IPKG_BUILD) $(IDIR_FREERADIUS_UTILS) $(PACKAGE_DIR)
221