summaryrefslogtreecommitdiff
blob: 41b226834a96c5c91f45db380591cbbbaf5887d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/sarg/sarg-2.2.5-r3.ebuild,v 1.1 2009/04/06 07:02:44 pva Exp $

EAPI="2"

inherit eutils autotools

DESCRIPTION="Squid Analysis Report Generator"
HOMEPAGE="http://sarg.sourceforge.net/sarg.php"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
		mirror://gentoo/${P}-patchset-3.tar.bz2"

LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc ~x86"
SLOT="0"
IUSE=""

DEPEND="media-libs/gd[png,truetype]"
RDEPEND="${DEPEND}"

src_prepare() {
	EPATCH_SOURCE="${WORKDIR}/patches/" EPATCH_SUFFIX="patch" epatch

	einfo "Running sed to substitute paths..."
	sed \
		-e 's:/usr/local/squid/var/logs/access.log:/var/log/squid/access.log:' \
		-e 's:/usr/local/\(squidGuard/squidGuard.conf\):/etc/\1:' \
		-e 's:/var/www/html/squid-reports:/var/www/localhost/htdocs/squid-reports:' \
		-i sarg.conf || die

	sed \
		-e 's:"/usr/local/squid/var/logs/access.log":"/var/log/squid/access.log":' \
		-e 's:"/var/www/html/squid-reports":"/var/www/localhost/htdocs/squid-reports":' \
		-e 's:"/usr/local/sarg/passwd":"/etc/sarg/passwd":' \
			-i log.c || die #43132

	sed	-e 's:/usr/local/sarg/passwd:/etc/sarg/passwd:' \
		-i htaccess || die

	sed -e 's:/usr/local/squid/logs/access.log:/var/log/squid/access.log:' \
		-i splitlog.c convlog.c || die

	sed -e 's:/usr/local/\(sarg/sarg.conf\):/etc/\1:' \
		-e 's:/usr/local/squid/etc/passwd:/etc/squid/passwd:' \
		-i user_limit_block || die

	sed -e 's:/usr/local/squid/etc/block.txt:/etc/squid/etc/block.txt:' \
		-i sarg-php/sarg-block-it.php || die

	sed -e 's:/usr/local/\(sarg/sarg.conf\):/etc/\1:' \
		-e 's:/usr/local/\(squidGuard/squidGuard.conf\):/etc/\1:' \
		-e 's:/usr/local/squid/logs/access.log:/var/log/squid/access.log:' \
			-i sarg.1 sarg-php/sarg-squidguard-block.php || die

	sed -i -e 's:sarg_tmp:sarg:' email.c || die #64743
	eautoreconf
}

src_configure() {
	econf \
		--enable-bindir=/usr/bin \
		--enable-mandir=/usr/share/man/man1 \
		--enable-sysconfdir=/etc/sarg/
}

src_install() {
	# This is workaround for sarg installation script, which does not create dirs
	dodir /etc/sarg /usr/sbin

	make \
		BINDIR="${D}"/usr/sbin \
		MANDIR="${D}"/usr/share/man/man1 \
		SYSCONFDIR="${D}"/etc/sarg \
		HTMLDIR="${D}"/var/www/html \
		install || die "sarg installation failed"

	dodoc BETA-TESTERS CONTRIBUTORS DONATIONS README ChangeLog htaccess
}