236
|
1 # Copyright 1999-2010 Gentoo Foundation
|
215
|
2 # Distributed under the terms of the GNU General Public License v2
|
236
|
3 # $Header: $
|
215
|
4
|
236
|
5 EAPI="3"
|
215
|
6
|
236
|
7 inherit base eutils pam toolchain-funcs
|
215
|
8
|
|
9 DESCRIPTION="A full-featured web proxy cache"
|
|
10 HOMEPAGE="http://www.squid-cache.org/"
|
|
11 SRC_URI="http://www.squid-cache.org/Versions/v3/3.1/${P}.tar.gz"
|
|
12
|
|
13 LICENSE="GPL-2"
|
|
14 SLOT="0"
|
|
15 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
|
|
16 IUSE="caps ipv6 pam ldap samba sasl kerberos nis radius ssl snmp selinux logrotate test \
|
|
17 ecap icap-client \
|
|
18 mysql postgres sqlite \
|
|
19 zero-penalty-hit \
|
|
20 pf-transparent ipf-transparent kqueue \
|
|
21 elibc_uclibc kernel_linux +epoll"
|
236
|
22
|
215
|
23 RESTRICT=test
|
|
24
|
|
25 COMMON_DEPEND="caps? ( >=sys-libs/libcap-2.16 )
|
|
26 pam? ( virtual/pam )
|
|
27 ldap? ( net-nds/openldap )
|
|
28 kerberos? ( || ( app-crypt/mit-krb5 app-crypt/heimdal ) )
|
|
29 ssl? ( dev-libs/openssl )
|
|
30 sasl? ( dev-libs/cyrus-sasl )
|
|
31 ecap? ( net-libs/libecap )
|
|
32 selinux? ( sec-policy/selinux-squid )
|
|
33 !x86-fbsd? ( logrotate? ( app-admin/logrotate ) )
|
|
34 >=sys-libs/db-4
|
|
35 dev-lang/perl"
|
236
|
36
|
215
|
37 DEPEND="${COMMON_DEPEND}
|
|
38 sys-devel/automake
|
|
39 sys-devel/autoconf
|
|
40 sys-devel/libtool
|
|
41 test? ( dev-util/cppunit )"
|
236
|
42
|
215
|
43 RDEPEND="${COMMON_DEPEND}
|
|
44 samba? ( net-fs/samba )
|
|
45 mysql? ( dev-perl/DBD-mysql )
|
|
46 postgres? ( dev-perl/DBD-Pg )
|
|
47 sqlite? ( dev-perl/DBD-SQLite )"
|
|
48
|
236
|
49 PATCHES=(
|
|
50 "${FILESDIR}/${P}-gentoo.patch"
|
|
51 "${FILESDIR}/${P}-qafixes.patch"
|
|
52 "${FILESDIR}/${P}-libmd5.patch"
|
|
53 "${FILESDIR}/${P}-errorstate-leak-fix.patch"
|
|
54 "${FILESDIR}/${P}-range-leak-fix-1.patch"
|
|
55 "${FILESDIR}/${P}-range-leak-fix-2.patch"
|
|
56 )
|
215
|
57
|
236
|
58 pkg_pretend() {
|
215
|
59 if grep -qs '^[[:space:]]*cache_dir[[:space:]]\+coss' "${ROOT}"etc/squid/squid.conf; then
|
|
60 eerror "coss store IO has been disabled by upstream due to stability issues!"
|
|
61 eerror "If you want to install this version, switch the store type to something else"
|
|
62 eerror "before attempting to install this version again."
|
|
63
|
|
64 die "/etc/squid/squid.conf: cache_dir use a disabled store type"
|
|
65 fi
|
236
|
66 }
|
|
67
|
|
68 pkg_setup() {
|
|
69 [ ${EAPI} -lt 4 ] && pkg_pretend
|
215
|
70
|
|
71 enewgroup squid 31
|
|
72 enewuser squid 31 -1 /var/cache/squid squid
|
|
73 }
|
|
74
|
|
75 src_prepare() {
|
236
|
76 base_src_prepare
|
215
|
77
|
|
78 # eautoreconf breaks lib/libLtdl/libtool script
|
|
79 ./bootstrap.sh || die "autoreconf failed"
|
|
80 }
|
|
81
|
|
82 src_configure() {
|
|
83 local myconf=""
|
|
84
|
|
85 local basic_modules="getpwnam,NCSA,MSNT"
|
|
86 use samba && basic_modules="SMB,multi-domain-NTLM,${basic_modules}"
|
|
87 use ldap && basic_modules="LDAP,${basic_modules}"
|
|
88 use pam && basic_modules="PAM,${basic_modules}"
|
|
89 use sasl && basic_modules="SASL,${basic_modules}"
|
|
90 use nis && ! use elibc_uclibc && basic_modules="YP,${basic_modules}"
|
|
91 use radius && basic_modules="squid_radius_auth,${basic_modules}"
|
236
|
92
|
215
|
93 if use mysql || use postgres || use sqlite ; then
|
|
94 basic_modules="DB,${basic_modules}"
|
|
95 fi
|
|
96
|
|
97 local digest_modules="password"
|
|
98 use ldap && digest_modules="ldap,${digest_modules}"
|
|
99
|
|
100 local ext_helpers="ip_user,session,unix_group"
|
|
101 use samba && ext_helpers="wbinfo_group,${ext_helpers}"
|
|
102 use ldap && ext_helpers="ldap_group,${ext_helpers}"
|
|
103
|
|
104 local ntlm_helpers="fakeauth"
|
|
105 use samba && ntlm_helpers="smb_lm,${ntlm_helpers}"
|
|
106
|
|
107 local negotiate_helpers=
|
|
108 if use kerberos; then
|
|
109 negotiate_helpers="squid_kerb_auth"
|
|
110 has_version app-crypt/mit-krb5 \
|
|
111 && myconf="--enable-mit --disable-heimdal" \
|
|
112 || myconf="--disable-mit --enable-heimdal"
|
|
113 fi
|
|
114
|
|
115 # coss support has been disabled
|
|
116 # If it is re-enabled again, make sure you don't enable it for elibc_uclibc (#61175)
|
|
117 myconf="${myconf} --enable-storeio=ufs,diskd,aufs"
|
|
118
|
|
119 if use kernel_linux; then
|
|
120 myconf="${myconf} --enable-linux-netfilter
|
|
121 $(use_enable epoll)"
|
|
122 elif use kernel_FreeBSD || use kernel_OpenBSD || use kernel_NetBSD ; then
|
|
123 myconf="${myconf} $(use_enable kqueue)"
|
|
124 if use pf-transparent; then
|
|
125 myconf="${myconf} --enable-pf-transparent"
|
|
126 elif use ipf-transparent; then
|
|
127 myconf="${myconf} --enable-ipf-transparent"
|
|
128 fi
|
|
129 fi
|
|
130
|
|
131 export CC=$(tc-getCC)
|
|
132
|
|
133 econf \
|
|
134 --sysconfdir=/etc/squid \
|
|
135 --libexecdir=/usr/libexec/squid \
|
|
136 --localstatedir=/var \
|
|
137 --with-pidfile=/var/run/squid.pid \
|
|
138 --datadir=/usr/share/squid \
|
|
139 --with-logdir=/var/log/squid \
|
|
140 --with-default-user=squid \
|
|
141 --enable-auth="basic,digest,negotiate,ntlm" \
|
|
142 --enable-removal-policies="lru,heap" \
|
|
143 --enable-digest-auth-helpers="${digest_modules}" \
|
|
144 --enable-basic-auth-helpers="${basic_modules}" \
|
|
145 --enable-external-acl-helpers="${ext_helpers}" \
|
|
146 --enable-ntlm-auth-helpers="${ntlm_helpers}" \
|
|
147 --enable-negotiate-auth-helpers="${negotiate_helpers}" \
|
|
148 --enable-useragent-log \
|
|
149 --enable-cache-digests \
|
|
150 --enable-delay-pools \
|
|
151 --enable-referer-log \
|
|
152 --enable-arp-acl \
|
|
153 --with-large-files \
|
|
154 --with-filedescriptors=8192 \
|
|
155 --disable-strict-error-checking \
|
|
156 $(use_enable caps) \
|
|
157 $(use_enable ipv6) \
|
|
158 $(use_enable snmp) \
|
|
159 $(use_enable ssl) \
|
|
160 $(use_enable icap-client) \
|
|
161 $(use_enable ecap) \
|
|
162 $(use_enable zero-penalty-hit zph-qos) \
|
|
163 ${myconf} || die "econf failed"
|
|
164 }
|
|
165
|
|
166 src_install() {
|
236
|
167 base_src_install
|
215
|
168
|
|
169 # need suid root for looking into /etc/shadow
|
|
170 fowners root:squid /usr/libexec/squid/ncsa_auth
|
|
171 fowners root:squid /usr/libexec/squid/pam_auth
|
|
172 fperms 4750 /usr/libexec/squid/ncsa_auth
|
|
173 fperms 4750 /usr/libexec/squid/pam_auth
|
|
174
|
|
175 # some cleanups
|
|
176 rm -f "${D}"/usr/bin/Run*
|
|
177
|
|
178 dodoc CONTRIBUTORS CREDITS ChangeLog QUICKSTART SPONSORS doc/*.txt \
|
|
179 helpers/ntlm_auth/no_check/README.no_check_ntlm_auth
|
|
180 newdoc helpers/basic_auth/SMB/README README.auth_smb
|
|
181 dohtml helpers/basic_auth/MSNT/README.html RELEASENOTES.html
|
|
182 newdoc helpers/basic_auth/LDAP/README README.auth_ldap
|
|
183 doman helpers/basic_auth/LDAP/*.8
|
|
184 dodoc helpers/basic_auth/SASL/squid_sasl_auth*
|
|
185
|
|
186 newpamd "${FILESDIR}/squid.pam" squid
|
|
187 newconfd "${FILESDIR}/squid.confd" squid
|
236
|
188
|
215
|
189 if use logrotate; then
|
|
190 newinitd "${FILESDIR}/squid.initd-logrotate" squid
|
|
191 insinto /etc/logrotate.d
|
|
192 newins "${FILESDIR}/squid.logrotate" squid
|
|
193 else
|
|
194 newinitd "${FILESDIR}/squid.initd" squid
|
|
195 exeinto /etc/cron.weekly
|
|
196 newexe "${FILESDIR}/squid.cron" squid.cron
|
|
197 fi
|
|
198
|
|
199 rm -rf "${D}"/var
|
|
200 diropts -m0755 -o squid -g squid
|
|
201 keepdir /var/cache/squid /var/log/squid
|
|
202 }
|
|
203
|
|
204 pkg_postinst() {
|
|
205 ewarn "Squid authentication helpers have been installed suid root."
|
236
|
206 ewarn "This allows for shadow based authentication (see bug #52977 for more)."
|
|
207 ewarn
|
215
|
208 ewarn "Be careful what type of cache_dir you select!"
|
236
|
209 ewarn "'diskd' is optimized for high levels of traffic, but it might seem slow"
|
|
210 ewarn "where there isn't sufficient traffic to keep squid reasonably busy."
|
|
211 ewarn "If your traffic level is low to moderate, use 'aufs' or 'ufs'."
|
|
212 ewarn
|
215
|
213 ewarn "Squid can be configured to run in transparent mode like this:"
|
|
214 ewarn " ${HILITE}http_port internal-addr:3128 transparent${NORMAL}"
|
236
|
215
|
215
|
216 if use zero-penalty-hit; then
|
|
217 echo
|
|
218 ewarn "In order for zph_preserve_miss_tos to work, you will have to alter your kernel"
|
|
219 ewarn "with the patch that can be found on http://zph.bratcheda.org site."
|
|
220 fi
|
|
221 }
|