net-proxy/squid: Stable for HPPA PPC64 (bug #580656).
[gentoo.git] / net-proxy / squid / squid-3.5.6.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit autotools eutils linux-info pam toolchain-funcs user versionator
7
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"
11
12 LICENSE="GPL-2"
13 SLOT="0"
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 \
16         ecap esi ssl-crtd \
17         mysql postgres sqlite \
18         qos tproxy \
19         +htcp +wccp +wccpv2 \
20         pf-transparent ipf-transparent kqueue \
21         elibc_uclibc kernel_linux"
22
23 COMMON_DEPEND="caps? ( >=sys-libs/libcap-2.16 )
24         pam? ( virtual/pam )
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 ) )
33         >=sys-libs/db-4:*
34         dev-lang/perl
35         dev-libs/libltdl:0"
36 DEPEND="${COMMON_DEPEND}
37         ecap? ( virtual/pkgconfig )
38         sys-apps/ed
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"
47
48 REQUIRED_USE="tproxy? ( caps )
49                         qos? ( caps )"
50
51 pkg_pretend() {
52         if use tproxy; then
53                 local CONFIG_CHECK="~NF_CONNTRACK ~NETFILTER_XT_MATCH_SOCKET ~NETFILTER_XT_TARGET_TPROXY"
54                 linux-info_pkg_setup
55         fi
56 }
57
58 pkg_setup() {
59         enewgroup squid
60         enewuser squid -1 -1 /var/cache/squid squid
61 }
62
63 src_prepare() {
64         epatch "${FILESDIR}/${PN}-3.3.4-gentoo.patch"
65         sed -i -e 's:/usr/local/squid/etc:/etc/squid:' \
66                 INSTALL QUICKSTART \
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:' \
75                 QUICKSTART || die
76         sed -i -e 's:/usr/local/squid/var/logs:/var/log/squid:' \
77                 QUICKSTART \
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
98
99         epatch_user
100
101         eautoreconf
102 }
103
104 src_configure() {
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
113                 basic_modules+=",DB"
114         fi
115
116         local digest_modules="file"
117         use ldap && digest_modules+=",LDAP,eDirectory"
118
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"
125                 else
126                         myconf="--with-mit-krb5 --without-heimdal-krb5"
127                 fi
128         fi
129
130         local ntlm_modules="none"
131         use samba && ntlm_modules="smb_lm"
132
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"
137
138         local storeio_modules="aufs,diskd,rock,ufs"
139
140         local transparent
141         if use kernel_linux ; then
142                 transparent+=" --enable-linux-netfilter"
143                 use qos && transparent+=" --enable-zph-qos --with-netfilter-conntrack"
144         fi
145
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"
152                 fi
153         fi
154
155         tc-export CC AR
156
157         econf \
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}" \
167                 --enable-disk-io \
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 \
177                 --enable-eui \
178                 --enable-icmp \
179                 --enable-follow-x-forwarded-for \
180                 --with-large-files \
181                 --disable-strict-error-checking \
182                 --disable-arch-native \
183                 $(use_with caps libcap) \
184                 $(use_enable ipv6) \
185                 $(use_enable snmp) \
186                 $(use_with ssl openssl) \
187                 $(use_with ssl nettle) \
188                 $(use_with ssl gnutls) \
189                 $(use_enable ssl-crtd) \
190                 $(use_enable ecap) \
191                 $(use_enable esi) \
192                 $(use_enable htcp) \
193                 $(use_enable wccp) \
194                 $(use_enable wccpv2) \
195                 ${transparent} \
196                 ${myconf}
197 }
198
199 src_install() {
200         emake DESTDIR="${D}" install
201
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
205         if use pam; then
206                 fowners root:squid /usr/libexec/squid/basic_pam_auth
207                 fperms 4750 /usr/libexec/squid/basic_pam_auth
208         fi
209         # pinger needs suid as well
210         fowners root:squid /usr/libexec/squid/pinger
211         fperms 4750 /usr/libexec/squid/pinger
212
213         # cleanup
214         rm -f "${D}"/usr/bin/Run*
215         rm -rf "${D}"/run/squid "${D}"/var/cache/squid
216
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
224
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
231         else
232                 exeinto /etc/cron.weekly
233                 newexe "${FILESDIR}/squid.cron" squid.cron
234         fi
235
236         diropts -m0750 -o squid -g squid
237         keepdir /var/log/squid /etc/ssl/squid /var/lib/squid
238 }
239
240 pkg_postinst() {
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"
245                 echo
246         fi
247 }