1################################################################################
2#
3# ntpsec
4#
5################################################################################
6
7NTPSEC_VERSION = 1.2.3
8NTPSEC_SOURCE = ntpsec-NTPsec_$(subst .,_,$(NTPSEC_VERSION)).tar.bz2
9NTPSEC_SITE = https://gitlab.com/NTPsec/ntpsec/-/archive/NTPsec_$(subst .,_,$(NTPSEC_VERSION))
10NTPSEC_LICENSE = Apache-2.0, \
11	Beerware, \
12	BSD-2-Clause.txt, \
13	BSD-3-Clause.txt, \
14	BSD-4-Clause.txt, \
15	ISC.txt, \
16	MIT.txt, \
17	NTP.txt, \
18	CC-BY-4.0.txt (docs)
19NTPSEC_LICENSE_FILES = \
20	LICENSES/Apache-2.0.txt \
21	LICENSES/Beerware.txt \
22	LICENSES/BSD-2-Clause.txt \
23	LICENSES/BSD-3-Clause.txt \
24	LICENSES/BSD-4-Clause.txt \
25	LICENSES/ISC.txt \
26	LICENSES/MIT.txt \
27	LICENSES/NTP.txt \
28	LICENSES/CC-BY-4.0.txt \
29	docs/copyright.adoc
30
31NTPSEC_CPE_ID_VENDOR = ntpsec
32
33NTPSEC_DEPENDENCIES = \
34	host-bison \
35	host-pkgconf \
36	python3 \
37	libcap \
38	openssl
39
40# CC="$(HOSTCC)" is strange but needed to build some host tools, the
41# cross-compiler will properly be used to build target code thanks to
42# --cross-compiler
43NTPSEC_CONF_OPTS = \
44	CC="$(HOSTCC)" \
45	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \
46	--libdir=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/ntp \
47	--cross-compiler="$(TARGET_CC)" \
48	--cross-cflags="$(TARGET_CFLAGS) -std=gnu99" \
49	--cross-ldflags="$(TARGET_LDFLAGS)" \
50	--notests \
51	--enable-early-droproot \
52	--disable-mdns-registration \
53	--enable-pylib=ffi \
54	--nopyc \
55	--nopyo \
56	--nopycache \
57	--disable-doc \
58	--disable-manpage
59
60ifeq ($(BR2_PACKAGE_NTPSEC_CLASSIC_MODE),y)
61NTPSEC_CONF_OPTS += --enable-classic-mode
62endif
63
64# no '--enable-nts' option available
65ifeq ($(BR2_PACKAGE_NTPSEC_NTS),)
66NTPSEC_CONF_OPTS += --disable-nts
67endif
68
69# refclocks are disabled by default, can only be enabled
70ifeq ($(BR2_PACKAGE_NTPSEC_REFCLOCK_ALL),y)
71NTPSEC_DEPENDENCIES += pps-tools
72NTPSEC_CONF_OPTS += --refclock=all
73endif
74
75define NTPSEC_INSTALL_NTPSEC_CONF
76	$(INSTALL) -m 644 package/ntpsec/ntpd.etc.conf $(TARGET_DIR)/etc/ntp.conf
77endef
78NTPSEC_POST_INSTALL_TARGET_HOOKS += NTPSEC_INSTALL_NTPSEC_CONF
79
80define NTPSEC_INSTALL_INIT_SYSV
81	$(INSTALL) -D -m 755 package/ntpsec/S49ntpd $(TARGET_DIR)/etc/init.d/S49ntpd
82endef
83
84define NTPSEC_USERS
85	ntp -1 ntp -1 * - - - ntpd user
86endef
87
88$(eval $(waf-package))
89