blob: e975f903f93f0864e435285db13999249d602cd9 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "The Network Time Protocol suite, refactored"
2HOMEPAGE = "https://www.ntpsec.org/"
3
4LICENSE = "CC-BY-4.0 & BSD-2-Clause & NTP & BSD-3-Clause & MIT"
5LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=0520591566b6ed3a9ced8b15b4d4abf9 \
6 file://libjsmn/LICENSE;md5=38118982429881235de8adf478a8e75d \
7 file://docs/copyright.adoc;md5=9a1e3fce4b630078cb67ba2b619d2b13 \
8 file://libaes_siv/COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
9
10DEPENDS += "bison-native \
11 openssl \
12 python3"
13
14SRC_URI = "https://ftp.ntpsec.org/pub/releases/ntpsec-${PV}.tar.gz \
15 file://0001-Update-to-OpenSSL-3.0.0-alpha15.patch \
16 file://0001-ntpd-ntp_sandbox.c-allow-clone3-for-glibc-2.34-in-se.patch \
17 file://0001-ntpd-ntp_sandbox.c-allow-newfstatat-on-all-archs-for.patch \
18 file://0002-ntpd-ntp_sandbox.c-match-riscv-to-aarch-in-seccomp-f.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050019 file://volatiles.ntpsec \
20 file://0001-wscript-Widen-the-search-for-tags.patch \
21 "
Andrew Geissler595f6302022-01-24 19:11:47 +000022
23SRC_URI[sha256sum] = "f2684835116c80b8f21782a5959a805ba3c44e3a681dd6c17c7cb00cc242c27a"
24
Patrick Williams92b42cb2022-09-03 06:53:57 -050025UPSTREAM_CHECK_URI = "ftp://ftp.ntpsec.org/pub/releases/"
26
Andrew Geissler595f6302022-01-24 19:11:47 +000027inherit pkgconfig python3-dir python3targetconfig systemd update-alternatives update-rc.d useradd waf features_check
28
29# RDEPENDS on gnuplot with this restriction
30REQUIRED_DISTRO_FEATURES = "x11"
31
32PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'seccomp systemd', d)} \
33 cap \
34 leap-smear \
35 mdns \
36 mssntp \
37 nts \
38 refclocks"
39
40PACKAGECONFIG:remove:riscv32 = "seccomp"
41
42PACKAGECONFIG[cap] = ",,libcap"
43PACKAGECONFIG[docs] = "--enable-doc --enable-manpage,--disable-doc --disable-manpage,"
44PACKAGECONFIG[leap-smear] = "--enable-leap-smear"
45PACKAGECONFIG[mdns] = ",,mdns"
46PACKAGECONFIG[mssntp] = "--enable-mssntp"
47PACKAGECONFIG[nts] = ",--disable-nts"
48PACKAGECONFIG[refclocks] = "--refclock=all,,pps-tools"
49PACKAGECONFIG[seccomp] = "--enable-seccomp,,libseccomp"
50PACKAGECONFIG[systemd] = ",,systemd"
51
52CC[unexport] = "1"
53CFLAGS[unexport] = "1"
54LDFLAGS[unexport] = "1"
55
56export PYTHON_VERSION = "${PYTHON_BASEVERSION}"
57export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}"
58export pyext_PATTERN = "%s.so"
59export PYTHON_LDFLAGS = "-lpthread -ldl"
60
Patrick Williams92b42cb2022-09-03 06:53:57 -050061CFLAGS:append = " -I${PYTHON_INCLUDE_DIR} -D_GNU_SOURCE"
Andrew Geissler595f6302022-01-24 19:11:47 +000062
63EXTRA_OECONF = "--cross-compiler='${CC}' \
64 --cross-cflags='${CFLAGS}' \
65 --cross-ldflags='${LDFLAGS}' \
66 --pyshebang=${bindir}/python3 \
67 --pythondir=${PYTHON_SITEPACKAGES_DIR} \
68 --pythonarchdir=${PYTHON_SITEPACKAGES_DIR} \
69 --enable-debug \
70 --enable-debug-gdb \
71 --enable-early-droproot"
72
73EXTRA_OEWAF_BUILD ?= "-v"
74
75NTP_USER_HOME ?= "/var/lib/ntp"
76
77do_install:append() {
78 install -d ${D}${sysconfdir}/init.d
79 install -m 755 ${S}/etc/rc/ntpd ${D}${sysconfdir}/init.d
80 cp -r ${S}/etc/ntp.d ${D}${sysconfdir}
81
82 sed -e 's:@NTP_USER_HOME@:${NTP_USER_HOME}:g' ${WORKDIR}/volatiles.ntpsec >${T}/volatiles.ntpsec
83 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
84 cp ${B}/main/etc/* ${D}${systemd_system_unitdir}
85 awk '{print $1, $5, $4, $2, $3, "-"}' ${T}/volatiles.ntpsec >${T}/tmpfiles.ntpsec
86 install -D -m 0644 ${T}/tmpfiles.ntpsec ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
87 else
88 install -D -m 0644 ${T}/volatiles.ntpsec ${D}${sysconfdir}/default/volatiles/99_${BPN}
89 fi
90}
91
92PACKAGE_BEFORE_PN = "${PN}-python ${PN}-utils ${PN}-viz"
93
94FILES:${PN} += "${nonarch_libdir}/tmpfiles.d/ntpsec.conf"
95FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR} \
96 ${libdir}/libntpc.so.*"
97FILES:${PN}-utils = "${bindir}/ntpdig \
98 ${bindir}/ntpkeygen \
99 ${bindir}/ntpleapfetch \
100 ${bindir}/ntpmon \
101 ${bindir}/ntpq \
102 ${bindir}/ntpsnmpd \
103 ${bindir}/ntpsweep \
104 ${bindir}/ntptrace \
105 ${bindir}/ntpwait"
106FILES:${PN}-viz = "${bindir}/ntplogtemp \
107 ${bindir}/ntpviz"
108
109RDEPENDS:${PN} += "libgcc"
110RDEPENDS:${PN}-utils += "${PN}-python python3-core"
111RDEPENDS:${PN}-viz += "gnuplot ${PN}-python python3-core python3-compression python3-ctypes python3-logging python3-shell"
112
113USERADD_PACKAGES = "${PN}"
114USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \
115 --no-create-home \
116 --shell /bin/false --user-group ntp"
117
118INITSCRIPT_NAME = "ntpd"
119
120SYSTEMD_PACKAGES = "${PN} ${PN}-viz"
121SYSTEMD_SERVICE:${PN} = "ntpd.service ntp-wait.service"
122SYSTEMD_SERVICE:${PN}-viz = "ntplogtemp.service ntpviz-weekly.timer ntpviz-weekly.service ntpviz-daily.timer ntpviz-daily.service ntplogtemp.timer"
123
124ALTERNATIVE_PRIORITY = "80"
125
126ALTERNATIVE:${PN} = "ntpd"
127ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd"