summaryrefslogtreecommitdiff
blob: c68f0b584466d364a2c91bfa578514c7d825f2a5 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit cmake git-r3 tmpfiles

DESCRIPTION="Yet another caching HTTP proxy for Debian/Ubuntu software packages"
HOMEPAGE="https://www.unix-ag.uni-kl.de/~bloch/acng/
	https://packages.qa.debian.org/a/apt-cacher-ng.html"
EGIT_REPO_URI="https://salsa.debian.org/blade/apt-cacher-ng.git"
EGIT_BRANCH="upstream/sid"

LICENSE="BSD-4 ZLIB public-domain"
SLOT="0"
IUSE="doc fuse systemd tcpd"

DEPEND="acct-user/apt-cacher-ng
	acct-group/apt-cacher-ng
	app-arch/bzip2
	dev-libs/libevent:=[threads(+)]
	dev-libs/openssl:0=
	sys-libs/zlib
	fuse? ( sys-fs/fuse:0 )
	systemd? ( sys-apps/systemd )
	tcpd? ( sys-apps/tcp-wrappers )"
BDEPEND="virtual/pkgconfig"
RDEPEND="${DEPEND}
	dev-lang/perl"

PATCHES=(
	"${FILESDIR}/${PN}-3.3.1-flags.patch"
	"${FILESDIR}/${PN}-3.5-perl-syntax.patch"
)

S="${WORKDIR}/${P/_*}"

src_prepare() {
	# Fixup systemd/CMakeLists.txt cmake version requirement
	sed -ie "s/2.6/3.1/" systemd/CMakeLists.txt || die

	# Make sure we install everything the same way it used to be after
	# switching from mostly custom src_install to relying on build system
	# installation
	sed -e "/install/s/LIBDIR/CFGDIR/" \
		-e '/install.*acng\.conf/s/)$/ RENAME '"${PN}"'.conf)/' \
		-e '/file/s/)$/ "*hooks" "backends_debian")/' -i conf/CMakeLists.txt || die
	sed -ie "/INSTALL.*acngtool/s/LIBDIR/CMAKE_INSTALL_SBINDIR/" source/CMakeLists.txt || die

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		"-DHAVE_FUSE_25=$(usex fuse)"
		"-DHAVE_LIBWRAP=$(usex tcpd)"
		"-DSDINSTALL=$(usex systemd)"
	)

	cmake_src_configure

	sed -ie '/LogDir/s|/var/tmp|/var/log/'"${PN}"'|g' "${BUILD_DIR}"/conf/acng.conf || die
}

src_install() {
	# README is a symlink to doc/README and README automatically gets
	# installed, leading to a broken symlink installed. Fix this by removing
	# the symlink then installing the actual README. https://bugs.gentoo.org/770046
	rm README || die
	dodoc doc/README

	newinitd "${FILESDIR}/initd-r3" "${PN}"
	newconfd "${FILESDIR}/confd-r2" "${PN}"

	insinto /etc/logrotate.d
	newins "${FILESDIR}/logrotate" "${PN}"

	insinto /etc/cron.daily
	newins "${FILESDIR}/cron.daily" "${PN}"

	# USE=fuse installs acngfs, don't install manpage without the bin
	if use !fuse; then
		rm doc/man/acngfs.8 || die
	fi

	if use !doc; then
		rm -r doc/html || die
	fi

	dosbin scripts/expire-caller.pl

	keepdir "/var/log/${PN}"
	fowners -R ${PN}:${PN} "/var/log/${PN}"

	cmake_src_install
}

pkg_postinst() {
	tmpfiles_process "${PN}.conf"
}