aboutsummaryrefslogtreecommitdiff
path: root/net/chrony/Makefile
blob: 4949f324d8a6edf1262653944fd565b70dcf80a1 (plain) (blame)
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
109
# Created by: Masaki TAGAWA <masaki@club.kyutech.ac.jp>

PORTNAME=	chrony
DISTVERSION=	4.2
CATEGORIES=	net
MASTER_SITES=	https://download.tuxfamily.org/chrony/ \
		LOCAL/mandree

# overridden in net/chrony-lite
MAINTAINER?=	mandree@FreeBSD.org
COMMENT?=	System clock synchronization client and server

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/COPYING

USES=		cpe gmake libedit pkgconfig

CPE_VENDOR=	tuxfamily

USE_RC_SUBR=	chronyd

HAS_CONFIGURE=	yes
CONFIGURE_ARGS=	--chronyvardir=/var/db/${PORTNAME} \
		--datarootdir=${DATADIR} \
		--docdir=${DOCSDIR} \
		--enable-ntp-signd \
		--mandir=${MANPREFIX}/man \
		--prefix=${PREFIX} \
		--sysconfdir=${PREFIX}/etc \
		--without-tomcrypt

ALL_TARGET=	all
INSTALL_TARGET=	install

LDFLAGS+=	-L${LOCALBASE}/lib

CONFLICTS_INSTALL?=	chrony-lite

PORTDOCS=	FAQ NEWS README
PORTEXAMPLES=	chrony.conf.example1 chrony.conf.example2 chrony.conf.example3 \
		chrony.keys.example

# XXX: there are also other potentially useful options worth looking into:
#  --disable-pps        Disable PPS API support
OPTIONS_DEFINE=		DOCS EXAMPLES HTMLDOCS NTS USER
OPTIONS_DEFAULT=	NETTLE NTS USER
OPTIONS_GROUP=		SECHASH
OPTIONS_GROUP_SECHASH=	NETTLE NSS
OPTIONS_SUB=		yes
NTS_IMPLIES=		NETTLE
NETTLE_PREVENTS=	NSS

HTMLDOCS_DESC=	Build HTML docs (IMPLIES DOCS, needs ruby, asciidoctor)
NETTLE_DESC=	Nettle crypto library support for secure hash and NTS
NSS_DESC=	NSS-based support for more hashing algorithms
NTS_DESC=	Support Network Time Security (NTS, uses GnuTLS & Nettle)
SECHASH_DESC=	Support for secure hash functions
USER_DESC=	Run as user/group chronyd (unset: user/group ntpd)

HTMLDOCS_IMPLIES=	DOCS

HTMLDOCS_BUILD_DEPENDS+=	asciidoctor:textproc/rubygem-asciidoctor
HTMLDOCS_ALL_TARGET=		docs
HTMLDOCS_INSTALL_TARGET=	docs
NETTLE_LIB_DEPENDS=		libnettle.so:security/nettle
NETTLE_CONFIGURE_OFF=		--without-nettle
NSS_LIB_DEPENDS=		libfreebl3.so:security/nss
NSS_CONFIGURE_OFF=		--without-nss
NTS_LIB_DEPENDS=		libgnutls.so:security/gnutls
NTS_CONFIGURE_OFF=		--without-gnutls
USER_CONFIGURE_ON=		--with-user=chronyd
USER_CONFIGURE_OFF=		--with-user=ntpd

USER_VARS=	GROUPS=chronyd \
		USERS=chronyd

.include <bsd.port.pre.mk>

.if defined(WITH_DEBUG)
CONFIGURE_ARGS+=	--enable-debug
.endif

.if ${PORT_OPTIONS:MHTMLDOCS}
PORTDOCS+=	doc/*.html
.endif

post-patch:
	cd ${WRKSRC}/examples && \
		${REINPLACE_CMD} -e 's!%%PREFIX%%!${PREFIX}!g' \
		                 -e 's!/var/lib!/var/db!g' \
				 ${PORTEXAMPLES:M*.conf.example*}

post-install:
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/chronyc
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/chronyd
	${INSTALL_DATA} ${WRKSRC}/examples/chrony.conf.example3 \
		${STAGEDIR}${PREFIX}/etc/chrony.conf.sample

post-install-DOCS-on:
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${RM} doc/installation.html
	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	cd ${WRKSRC}/examples && \
		${INSTALL_DATA} ${PORTEXAMPLES} ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.post.mk>