summaryrefslogtreecommitdiff
blob: 2119720aa305453626bf1c6541d0adb90195a272 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3
inherit cmake-utils eutils

DESCRIPTION="Yet another implementation of a HTTP proxy for Debian/Ubuntu software packages written in C++"
HOMEPAGE="http://www.unix-ag.uni-kl.de/~bloch/acng/"
SRC_URI="mirror://debian/pool/main/a/${PN}/${PN}_${PV}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~x86"
IUSE="doc examples fuse lzma"

DEPEND="app-arch/bzip2
	sys-libs/zlib
	lzma? (
		|| ( app-arch/xz-utils
			app-arch/lzma-utils )
	)"
RDEPEND="${DEPEND}
	dev-lang/perl
	fuse? ( sys-fs/fuse )"

pkg_setup() {
	# Add a new user & group for the daemon.
	enewgroup ${PN}
	enewuser ${PN} -1 -1 -1 ${PN}
}

src_configure() {
	mycmakeargs=(
		# avoid forcing in LDFLAGS
		-DHAVE_WL_AS_NEEDED=OFF
		# assert for possible boost automagic
		-DHAVE_BOOST_SMARTPTR=OFF

		$(cmake-utils_use_has lzma LZMA)
		$(cmake-utils_use_has fuse FUSE_26)
	)

	cmake-utils_src_configure
}

src_install() {
	dosbin "${CMAKE_BUILD_DIR}"/${PN} || die
	doman doc/man/${PN}.8 || die
	if use fuse; then
		dobin "${CMAKE_BUILD_DIR}"/acngfs || die
		doman doc/man/acngfs.8 || die
	fi

	newinitd "${FILESDIR}"/initd ${PN} || die
	newconfd "${FILESDIR}"/confd ${PN} || die

	# for logrotate
	insinto /etc/logrotate.d
	newins "${FILESDIR}"/logrotate ${PN} || die

	# Documentation
	dodoc ChangeLog doc/README TODO || die
	if use doc; then
		dodoc doc/*.pdf || die
		dohtml doc/html/* || die
	fi

	if use examples; then
		docinto example
		dodoc conf/* || die
	fi

	# perl daily cron script
	dosbin expire-caller.pl || die
	exeinto /etc/cron.daily
	newexe "${FILESDIR}"/cron.daily ${PN} || die

	# default configuration
	insinto /etc/${PN}
	newins conf/acng.conf ${PN}.conf || die
	newins conf/report.html acng-report.html || die

	# Some directories must exist
	keepdir /var/log/${PN}
	keepdir /var/run/${PN}

	fowners ${PN}:${PN} \
		/etc/${PN} \
		/etc/${PN}/${PN}.conf \
		/etc/${PN}/acng-report.html \
		/var/log/${PN} \
		/var/run/${PN} || die
}

pkg_postinst() {
	elog "Do not forget about edit configuration file and read manuals!"
	elog "   Default file : /etc/${PN}/${PN}.conf"
	elog "   Manual page  : man 8 apt-cache-ng"
	elog "   Documentation: /usr/share/doc/${PF}"
	if use fuse; then
		elog "You have choose to build fuse httpfs named 'acngfs'."
		elog "It's can be used to mount apt cache on server to client"
		elog "filesystem."
		elog "   Manual page  : man 8 acngfs"
	fi
	elog "Please note: this ebuild installs /etc/cron.daily/${PN} cron job."
}