| 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.18.ebuild,v 1.1 2011/12/24 10:33:20 patrick 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 |
"${FILESDIR}"/${PN}-3.1.18-ecap.patch
|
| 71 |
eautoreconf
|
| 72 |
}
|
| 73 |
|
| 74 |
src_configure() {
|
| 75 |
local myconf=""
|
| 76 |
|
| 77 |
local basic_modules="getpwnam,NCSA,MSNT"
|
| 78 |
use samba && basic_modules="SMB,multi-domain-NTLM,${basic_modules}"
|
| 79 |
use ldap && basic_modules="LDAP,${basic_modules}"
|
| 80 |
use pam && basic_modules="PAM,${basic_modules}"
|
| 81 |
use sasl && basic_modules="SASL,${basic_modules}"
|
| 82 |
use nis && ! use elibc_uclibc && basic_modules="YP,${basic_modules}"
|
| 83 |
use radius && basic_modules="squid_radius_auth,${basic_modules}"
|
| 84 |
if use mysql || use postgres || use sqlite ; then
|
| 85 |
basic_modules="DB,${basic_modules}"
|
| 86 |
fi
|
| 87 |
|
| 88 |
local digest_modules="password"
|
| 89 |
use ldap && digest_modules="ldap,${digest_modules}"
|
| 90 |
|
| 91 |
local ext_helpers="ip_user,session,unix_group"
|
| 92 |
use samba && ext_helpers="wbinfo_group,${ext_helpers}"
|
| 93 |
use ldap && ext_helpers="ldap_group,${ext_helpers}"
|
| 94 |
|
| 95 |
local ntlm_helpers="fakeauth"
|
| 96 |
use samba && ntlm_helpers="smb_lm,${ntlm_helpers}"
|
| 97 |
|
| 98 |
local negotiate_helpers=
|
| 99 |
if use kerberos; then
|
| 100 |
negotiate_helpers="squid_kerb_auth"
|
| 101 |
if has_version app-crypt/mit-krb5; then
|
| 102 |
myconf="--enable-mit --disable-heimdal"
|
| 103 |
elif has_version app-crypt/heimdal; then
|
| 104 |
myconf="--disable-mit --enable-heimdal"
|
| 105 |
fi
|
| 106 |
else
|
| 107 |
myconf="--disable-mit --disable-heimdal"
|
| 108 |
fi
|
| 109 |
|
| 110 |
# coss support has been disabled
|
| 111 |
# If it is re-enabled again, make sure you don't enable it for elibc_uclibc (#61175)
|
| 112 |
myconf="${myconf} --enable-storeio=ufs,diskd,aufs"
|
| 113 |
|
| 114 |
if use kernel_linux; then
|
| 115 |
myconf="${myconf} --enable-linux-netfilter \
|
| 116 |
$(use_enable tproxy linux-tproxy) \
|
| 117 |
$(use_enable epoll)"
|
| 118 |
elif use kernel_FreeBSD || use kernel_OpenBSD || use kernel_NetBSD ; then
|
| 119 |
myconf="${myconf} $(use_enable kqueue)"
|
| 120 |
if use pf-transparent; then
|
| 121 |
myconf="${myconf} --enable-pf-transparent"
|
| 122 |
elif use ipf-transparent; then
|
| 123 |
myconf="${myconf} --enable-ipf-transparent"
|
| 124 |
fi
|
| 125 |
fi
|
| 126 |
|
| 127 |
export CC=$(tc-getCC)
|
| 128 |
|
| 129 |
econf \
|
| 130 |
--sysconfdir=/etc/squid \
|
| 131 |
--libexecdir=/usr/libexec/squid \
|
| 132 |
--localstatedir=/var \
|
| 133 |
--with-pidfile=/var/run/squid.pid \
|
| 134 |
--datadir=/usr/share/squid \
|
| 135 |
--with-logdir=/var/log/squid \
|
| 136 |
--with-default-user=squid \
|
| 137 |
--enable-auth="basic,digest,negotiate,ntlm" \
|
| 138 |
--enable-removal-policies="lru,heap" \
|
| 139 |
--enable-digest-auth-helpers="${digest_modules}" \
|
| 140 |
--enable-basic-auth-helpers="${basic_modules}" \
|
| 141 |
--enable-external-acl-helpers="${ext_helpers}" \
|
| 142 |
--enable-ntlm-auth-helpers="${ntlm_helpers}" \
|
| 143 |
--enable-negotiate-auth-helpers="${negotiate_helpers}" \
|
| 144 |
--enable-useragent-log \
|
| 145 |
--enable-cache-digests \
|
| 146 |
--enable-delay-pools \
|
| 147 |
--enable-referer-log \
|
| 148 |
--enable-arp-acl \
|
| 149 |
--with-large-files \
|
| 150 |
--with-filedescriptors=8192 \
|
| 151 |
--disable-strict-error-checking \
|
| 152 |
$(use_with caps libcap) \
|
| 153 |
$(use_enable ipv6) \
|
| 154 |
$(use_enable snmp) \
|
| 155 |
$(use_enable ssl) \
|
| 156 |
$(use_enable icap-client) \
|
| 157 |
$(use_enable ecap) \
|
| 158 |
$(use_enable zero-penalty-hit zph-qos) \
|
| 159 |
${myconf}
|
| 160 |
}
|
| 161 |
|
| 162 |
src_install() {
|
| 163 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 164 |
|
| 165 |
# need suid root for looking into /etc/shadow
|
| 166 |
fowners root:squid /usr/libexec/squid/ncsa_auth
|
| 167 |
fperms 4750 /usr/libexec/squid/ncsa_auth
|
| 168 |
if use pam; then
|
| 169 |
fowners root:squid /usr/libexec/squid/pam_auth
|
| 170 |
fperms 4750 /usr/libexec/squid/pam_auth
|
| 171 |
fi
|
| 172 |
|
| 173 |
# some cleanups
|
| 174 |
rm -f "${D}"/usr/bin/Run*
|
| 175 |
|
| 176 |
dodoc CONTRIBUTORS CREDITS ChangeLog QUICKSTART SPONSORS doc/*.txt \
|
| 177 |
helpers/ntlm_auth/no_check/README.no_check_ntlm_auth
|
| 178 |
newdoc helpers/basic_auth/SMB/README README.auth_smb
|
| 179 |
dohtml helpers/basic_auth/MSNT/README.html RELEASENOTES.html
|
| 180 |
newdoc helpers/basic_auth/LDAP/README README.auth_ldap
|
| 181 |
doman helpers/basic_auth/LDAP/*.8
|
| 182 |
dodoc helpers/basic_auth/SASL/squid_sasl_auth*
|
| 183 |
|
| 184 |
newpamd "${FILESDIR}/squid.pam" squid
|
| 185 |
newconfd "${FILESDIR}/squid.confd" squid
|
| 186 |
if use logrotate; then
|
| 187 |
newinitd "${FILESDIR}/squid.initd-logrotate" squid
|
| 188 |
insinto /etc/logrotate.d
|
| 189 |
newins "${FILESDIR}/squid.logrotate" squid
|
| 190 |
else
|
| 191 |
newinitd "${FILESDIR}/squid.initd" squid
|
| 192 |
exeinto /etc/cron.weekly
|
| 193 |
newexe "${FILESDIR}/squid.cron" squid.cron
|
| 194 |
fi
|
| 195 |
|
| 196 |
rm -rf "${D}"/var
|
| 197 |
diropts -m0755 -o squid -g squid
|
| 198 |
keepdir /var/cache/squid /var/log/squid
|
| 199 |
}
|
| 200 |
|
| 201 |
pkg_postinst() {
|
| 202 |
echo
|
| 203 |
elog "Squid authentication helpers have been installed suid root."
|
| 204 |
elog "This allows shadow based authentication (see bug #52977 for more)."
|
| 205 |
echo
|
| 206 |
elog "Be careful what type of cache_dir you select!"
|
| 207 |
elog " 'diskd' is optimized for high levels of traffic, but it might seem slow"
|
| 208 |
elog "when there isn't sufficient traffic to keep squid reasonably busy."
|
| 209 |
elog " If your traffic level is low to moderate, use 'aufs' or 'ufs'."
|
| 210 |
}
|