blob: d11ada67ee5c647ddf353783078de8c789e496cf [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"
Andrew Geisslerc5535c92023-01-27 16:10:19 -06005LIC_FILES_CHKSUM = "file://LICENSES/BSD-2;md5=653830da7b770a32f6f50f6107e0b186 \
6 file://LICENSES/BSD-3;md5=55e9dcf6a625a2dcfcda4ef6a647fbfd \
7 file://LICENSES/CC-BY-4.0;md5=2ab724713fdaf49e4523c4503bfd068d \
8 file://LICENSES/MIT;md5=5a9dfc801af3eb49df2055c9b07918b2 \
9 file://LICENSES/NTP;md5=cb56b7747f86157c78ca81f224806694"
Andrew Geissler595f6302022-01-24 19:11:47 +000010
11DEPENDS += "bison-native \
12 openssl \
13 python3"
14
15SRC_URI = "https://ftp.ntpsec.org/pub/releases/ntpsec-${PV}.tar.gz \
Patrick Williams92b42cb2022-09-03 06:53:57 -050016 file://volatiles.ntpsec \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060017 file://0001-wscript-Add-BISONFLAGS-support.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050018 "
Andrew Geissler595f6302022-01-24 19:11:47 +000019
Andrew Geisslerc5535c92023-01-27 16:10:19 -060020SRC_URI[sha256sum] = "2f2848760b915dfe185b9217f777738b36ceeb78a7fc208b7e74e039dec22df5"
Andrew Geissler595f6302022-01-24 19:11:47 +000021
Patrick Williams92b42cb2022-09-03 06:53:57 -050022UPSTREAM_CHECK_URI = "ftp://ftp.ntpsec.org/pub/releases/"
23
Andrew Geissler595f6302022-01-24 19:11:47 +000024inherit pkgconfig python3-dir python3targetconfig systemd update-alternatives update-rc.d useradd waf features_check
25
26# RDEPENDS on gnuplot with this restriction
27REQUIRED_DISTRO_FEATURES = "x11"
28
29PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'seccomp systemd', d)} \
30 cap \
31 leap-smear \
32 mdns \
33 mssntp \
34 nts \
35 refclocks"
36
37PACKAGECONFIG:remove:riscv32 = "seccomp"
38
39PACKAGECONFIG[cap] = ",,libcap"
40PACKAGECONFIG[docs] = "--enable-doc --enable-manpage,--disable-doc --disable-manpage,"
41PACKAGECONFIG[leap-smear] = "--enable-leap-smear"
42PACKAGECONFIG[mdns] = ",,mdns"
43PACKAGECONFIG[mssntp] = "--enable-mssntp"
44PACKAGECONFIG[nts] = ",--disable-nts"
45PACKAGECONFIG[refclocks] = "--refclock=all,,pps-tools"
46PACKAGECONFIG[seccomp] = "--enable-seccomp,,libseccomp"
47PACKAGECONFIG[systemd] = ",,systemd"
48
49CC[unexport] = "1"
50CFLAGS[unexport] = "1"
51LDFLAGS[unexport] = "1"
52
53export PYTHON_VERSION = "${PYTHON_BASEVERSION}"
54export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}"
55export pyext_PATTERN = "%s.so"
56export PYTHON_LDFLAGS = "-lpthread -ldl"
57
Patrick Williams92b42cb2022-09-03 06:53:57 -050058CFLAGS:append = " -I${PYTHON_INCLUDE_DIR} -D_GNU_SOURCE"
Andrew Geissler595f6302022-01-24 19:11:47 +000059
60EXTRA_OECONF = "--cross-compiler='${CC}' \
61 --cross-cflags='${CFLAGS}' \
62 --cross-ldflags='${LDFLAGS}' \
63 --pyshebang=${bindir}/python3 \
64 --pythondir=${PYTHON_SITEPACKAGES_DIR} \
65 --pythonarchdir=${PYTHON_SITEPACKAGES_DIR} \
Andrew Geissler595f6302022-01-24 19:11:47 +000066 --enable-debug-gdb \
67 --enable-early-droproot"
68
69EXTRA_OEWAF_BUILD ?= "-v"
70
71NTP_USER_HOME ?= "/var/lib/ntp"
72
Andrew Geisslerc5535c92023-01-27 16:10:19 -060073BISONFLAGS = "--file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
74
75do_configure:prepend() {
76 export BISONFLAGS="${BISONFLAGS}"
77}
78
Andrew Geissler595f6302022-01-24 19:11:47 +000079do_install:append() {
80 install -d ${D}${sysconfdir}/init.d
81 install -m 755 ${S}/etc/rc/ntpd ${D}${sysconfdir}/init.d
82 cp -r ${S}/etc/ntp.d ${D}${sysconfdir}
83
84 sed -e 's:@NTP_USER_HOME@:${NTP_USER_HOME}:g' ${WORKDIR}/volatiles.ntpsec >${T}/volatiles.ntpsec
85 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
86 cp ${B}/main/etc/* ${D}${systemd_system_unitdir}
87 awk '{print $1, $5, $4, $2, $3, "-"}' ${T}/volatiles.ntpsec >${T}/tmpfiles.ntpsec
88 install -D -m 0644 ${T}/tmpfiles.ntpsec ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
89 else
90 install -D -m 0644 ${T}/volatiles.ntpsec ${D}${sysconfdir}/default/volatiles/99_${BPN}
91 fi
92}
93
94PACKAGE_BEFORE_PN = "${PN}-python ${PN}-utils ${PN}-viz"
95
96FILES:${PN} += "${nonarch_libdir}/tmpfiles.d/ntpsec.conf"
97FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR} \
98 ${libdir}/libntpc.so.*"
99FILES:${PN}-utils = "${bindir}/ntpdig \
100 ${bindir}/ntpkeygen \
101 ${bindir}/ntpleapfetch \
102 ${bindir}/ntpmon \
103 ${bindir}/ntpq \
104 ${bindir}/ntpsnmpd \
105 ${bindir}/ntpsweep \
106 ${bindir}/ntptrace \
107 ${bindir}/ntpwait"
108FILES:${PN}-viz = "${bindir}/ntplogtemp \
109 ${bindir}/ntpviz"
110
111RDEPENDS:${PN} += "libgcc"
112RDEPENDS:${PN}-utils += "${PN}-python python3-core"
113RDEPENDS:${PN}-viz += "gnuplot ${PN}-python python3-core python3-compression python3-ctypes python3-logging python3-shell"
114
115USERADD_PACKAGES = "${PN}"
116USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \
117 --no-create-home \
118 --shell /bin/false --user-group ntp"
119
120INITSCRIPT_NAME = "ntpd"
121
122SYSTEMD_PACKAGES = "${PN} ${PN}-viz"
123SYSTEMD_SERVICE:${PN} = "ntpd.service ntp-wait.service"
124SYSTEMD_SERVICE:${PN}-viz = "ntplogtemp.service ntpviz-weekly.timer ntpviz-weekly.service ntpviz-daily.timer ntpviz-daily.service ntplogtemp.timer"
125
126ALTERNATIVE_PRIORITY = "80"
127
128ALTERNATIVE:${PN} = "ntpd"
129ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd"