blob: 3efac7d9838313d80ce86afed9b4c1b0cfa11754 [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 \
19 file://volatiles.ntpsec"
20
21SRC_URI[sha256sum] = "f2684835116c80b8f21782a5959a805ba3c44e3a681dd6c17c7cb00cc242c27a"
22
23inherit pkgconfig python3-dir python3targetconfig systemd update-alternatives update-rc.d useradd waf features_check
24
25# RDEPENDS on gnuplot with this restriction
26REQUIRED_DISTRO_FEATURES = "x11"
27
28PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'seccomp systemd', d)} \
29 cap \
30 leap-smear \
31 mdns \
32 mssntp \
33 nts \
34 refclocks"
35
36PACKAGECONFIG:remove:riscv32 = "seccomp"
37
38PACKAGECONFIG[cap] = ",,libcap"
39PACKAGECONFIG[docs] = "--enable-doc --enable-manpage,--disable-doc --disable-manpage,"
40PACKAGECONFIG[leap-smear] = "--enable-leap-smear"
41PACKAGECONFIG[mdns] = ",,mdns"
42PACKAGECONFIG[mssntp] = "--enable-mssntp"
43PACKAGECONFIG[nts] = ",--disable-nts"
44PACKAGECONFIG[refclocks] = "--refclock=all,,pps-tools"
45PACKAGECONFIG[seccomp] = "--enable-seccomp,,libseccomp"
46PACKAGECONFIG[systemd] = ",,systemd"
47
48CC[unexport] = "1"
49CFLAGS[unexport] = "1"
50LDFLAGS[unexport] = "1"
51
52export PYTHON_VERSION = "${PYTHON_BASEVERSION}"
53export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}"
54export pyext_PATTERN = "%s.so"
55export PYTHON_LDFLAGS = "-lpthread -ldl"
56
57CFLAGS:append = " -I${PYTHON_INCLUDE_DIR}"
58
59EXTRA_OECONF = "--cross-compiler='${CC}' \
60 --cross-cflags='${CFLAGS}' \
61 --cross-ldflags='${LDFLAGS}' \
62 --pyshebang=${bindir}/python3 \
63 --pythondir=${PYTHON_SITEPACKAGES_DIR} \
64 --pythonarchdir=${PYTHON_SITEPACKAGES_DIR} \
65 --enable-debug \
66 --enable-debug-gdb \
67 --enable-early-droproot"
68
69EXTRA_OEWAF_BUILD ?= "-v"
70
71NTP_USER_HOME ?= "/var/lib/ntp"
72
73do_install:append() {
74 install -d ${D}${sysconfdir}/init.d
75 install -m 755 ${S}/etc/rc/ntpd ${D}${sysconfdir}/init.d
76 cp -r ${S}/etc/ntp.d ${D}${sysconfdir}
77
78 sed -e 's:@NTP_USER_HOME@:${NTP_USER_HOME}:g' ${WORKDIR}/volatiles.ntpsec >${T}/volatiles.ntpsec
79 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
80 cp ${B}/main/etc/* ${D}${systemd_system_unitdir}
81 awk '{print $1, $5, $4, $2, $3, "-"}' ${T}/volatiles.ntpsec >${T}/tmpfiles.ntpsec
82 install -D -m 0644 ${T}/tmpfiles.ntpsec ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
83 else
84 install -D -m 0644 ${T}/volatiles.ntpsec ${D}${sysconfdir}/default/volatiles/99_${BPN}
85 fi
86}
87
88PACKAGE_BEFORE_PN = "${PN}-python ${PN}-utils ${PN}-viz"
89
90FILES:${PN} += "${nonarch_libdir}/tmpfiles.d/ntpsec.conf"
91FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR} \
92 ${libdir}/libntpc.so.*"
93FILES:${PN}-utils = "${bindir}/ntpdig \
94 ${bindir}/ntpkeygen \
95 ${bindir}/ntpleapfetch \
96 ${bindir}/ntpmon \
97 ${bindir}/ntpq \
98 ${bindir}/ntpsnmpd \
99 ${bindir}/ntpsweep \
100 ${bindir}/ntptrace \
101 ${bindir}/ntpwait"
102FILES:${PN}-viz = "${bindir}/ntplogtemp \
103 ${bindir}/ntpviz"
104
105RDEPENDS:${PN} += "libgcc"
106RDEPENDS:${PN}-utils += "${PN}-python python3-core"
107RDEPENDS:${PN}-viz += "gnuplot ${PN}-python python3-core python3-compression python3-ctypes python3-logging python3-shell"
108
109USERADD_PACKAGES = "${PN}"
110USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \
111 --no-create-home \
112 --shell /bin/false --user-group ntp"
113
114INITSCRIPT_NAME = "ntpd"
115
116SYSTEMD_PACKAGES = "${PN} ${PN}-viz"
117SYSTEMD_SERVICE:${PN} = "ntpd.service ntp-wait.service"
118SYSTEMD_SERVICE:${PN}-viz = "ntplogtemp.service ntpviz-weekly.timer ntpviz-weekly.service ntpviz-daily.timer ntpviz-daily.service ntplogtemp.timer"
119
120ALTERNATIVE_PRIORITY = "80"
121
122ALTERNATIVE:${PN} = "ntpd"
123ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd"