1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools eutils linux-info pam toolchain-funcs user versionator
8 DESCRIPTION="A full-featured web proxy cache"
9 HOMEPAGE="http://www.squid-cache.org/"
10 SRC_URI="http://www.squid-cache.org/Versions/v3/3.5/${P}.tar.xz"
14 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
15 IUSE="caps ipv6 pam ldap samba sasl kerberos nis radius ssl snmp selinux logrotate test \
17 mysql postgres sqlite \
20 pf-transparent ipf-transparent kqueue \
21 elibc_uclibc kernel_linux"
23 COMMON_DEPEND="caps? ( >=sys-libs/libcap-2.16 )
25 ldap? ( net-nds/openldap )
26 kerberos? ( virtual/krb5 )
27 qos? ( net-libs/libnetfilter_conntrack )
28 ssl? ( dev-libs/openssl:* dev-libs/nettle >=net-libs/gnutls-3.1.5 )
29 sasl? ( dev-libs/cyrus-sasl )
30 ecap? ( net-libs/libecap:1 )
31 esi? ( dev-libs/expat dev-libs/libxml2 )
32 !x86-fbsd? ( logrotate? ( app-admin/logrotate ) )
36 DEPEND="${COMMON_DEPEND}
37 ecap? ( virtual/pkgconfig )
39 test? ( dev-util/cppunit )"
40 RDEPEND="${COMMON_DEPEND}
41 samba? ( net-fs/samba )
42 mysql? ( dev-perl/DBD-mysql )
43 postgres? ( dev-perl/DBD-Pg )
44 selinux? ( sec-policy/selinux-squid )
45 sqlite? ( dev-perl/DBD-SQLite )
46 !<=sci-biology/meme-4.8.1-r1"
48 REQUIRED_USE="tproxy? ( caps )
53 local CONFIG_CHECK="~NF_CONNTRACK ~NETFILTER_XT_MATCH_SOCKET ~NETFILTER_XT_TARGET_TPROXY"
60 enewuser squid -1 -1 /var/cache/squid squid
64 epatch "${FILESDIR}/${PN}-3.3.4-gentoo.patch"
65 sed -i -e 's:/usr/local/squid/etc:/etc/squid:' \
67 scripts/fileno-to-pathname.pl \
68 scripts/check_cache.pl \
69 tools/cachemgr.cgi.8 \
70 tools/purge/conffile.hh \
71 tools/purge/README || die
72 sed -i -e 's:/usr/local/squid/sbin:/usr/sbin:' \
73 INSTALL QUICKSTART || die
74 sed -i -e 's:/usr/local/squid/var/cache:/var/cache/squid:' \
76 sed -i -e 's:/usr/local/squid/var/logs:/var/log/squid:' \
78 src/log/access_log.cc || die
79 sed -i -e 's:/usr/local/squid/logs:/var/log/squid:' \
80 src/log/access_log.cc || die
81 sed -i -e 's:/usr/local/squid/libexec:/usr/libexec/squid:' \
82 helpers/external_acl/unix_group/ext_unix_group_acl.8 \
83 helpers/external_acl/session/ext_session_acl.8 \
84 src/ssl/ssl_crtd.8 || die
85 sed -i -e 's:/usr/local/squid/cache:/var/cache/squid:' \
86 scripts/check_cache.pl || die
87 sed -i -e 's:/usr/local/squid/ssl_cert:/etc/ssl/squid:' \
88 src/ssl/ssl_crtd.8 || die
89 sed -i -e 's:/usr/local/squid/var/lib/ssl_db:/var/lib/squid/ssl_db:' \
90 src/ssl/ssl_crtd.8 || die
91 sed -i -e 's:/var/lib/ssl_db:/var/lib/squid/ssl_db:' \
92 src/ssl/ssl_crtd.8 || die
93 # /var/run/squid to /run/squid
94 sed -i -e 's:$(localstatedir)::' \
95 src/ipc/Makefile.am || die
96 sed -i -e 's:_LTDL_SETUP:LTDL_INIT([installable]):' \
97 libltdl/configure.ac || die
105 local basic_modules="MSNT-multi-domain,NCSA,POP3,getpwnam"
106 use samba && basic_modules+=",SMB"
107 use ldap && basic_modules+=",LDAP"
108 use pam && basic_modules+=",PAM"
109 use sasl && basic_modules+=",SASL"
110 use nis && ! use elibc_uclibc && basic_modules+=",NIS"
111 use radius && basic_modules+=",RADIUS"
112 if use mysql || use postgres || use sqlite ; then
116 local digest_modules="file"
117 use ldap && digest_modules+=",LDAP,eDirectory"
119 local negotiate_modules="none"
120 local myconf="--without-mit-krb5 --without-heimdal-krb5"
121 if use kerberos ; then
122 negotiate_modules="kerberos,wrapper"
123 if has_version app-crypt/heimdal ; then
124 myconf="--without-mit-krb5 --with-heimdal-krb5"
126 myconf="--with-mit-krb5 --without-heimdal-krb5"
130 local ntlm_modules="none"
131 use samba && ntlm_modules="smb_lm"
133 local ext_helpers="file_userip,session,unix_group"
134 use samba && ext_helpers+=",wbinfo_group"
135 use ldap && ext_helpers+=",LDAP_group,eDirectory_userip"
136 use ldap && use kerberos && ext_helpers+=",kerberos_ldap_group"
138 local storeio_modules="aufs,diskd,rock,ufs"
141 if use kernel_linux ; then
142 transparent+=" --enable-linux-netfilter"
143 use qos && transparent+=" --enable-zph-qos --with-netfilter-conntrack"
146 if use kernel_FreeBSD || use kernel_OpenBSD || use kernel_NetBSD ; then
147 transparent+=" $(use_enable kqueue)"
148 if use pf-transparent; then
149 transparent+=" --enable-pf-transparent"
150 elif use ipf-transparent; then
151 transparent+=" --enable-ipf-transparent"
158 --sysconfdir=/etc/squid \
159 --libexecdir=/usr/libexec/squid \
160 --localstatedir=/var \
161 --with-pidfile=/run/squid.pid \
162 --datadir=/usr/share/squid \
163 --with-logdir=/var/log/squid \
164 --with-default-user=squid \
165 --enable-removal-policies="lru,heap" \
166 --enable-storeio="${storeio_modules}" \
168 --enable-auth-basic="${basic_modules}" \
169 --enable-auth-digest="${digest_modules}" \
170 --enable-auth-ntlm="${ntlm_modules}" \
171 --enable-auth-negotiate="${negotiate_modules}" \
172 --enable-external-acl-helpers="${ext_helpers}" \
173 --enable-log-daemon-helpers \
174 --enable-url-rewrite-helpers \
175 --enable-cache-digests \
176 --enable-delay-pools \
179 --enable-follow-x-forwarded-for \
181 --disable-strict-error-checking \
182 --disable-arch-native \
183 $(use_with caps libcap) \
186 $(use_with ssl openssl) \
187 $(use_with ssl nettle) \
188 $(use_with ssl gnutls) \
189 $(use_enable ssl-crtd) \
194 $(use_enable wccpv2) \
200 emake DESTDIR="${D}" install
202 # need suid root for looking into /etc/shadow
203 fowners root:squid /usr/libexec/squid/basic_ncsa_auth
204 fperms 4750 /usr/libexec/squid/basic_ncsa_auth
206 fowners root:squid /usr/libexec/squid/basic_pam_auth
207 fperms 4750 /usr/libexec/squid/basic_pam_auth
209 # pinger needs suid as well
210 fowners root:squid /usr/libexec/squid/pinger
211 fperms 4750 /usr/libexec/squid/pinger
214 rm -f "${D}"/usr/bin/Run*
215 rm -rf "${D}"/run/squid "${D}"/var/cache/squid
217 dodoc CONTRIBUTORS CREDITS ChangeLog INSTALL QUICKSTART README SPONSORS doc/*.txt
218 newdoc helpers/negotiate_auth/kerberos/README README.kerberos
219 newdoc helpers/basic_auth/RADIUS/README README.RADIUS
220 newdoc helpers/external_acl/kerberos_ldap_group/README README.kerberos_ldap_group
221 newdoc tools/purge/README README.purge
222 newdoc tools/helper-mux.README README.helper-mux
223 dohtml RELEASENOTES.html
225 newpamd "${FILESDIR}/squid.pam" squid
226 newconfd "${FILESDIR}/squid.confd-r1" squid
227 newinitd "${FILESDIR}/squid.initd-r4" squid
228 if use logrotate; then
229 insinto /etc/logrotate.d
230 newins "${FILESDIR}/squid.logrotate" squid
232 exeinto /etc/cron.weekly
233 newexe "${FILESDIR}/squid.cron" squid.cron
236 diropts -m0750 -o squid -g squid
237 keepdir /var/log/squid /etc/ssl/squid /var/lib/squid
241 if [[ $(get_version_component_range 1 ${REPLACING_VERSIONS}) -lt 3 ]] || \
242 [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 5 ]]; then
243 elog "Please read the release notes at:"
244 elog " http://www.squid-cache.org/Versions/v3/3.5/RELEASENOTES.html"