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