dev-libs/ffcall: ppc stable wrt bug #655420
[gentoo.git] / net-proxy / c-icap / c-icap-0.2.6.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 inherit eutils multilib flag-o-matic
7
8 MY_PN="${PN/-/_}"
9 MY_P="${MY_PN}-${PV}"
10
11 DESCRIPTION="C Implementation of an ICAP server"
12 HOMEPAGE="http://c-icap.sourceforge.net/"
13 SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
14
15 LICENSE="LGPL-2.1"
16 SLOT="0"
17 KEYWORDS="amd64 ~arm x86"
18 IUSE="berkdb ipv6 ldap"
19
20 RDEPEND="berkdb? ( sys-libs/db )
21         ldap? ( net-nds/openldap )
22         sys-libs/zlib"
23
24 DEPEND="${RDEPEND}"
25 RDEPEND="${RDEPEND}"
26
27 S="${WORKDIR}/${MY_P}"
28
29 src_prepare() {
30         epatch "${FILESDIR}"/c-icap-0.2.6-fix-icap-parsing.patch
31 }
32
33 src_configure() {
34         # some void *** pointers get casted around and can be troublesome to
35         # fix properly.
36         append-flags -fno-strict-aliasing
37
38         econf \
39                 --sysconfdir=/etc/${PN} \
40                 --disable-dependency-tracking \
41                 --disable-maintainer-mode \
42                 --disable-static \
43                 --enable-large-files \
44                 $(use_enable ipv6) \
45                 $(use_with berkdb bdb) \
46                 $(use_with ldap)
47 }
48
49 src_compile() {
50         emake LOGDIR="/var/log"
51 }
52
53 src_install() {
54         emake \
55                 LOGDIR="/var/log" \
56                 DESTDIR="${D}" install
57
58         find "${D}" -name '*.la' -delete || die
59
60         # Move the daemon out of the way
61         dodir /usr/libexec
62         mv "${D}"/usr/bin/c-icap "${D}"/usr/libexec || die
63
64         # Remove the default configuration files since we have etc-update to
65         # take care of it for us.
66         rm "${D}"/etc/${PN}/c-icap.*.default || die
67
68         # Fix the configuration file; for some reason it's a bit messy
69         # around.
70         sed -i \
71                 -e 's:/usr/var/:/var/:g' \
72                 -e 's:/var/log/:/var/log/c-icap/:g' \
73                 -e 's:/usr/etc/:/etc/c-icap/:g' \
74                 -e 's:/usr/local/c-icap/etc/:/etc/c-icap/:g' \
75                 -e 's:/usr/lib/:/usr/'$(get_libdir)'/:g' \
76                 "${D}"/etc/${PN}/c-icap.conf \
77                 || die
78
79         dodoc AUTHORS README TODO ChangeLog
80
81         newinitd "${FILESDIR}/${PN}.init.3" ${PN}
82         newconfd "${FILESDIR}/${PN}.conf" ${PN}
83         keepdir /var/log/c-icap
84
85         insopts -m0644
86         insinto /etc/logrotate.d
87         newins "${FILESDIR}"/${PN}.logrotate ${PN}
88
89         # avoid triggering portage's symlink protection; this is handled by
90         # the init script anyway.
91         rm -rf "${D}"/var/run
92 }
93
94 pkg_postinst() {
95         elog "To enable Squid to call the ICAP modules from a local server you should set"
96         elog "the following in your squid.conf:"
97         elog ""
98         elog "    icap_enable on"
99         elog ""
100         elog "    # not strictly needed, but some modules might make use of these"
101         elog "    icap_send_client_ip on"
102         elog "    icap_send_client_username on"
103         elog ""
104         elog "    icap_service service_req reqmod_precache bypass=1 icap://localhost:1344/service"
105         elog "    adaptation_access service_req allow all"
106         elog ""
107         elog "    icap_service service_resp respmod_precache bypass=0 icap://localhost:1344/service"
108         elog "    adaptation_access service_resp allow all"
109         elog ""
110         elog "You obviously will have to replace \"service\" with the actual ICAP service to"
111         elog "use."
112 }