4d199a8fd54fff3d94826f06d838bdd53227f20c
[openwrt/svn-archive/archive.git] / openwrt / package / squid / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=squid
4 PKG_VERSION:=2.5.STABLE13
5 PKG_RELEASE:=1
6 PKG_MD5SUM:=3e64468e123be1246d17486dab6bee87
7
8 PKG_SOURCE_URL:=http://www.squid-cache.org/Versions/v2/2.5/
9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
10 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
11 PKG_CAT:=bzcat
12 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
13
14 AUTH_MODULES:=basic digest ntlm
15 ifneq ($(BR2_PACKAGE_SQUID_MOD_BASIC_AUTH_GETPWNAM),)
16 BASIC_AUTH_HELPERS+= getpwnam
17 endif
18 ifneq ($(BR2_PACKAGE_SQUID_MOD_BASIC_AUTH_NCSA),)
19 BASIC_AUTH_HELPERS+= NCSA
20 endif
21 ifneq ($(BR2_PACKAGE_SQUID_MOD_BASIC_AUTH_SMB),)
22 BASIC_AUTH_HELPERS+= SMB
23 endif
24 ifneq ($(BR2_PACKAGE_SQUID_MOD_BASIC_AUTH_WINBIND),)
25 BASIC_AUTH_HELPERS+= winbind
26 endif
27
28 ifneq ($(BR2_PACKAGE_SQUID_MOD_DIGEST_AUTH_PASSWORD),)
29 DIGEST_AUTH_HELPERS:=password
30 endif
31
32 ifneq ($(BR2_PACKAGE_SQUID_MOD_EXTERNAL_ACL_IP_USER),)
33 EXTERNAL_ACL_HELPERS+= ip_user
34 endif
35 ifneq ($(BR2_PACKAGE_SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP),)
36 EXTERNAL_ACL_HELPERS+= unix_group
37 endif
38 ifneq ($(BR2_PACKAGE_SQUID_MOD_EXTERNAL_ACL_WINBIND_GROUP),)
39 EXTERNAL_ACL_HELPERS+= winbind_group
40 endif
41
42 ifneq ($(BR2_PACKAGE_SQUID_MOD_NTLM_AUTH_FAKEAUTH),)
43 NTLM_AUTH_HELPERS+= fakeauth
44 endif
45 ifneq ($(BR2_PACKAGE_SQUID_MOD_NTLM_AUTH_SMB_AUTH),)
46 NTLM_AUTH_HELPERS+= SMB
47 endif
48 ifneq ($(BR2_PACKAGE_SQUID_MOD_NTLM_AUTH_WINBIND_AUTH),)
49 NTLM_AUTH_HELPERS+= winbind
50 endif
51
52 include $(TOPDIR)/package/rules.mk
53
54 define PKG_mod_template
55
56 $$(IPKG_$(1)):
57 mkdir -p $$(IDIR_$(1))/usr/lib/
58 [ -e $(PKG_BUILD_DIR)/helpers/$(2)/$(3)/$(4) ] && $(CP) $(PKG_BUILD_DIR)/helpers/$(2)/$(3)/$(4) $$(IDIR_$(1))/usr/lib
59 $(RSTRIP) $$(IDIR_$(1))
60 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
61
62 endef
63
64
65 $(eval $(call PKG_template,SQUID,$(PKG_NAME),$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
66 $(eval $(call PKG_template,SQUID_MOD_BASIC_AUTH_GETPWNAM,$(PKG_NAME)-mod-basic-auth-getpwnam,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
67 $(eval $(call PKG_template,SQUID_MOD_BASIC_AUTH_NCSA,$(PKG_NAME)-mod-basic-auth-ncsa,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
68 $(eval $(call PKG_template,SQUID_MOD_BASIC_AUTH_SMB,$(PKG_NAME)-mod-basic-auth-smb,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
69 $(eval $(call PKG_template,SQUID_MOD_BASIC_AUTH_WINBIND,$(PKG_NAME)-mod-basic-auth-winbind,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
70 $(eval $(call PKG_template,SQUID_MOD_DIGEST_AUTH_PASSWORD,$(PKG_NAME)-mod-digest-auth-password,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
71 $(eval $(call PKG_template,SQUID_MOD_EXTERNAL_ACL_IP_USER,$(PKG_NAME)-mod-external-acl-ip-user,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
72 $(eval $(call PKG_template,SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP,$(PKG_NAME)-mod-external-acl-unix-group,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
73 $(eval $(call PKG_template,SQUID_MOD_EXTERNAL_ACL_WINBIND_GROUP,$(PKG_NAME)-mod-external-acl-winbind-group,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
74 $(eval $(call PKG_template,SQUID_MOD_NTLM_AUTH_FAKEAUTH,$(PKG_NAME)-mod-ntlm-auth-fakeauth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
75 $(eval $(call PKG_template,SQUID_MOD_NTLM_AUTH_SMB_AUTH,$(PKG_NAME)-mod-ntlm-auth-smb-auth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
76 $(eval $(call PKG_template,SQUID_MOD_NTLM_AUTH_WINBIND_AUTH,$(PKG_NAME)-mod-ntlm-auth-winbind-auth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
77
78 $(eval $(call PKG_mod_template,SQUID_MOD_BASIC_AUTH_GETPWNAM,basic_auth,getpwnam,getpwname_auth))
79 $(eval $(call PKG_mod_template,SQUID_MOD_BASIC_AUTH_LDAP,basic_auth,LDAP,ldap))
80 $(eval $(call PKG_mod_template,SQUID_MOD_BASIC_AUTH_NCSA,basic_auth,NCSA,ncsa_auth))
81 $(eval $(call PKG_mod_template,SQUID_MOD_BASIC_AUTH_SMB,basic_auth,SMB,smb_auth))
82 $(eval $(call PKG_mod_template,SQUID_MOD_BASIC_AUTH_WINBIND,basic_auth,winbind,wb_auth))
83 $(eval $(call PKG_mod_template,SQUID_MOD_DIGEST_AUTH_PASSWORD,digest_auth,password,digest_pw_auth))
84 $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_IP_USER,external_acl,ip_user,ip_user_check))
85 $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_LDAP_GROUP,external_acl,ldap_group,ldap_auth))
86 $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP,external_acl,unix_group,squid_unix_group))
87 $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_WINBIND_GROUP,external_acl,winbind_group,wb_group))
88 $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_FAKEAUTH,ntlm_auth,fakeauth,fakeauth_auth))
89 $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_SMB_AUTH,ntlm_auth,SMB,ntlm_auth))
90 $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_WINBIND_AUTH,ntlm_auth,winbind,wb_ntlmauth))
91
92 $(PKG_BUILD_DIR)/.configured:
93 (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
94 $(TARGET_CONFIGURE_OPTS) \
95 CFLAGS="$(TARGET_CFLAGS)" \
96 ac_cv_sizeof_void_p=4 \
97 ac_cv_sizeof_short=2 \
98 ac_cv_sizeof_int=4 \
99 ac_cv_sizeof_long=4 \
100 ac_cv_sizeof_long_long=8 \
101 ac_cv_sizeof___int64=0 \
102 ac_cv_sizeof_int16_t=2 \
103 ac_cv_sizeof_uint16_t=2 \
104 ac_cv_sizeof_u_int16_t=2 \
105 ac_cv_sizeof_int32_t=4 \
106 ac_cv_sizeof_uint32_t=4 \
107 ac_cv_sizeof_u_int32_t=4 \
108 ac_cv_sizeof_int64_t=8 \
109 ac_cv_sizeof_uint64_t=8 \
110 ac_cv_sizeof_u_int64_t=8 \
111 ac_cv_func_setresuid=no \
112 ac_cv_func_va_copy=no \
113 ac_cv_func___va_copy=no \
114 ./configure \
115 --target=$(GNU_TARGET_NAME) \
116 --host=$(GNU_TARGET_NAME) \
117 --build=$(GNU_HOST_NAME) \
118 --prefix=/usr \
119 --exec-prefix=/usr \
120 --bindir=/usr/bin \
121 --sbindir=/usr/sbin \
122 --libexecdir=/usr/lib \
123 --sysconfdir=/etc \
124 --datadir=/usr/share \
125 --localstatedir=/var \
126 --mandir=/usr/man \
127 --infodir=/usr/info \
128 --with-gnu-ld \
129 --enable-x-accelerator-vary \
130 --with-pthreads \
131 --with-dl \
132 --enable-icmp \
133 --enable-kill-parent-hack \
134 --enable-arp-acl \
135 --enable-ssl \
136 --enable-htcp \
137 --enable-err-languages=English \
138 --enable-default-err-language=English \
139 --enable-linux-netfilter \
140 --enable-icmp \
141 --enable-external-acl-helpers="" \
142 --enable-underscores \
143 --enable-cache-digests \
144 --enable-referer-log \
145 --enable-delay-pools \
146 --enable-useragent-log \
147 --with-openssl=$(STAGING_DIR)/usr \
148 --enable-auth="$(AUTH_MODULES)" \
149 --enable-basic-auth-helpers="$(BASIC_AUTH_HELPERS)" \
150 --enable-ntlm-auth-helpers="$(NTLM_AUTH_HELPERS)" \
151 --enable-digest-auth-helpers="$(DIGEST_AUTH_HELPERS)" \
152 --enable-external-acl-helpers="$(EXTERNAL_ACL_HELPERS)" \
153 );
154 touch $@
155
156 $(PKG_BUILD_DIR)/.built:
157 mkdir -p $(PKG_INSTALL_DIR)/usr/
158 $(MAKE) DESTDIR=$(PKG_INSTALL_DIR) \
159 STAGING_DIR=$(STAGING_DIR) \
160 -C $(PKG_BUILD_DIR) install
161 mkdir -p $(PKG_INSTALL_DIR){/etc/init.d/,/www/cgi-bin/}
162 $(RSTRIP) $(PKG_INSTALL_DIR)/usr/sbin/*
163 $(RSTRIP) $(PKG_INSTALL_DIR)/usr/lib/*
164 (cd $(PKG_INSTALL_DIR)/usr/share/errors && ls . | grep -v English | xargs rm -rf);
165 rm -r $(PKG_INSTALL_DIR){/usr/man,/etc/*.default,/usr/bin/squidclient}
166 echo "" > $(PKG_INSTALL_DIR)/etc/squid.conf
167 (cd $(PKG_INSTALL_DIR)/www/cgi-bin/ && rm -f cachemgr.cgi && ln -s ../../usr/lib/cachemgr.cgi cachemgr.cgi);
168 touch $@
169
170 $(IPKG_SQUID):
171 mkdir -p $(IDIR_SQUID)
172 $(CP) $(PKG_INSTALL_DIR)/* $(IDIR_SQUID)/
173 $(RSTRIP) $(IDIR_SQUID)/
174 $(IPKG_BUILD) $(IDIR_SQUID) $(PACKAGE_DIR)