Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "Network Time Protocol daemon and utilities" |
| 2 | DESCRIPTION = "The Network Time Protocol (NTP) is used to \ |
| 3 | synchronize the time of a computer client or server to \ |
| 4 | another server or reference time source, such as a radio \ |
| 5 | or satellite receiver or modem." |
| 6 | HOMEPAGE = "http://support.ntp.org" |
| 7 | SECTION = "net" |
| 8 | LICENSE = "NTP" |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 9 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=3a8ffebbcad335abf2c39fec38671eec" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 10 | |
| 11 | DEPENDS = "libevent" |
| 12 | |
| 13 | SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.gz \ |
| 14 | file://ntp-4.2.4_p6-nano.patch \ |
| 15 | file://reproducibility-fixed-path-to-posix-shell.patch \ |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 16 | file://0001-libntp-Do-not-use-PTHREAD_STACK_MIN-on-glibc.patch \ |
| 17 | file://0001-test-Fix-build-with-new-compiler-defaults-to-fno-com.patch \ |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 18 | file://0001-sntp-Fix-types-in-check-for-pthread_detach.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 19 | file://ntpd \ |
| 20 | file://ntp.conf \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | file://ntpd.service \ |
| 22 | file://sntp.service \ |
| 23 | file://sntp \ |
| 24 | file://ntpd.list \ |
| 25 | " |
| 26 | |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 27 | SRC_URI[sha256sum] = "103dd272e6a66c5b8df07dce5e9a02555fcd6f1397bdfb782237328e89d3a866" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 28 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 29 | CVE_STATUS[CVE-2016-9312] = "not-applicable-platform: Issue only applies on Windows" |
| 30 | CVE_STATUS[CVE-2019-11331] = "upstream-wontfix: inherent to RFC 5905 and cannot be fixed without breaking compatibility" |
| 31 | CVE_STATUS_GROUPS += "CVE_STATUS_NTP" |
| 32 | CVE_STATUS_NTP[status] = "fixed-version: Yocto CVE check can not handle 'p' in ntp version" |
| 33 | CVE_STATUS_NTP = " \ |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 34 | CVE-2015-5146 \ |
| 35 | CVE-2015-5300 \ |
| 36 | CVE-2015-7975 \ |
| 37 | CVE-2015-7976 \ |
| 38 | CVE-2015-7977 \ |
| 39 | CVE-2015-7978 \ |
| 40 | CVE-2015-7979 \ |
| 41 | CVE-2015-8138 \ |
| 42 | CVE-2015-8139 \ |
| 43 | CVE-2015-8140 \ |
| 44 | CVE-2015-8158 \ |
| 45 | CVE-2016-1547 \ |
| 46 | CVE-2016-2516 \ |
| 47 | CVE-2016-2517 \ |
| 48 | CVE-2016-2519 \ |
| 49 | CVE-2016-7429 \ |
| 50 | CVE-2016-7433 \ |
| 51 | CVE-2016-9310 \ |
| 52 | CVE-2016-9311 \ |
| 53 | " |
| 54 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 55 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 56 | inherit autotools update-rc.d useradd systemd pkgconfig |
| 57 | |
| 58 | # The ac_cv_header_readline_history is to stop ntpdc depending on either |
| 59 | # readline or curses |
| 60 | EXTRA_OECONF += "--with-net-snmp-config=no \ |
| 61 | --without-ntpsnmpd \ |
| 62 | ac_cv_header_readline_history_h=no \ |
| 63 | --with-yielding_select=yes \ |
| 64 | --with-locfile=redhat \ |
| 65 | --without-rpath \ |
| 66 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 67 | CFLAGS:append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 68 | |
| 69 | USERADD_PACKAGES = "${PN}" |
| 70 | NTP_USER_HOME ?= "/var/lib/ntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 71 | USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 72 | --no-create-home \ |
| 73 | --shell /bin/false --user-group ntp" |
| 74 | |
| 75 | # NB: debug is default-enabled by NTP; keep it default-enabled here. |
| 76 | PACKAGECONFIG ??= "cap debug refclocks openssl \ |
| 77 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ |
| 78 | " |
| 79 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ |
| 80 | --with-openssl-incdir=${STAGING_INCDIR} \ |
| 81 | --with-crypto, \ |
| 82 | --without-openssl --without-crypto, \ |
| 83 | openssl" |
| 84 | PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" |
| 85 | PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" |
| 86 | PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools" |
| 87 | PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" |
| 88 | PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns" |
| 89 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 90 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 91 | do_install:append() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 92 | install -d ${D}${sysconfdir}/init.d |
| 93 | install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} |
| 94 | install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 95 | |
| 96 | install -m 755 -d ${D}${NTP_USER_HOME} |
| 97 | chown ntp:ntp ${D}${NTP_USER_HOME} |
| 98 | |
| 99 | # Fix hardcoded paths in scripts |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 100 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 101 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 102 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 103 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 104 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace |
| 105 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace |
| 106 | sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait |
| 107 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait |
| 108 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj |
| 109 | sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj |
| 110 | |
| 111 | install -d ${D}/${sysconfdir}/default |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 112 | install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/ |
| 113 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 114 | install -d ${D}${systemd_unitdir}/system |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 115 | install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/ |
| 116 | install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/ |
| 117 | |
| 118 | install -d ${D}${systemd_unitdir}/ntp-units.d |
| 119 | install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list |
| 120 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 121 | # Remove the empty libexecdir and bindir. |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 122 | rmdir --ignore-fail-on-non-empty ${D}${libexecdir} |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 123 | rmdir --ignore-fail-on-non-empty ${D}${bindir} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 124 | } |
| 125 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 126 | PACKAGES += "sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 127 | |
| 128 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms |
| 129 | # with wonky clocks (e.g. OpenSlug) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 130 | RDEPENDS:${PN} = "${PN}-tickadj" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 131 | # ntpd & sntp require libgcc for execution due to phtread_cancel/pthread_exit calls |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 132 | RDEPENDS:${PN} += "libgcc" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 133 | RDEPENDS:sntp += "libgcc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 134 | # Handle move from bin to utils package |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 135 | RPROVIDES:${PN}-utils = "${PN}-bin" |
| 136 | RREPLACES:${PN}-utils = "${PN}-bin" |
| 137 | RCONFLICTS:${PN}-utils = "${PN}-bin" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 138 | # ntpdc and ntpq were split out of ntp-utils |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 139 | RDEPENDS:${PN}-utils = "ntpdc ntpq \ |
| 140 | perl-module-lib \ |
| 141 | perl-module-exporter \ |
| 142 | perl-module-carp \ |
| 143 | perl-module-version \ |
| 144 | perl-module-socket \ |
| 145 | perl-module-getopt-long \ |
| 146 | " |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 147 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 148 | SYSTEMD_PACKAGES = "${PN} sntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 149 | SYSTEMD_SERVICE:${PN} = "ntpd.service" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 150 | SYSTEMD_SERVICE:sntp = "sntp.service" |
| 151 | SYSTEMD_AUTO_ENABLE:sntp = "disable" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 152 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 153 | RPROVIDES:${PN} += "${PN}-systemd" |
| 154 | RREPLACES:${PN} += "${PN}-systemd" |
| 155 | RCONFLICTS:${PN} += "${PN}-systemd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 156 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 157 | RSUGGESTS:${PN} = "iana-etc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 158 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 159 | FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 160 | ${NTP_USER_HOME} \ |
| 161 | ${systemd_unitdir}/ntp-units.d/60-ntpd.list \ |
| 162 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 163 | FILES:${PN}-tickadj = "${sbindir}/tickadj" |
| 164 | FILES:${PN}-utils = "${sbindir} ${datadir}/ntp/lib" |
| 165 | RDEPENDS:${PN}-utils += "perl" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 166 | FILES:sntp = "${sbindir}/sntp \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 167 | ${sysconfdir}/default/sntp \ |
| 168 | ${systemd_unitdir}/system/sntp.service \ |
| 169 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 170 | FILES:ntpdc = "${sbindir}/ntpdc" |
| 171 | FILES:ntpq = "${sbindir}/ntpq" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 172 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 173 | CONFFILES:${PN} = "${sysconfdir}/ntp.conf" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 174 | |
| 175 | INITSCRIPT_NAME = "ntpd" |
| 176 | # No dependencies, so just go in at the standard level (20) |
| 177 | INITSCRIPT_PARAMS = "defaults" |
| 178 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 179 | inherit update-alternatives |
| 180 | |
| 181 | ALTERNATIVE_PRIORITY = "100" |
| 182 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 183 | ALTERNATIVE:${PN} = "ntpd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 184 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" |