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

EAPI=6

inherit autotools flag-o-matic systemd

DESCRIPTION="Precision Time Protocol daemon"
HOMEPAGE="https://github.com/ptpd/ptpd"
SRC_URI="https://github.com/ptpd/ptpd/archive/${P}.tar.gz"

KEYWORDS="~amd64 ~arm ~x86"
LICENSE="BSD"
SLOT="0"
IUSE="debug experimental ntp +pcap snmp slave-only +statistics"

RDEPEND="
	pcap? ( net-libs/libpcap )
	snmp? ( net-analyzer/net-snmp )"
DEPEND="${RDEPEND}"
RDEPEND="${RDEPEND}
	ntp? ( net-misc/ntp )"

PATCHES=(
	"${FILESDIR}"/${PN}-2.3.1-fix-snmp.patch
	"${FILESDIR}"/${PN}-2.3.1-fix-libressl-compatibility.patch
)

S=${WORKDIR}/ptpd-${P}

src_prepare() {
	default

	eautoreconf
}

src_configure() {
	append-flags -fno-strict-aliasing
	local myconf=(
		--enable-daemon
		$(use_enable snmp)
		$(use_enable experimental experimental-options)
		$(use_enable statistics)
		$(use_enable debug runtime-debug)
		$(use_enable pcap)
		$(use_enable slave-only)
	)
	econf "${myconf[@]}"
}

src_install() {
	emake install DESTDIR="${D}"

	insinto /etc
	newins "src/ptpd2.conf.minimal" ptpd2.conf

	newinitd "${FILESDIR}/ptpd2.rc" ptpd2
	newconfd "${FILESDIR}/ptpd2.confd" ptpd2

	systemd_dounit "${FILESDIR}/ptpd2.service"
}

pkg_postinst() {
	elog "Do not forget to setup correct network interface."
	elog "Change the config file ${EROOT}etc/ptpd2.conf to suit your needs."
}