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