add detail, preprocess and realm sub-packages,
[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_DETAIL,freeradius-mod-detail,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
103 $(eval $(call PKG_template,FREERADIUS_MOD_EAP,freeradius-mod-eap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
104 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_GTC,freeradius-mod-eap-gtc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
105 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_MD5,freeradius-mod-eap-md5,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
106 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_MSCHAPV2,freeradius-mod-eap-mschapv2,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
107 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_PEAP,freeradius-mod-eap-peap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
108 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_TLS,freeradius-mod-eap-tls,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
109 $(eval $(call PKG_template,FREERADIUS_MOD_EAP_TTLS,freeradius-mod-eap-ttls,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
110 $(eval $(call PKG_template,FREERADIUS_MOD_FILES,freeradius-mod-files,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
111 $(eval $(call PKG_template,FREERADIUS_MOD_LDAP,freeradius-mod-ldap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
112 $(eval $(call PKG_template,FREERADIUS_MOD_MSCHAP,freeradius-mod-mschap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
113 $(eval $(call PKG_template,FREERADIUS_MOD_PAP,freeradius-mod-pap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
114 $(eval $(call PKG_template,FREERADIUS_MOD_PREPROCESS,freeradius-mod-preprocess,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
115 $(eval $(call PKG_template,FREERADIUS_MOD_REALM,freeradius-mod-realm,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
116 $(eval $(call PKG_template,FREERADIUS_MOD_SQL,freeradius-mod-sql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
117 $(eval $(call PKG_template,FREERADIUS_MOD_SQL_MYSQL,freeradius-mod-sql-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
118 $(eval $(call PKG_template,FREERADIUS_MOD_SQL_PGSQL,freeradius-mod-sql-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
119 $(eval $(call PKG_template,FREERADIUS_MOD_SQLCOUNTER,freeradius-mod-sqlcounter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
120 $(eval $(call PKG_template,FREERADIUS_UTILS,freeradius-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
121
122 $(eval $(call PKG_mod_template,FREERADIUS_MOD_CHAP,rlm_chap,))
123 $(eval $(call PKG_mod_template,FREERADIUS_MOD_DETAIL,rlm_detail,))
124 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP,libeap rlm_eap,eap.conf))
125 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_GTC,rlm_eap_gtc,))
126 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_MD5,rlm_eap_md5,))
127 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_MSCHAPV2,rlm_eap_mschapv2,))
128 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_PEAP,rlm_eap_peap,))
129 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_TLS,rlm_eap_tls,))
130 $(eval $(call PKG_mod_template,FREERADIUS_MOD_EAP_TTLS,rlm_eap_ttls,))
131 $(eval $(call PKG_mod_template,FREERADIUS_MOD_FILES,rlm_files,acct_users preproxy_users users))
132 $(eval $(call PKG_mod_template,FREERADIUS_MOD_LDAP,rlm_ldap,ldap.attrmap))
133 $(eval $(call PKG_mod_template,FREERADIUS_MOD_MSCHAP,rlm_mschap,))
134 $(eval $(call PKG_mod_template,FREERADIUS_MOD_PAP,rlm_pap,))
135 $(eval $(call PKG_mod_template,FREERADIUS_MOD_PREPROCESS,rlm_preprocess,hints huntgroups))
136 $(eval $(call PKG_mod_template,FREERADIUS_MOD_REALM,rlm_realm,proxy.conf))
137 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL,rlm_sql,sql.conf))
138 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL_MYSQL,rlm_sql_mysql,))
139 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQL_PGSQL,rlm_sql_postgresql,))
140 $(eval $(call PKG_mod_template,FREERADIUS_MOD_SQLCOUNTER,rlm_sqlcounter,))
141
142 $(PKG_BUILD_DIR)/.configured:
143 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
144 $(TARGET_CONFIGURE_OPTS) \
145 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
146 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
147 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
148 sys_lib_dlsearch_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
149 sys_lib_search_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
150 MYSQL_CONFIG="no" \
151 ./configure \
152 --target=$(GNU_TARGET_NAME) \
153 --host=$(GNU_TARGET_NAME) \
154 --build=$(GNU_HOST_NAME) \
155 --program-prefix="" \
156 --program-suffix="" \
157 --prefix=/usr \
158 --exec-prefix=/usr \
159 --bindir=/usr/bin \
160 --datadir=/usr/share \
161 --includedir=/usr/include \
162 --infodir=/usr/share/info \
163 --libdir=/usr/lib/freeradius \
164 --libexecdir=/usr/lib/freeradius \
165 --localstatedir=/var \
166 --mandir=/usr/share/man \
167 --sbindir=/usr/sbin \
168 --sysconfdir=/etc \
169 $(DISABLE_LARGEFILE) \
170 $(DISABLE_NLS) \
171 $(PKG_CONFIGURE_OPTIONS) \
172 )
173 touch $@
174
175 $(PKG_BUILD_DIR)/.built:
176 rm -rf $(PKG_INSTALL_DIR)
177 mkdir -p $(PKG_INSTALL_DIR)
178 $(MAKE) -C $(PKG_BUILD_DIR) \
179 R="$(PKG_INSTALL_DIR)" \
180 INSTALLSTRIP="" \
181 all install
182 touch $@
183
184 $(IPKG_FREERADIUS):
185 install -m0755 -d $(IDIR_FREERADIUS)/etc/init.d
186 install -m0755 ./files/radiusd.init $(IDIR_FREERADIUS)/etc/init.d/radiusd
187 install -m0755 -d $(IDIR_FREERADIUS)/etc/freeradius
188 for f in clients.conf dictionary radiusd.conf; do \
189 cp -fpR $(PKG_INSTALL_DIR)/etc/freeradius/$${f} \
190 $(IDIR_FREERADIUS)/etc/freeradius/ ; \
191 done
192 install -m0755 -d $(IDIR_FREERADIUS)/usr/share/freeradius
193 cp -fpR $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary \
194 $(IDIR_FREERADIUS)/usr/share/freeradius/
195 for f in cisco freeradius microsoft tunnel wispr; do \
196 cp -fpR $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$${f} \
197 $(IDIR_FREERADIUS)/usr/share/freeradius/ ; \
198 done
199 install -m0755 -d $(IDIR_FREERADIUS)/usr/lib/freeradius
200 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so \
201 $(IDIR_FREERADIUS)/usr/lib/freeradius/
202 install -m0755 -d $(IDIR_FREERADIUS)/usr/sbin
203 cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/radiusd \
204 $(IDIR_FREERADIUS)/usr/sbin/
205 $(RSTRIP) $(IDIR_FREERADIUS)
206 $(IPKG_BUILD) $(IDIR_FREERADIUS) $(PACKAGE_DIR)
207
208 $(IPKG_FREERADIUS_DEMOCERTS):
209 install -m0755 -d $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius
210 cp -fpR $(PKG_INSTALL_DIR)/etc/freeradius/certs \
211 $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/
212 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/README
213 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/new*
214 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/demoCA/index*
215 rm -rf $(IDIR_FREERADIUS_DEMOCERTS)/etc/freeradius/certs/demoCA/serial*
216 $(RSTRIP) $(IDIR_FREERADIUS_DEMOCERTS)
217 $(IPKG_BUILD) $(IDIR_FREERADIUS_DEMOCERTS) $(PACKAGE_DIR)
218
219 $(IPKG_FREERADIUS_UTILS):
220 install -m0755 -d $(IDIR_FREERADIUS_UTILS)/usr/bin
221 for f in radclient radeapclient; do \
222 cp -fpR $(PKG_INSTALL_DIR)/usr/bin/$${f} \
223 $(IDIR_FREERADIUS_UTILS)/usr/bin/ ; \
224 done
225 $(RSTRIP) $(IDIR_FREERADIUS_UTILS)
226 $(IPKG_BUILD) $(IDIR_FREERADIUS_UTILS) $(PACKAGE_DIR)
227