Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | SUMMARY = "The Network Time Protocol suite, refactored" |
| 2 | HOMEPAGE = "https://www.ntpsec.org/" |
| 3 | |
| 4 | LICENSE = "CC-BY-4.0 & BSD-2-Clause & NTP & BSD-3-Clause & MIT" |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 5 | LIC_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 Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 10 | |
| 11 | DEPENDS += "bison-native \ |
| 12 | openssl \ |
| 13 | python3" |
| 14 | |
| 15 | SRC_URI = "https://ftp.ntpsec.org/pub/releases/ntpsec-${PV}.tar.gz \ |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 16 | file://volatiles.ntpsec \ |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 17 | file://0001-wscript-Add-BISONFLAGS-support.patch \ |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 18 | " |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 19 | |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 20 | SRC_URI[sha256sum] = "2f2848760b915dfe185b9217f777738b36ceeb78a7fc208b7e74e039dec22df5" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 21 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 22 | UPSTREAM_CHECK_URI = "ftp://ftp.ntpsec.org/pub/releases/" |
| 23 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 24 | inherit pkgconfig python3-dir python3targetconfig systemd update-alternatives update-rc.d useradd waf features_check |
| 25 | |
| 26 | # RDEPENDS on gnuplot with this restriction |
| 27 | REQUIRED_DISTRO_FEATURES = "x11" |
| 28 | |
| 29 | PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'seccomp systemd', d)} \ |
| 30 | cap \ |
| 31 | leap-smear \ |
| 32 | mdns \ |
| 33 | mssntp \ |
| 34 | nts \ |
| 35 | refclocks" |
| 36 | |
| 37 | PACKAGECONFIG:remove:riscv32 = "seccomp" |
| 38 | |
| 39 | PACKAGECONFIG[cap] = ",,libcap" |
| 40 | PACKAGECONFIG[docs] = "--enable-doc --enable-manpage,--disable-doc --disable-manpage," |
| 41 | PACKAGECONFIG[leap-smear] = "--enable-leap-smear" |
| 42 | PACKAGECONFIG[mdns] = ",,mdns" |
| 43 | PACKAGECONFIG[mssntp] = "--enable-mssntp" |
| 44 | PACKAGECONFIG[nts] = ",--disable-nts" |
| 45 | PACKAGECONFIG[refclocks] = "--refclock=all,,pps-tools" |
| 46 | PACKAGECONFIG[seccomp] = "--enable-seccomp,,libseccomp" |
| 47 | PACKAGECONFIG[systemd] = ",,systemd" |
| 48 | |
| 49 | CC[unexport] = "1" |
| 50 | CFLAGS[unexport] = "1" |
| 51 | LDFLAGS[unexport] = "1" |
| 52 | |
| 53 | export PYTHON_VERSION = "${PYTHON_BASEVERSION}" |
| 54 | export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}" |
| 55 | export pyext_PATTERN = "%s.so" |
| 56 | export PYTHON_LDFLAGS = "-lpthread -ldl" |
| 57 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 58 | CFLAGS:append = " -I${PYTHON_INCLUDE_DIR} -D_GNU_SOURCE" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 59 | |
| 60 | EXTRA_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 Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 66 | --enable-debug-gdb \ |
| 67 | --enable-early-droproot" |
| 68 | |
| 69 | EXTRA_OEWAF_BUILD ?= "-v" |
| 70 | |
| 71 | NTP_USER_HOME ?= "/var/lib/ntp" |
| 72 | |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 73 | BISONFLAGS = "--file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" |
| 74 | |
| 75 | do_configure:prepend() { |
| 76 | export BISONFLAGS="${BISONFLAGS}" |
| 77 | } |
| 78 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 79 | do_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 | |
| 94 | PACKAGE_BEFORE_PN = "${PN}-python ${PN}-utils ${PN}-viz" |
| 95 | |
| 96 | FILES:${PN} += "${nonarch_libdir}/tmpfiles.d/ntpsec.conf" |
| 97 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR} \ |
| 98 | ${libdir}/libntpc.so.*" |
| 99 | FILES:${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" |
| 108 | FILES:${PN}-viz = "${bindir}/ntplogtemp \ |
| 109 | ${bindir}/ntpviz" |
| 110 | |
| 111 | RDEPENDS:${PN} += "libgcc" |
| 112 | RDEPENDS:${PN}-utils += "${PN}-python python3-core" |
| 113 | RDEPENDS:${PN}-viz += "gnuplot ${PN}-python python3-core python3-compression python3-ctypes python3-logging python3-shell" |
| 114 | |
| 115 | USERADD_PACKAGES = "${PN}" |
| 116 | USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ |
| 117 | --no-create-home \ |
| 118 | --shell /bin/false --user-group ntp" |
| 119 | |
| 120 | INITSCRIPT_NAME = "ntpd" |
| 121 | |
| 122 | SYSTEMD_PACKAGES = "${PN} ${PN}-viz" |
| 123 | SYSTEMD_SERVICE:${PN} = "ntpd.service ntp-wait.service" |
| 124 | SYSTEMD_SERVICE:${PN}-viz = "ntplogtemp.service ntpviz-weekly.timer ntpviz-weekly.service ntpviz-daily.timer ntpviz-daily.service ntplogtemp.timer" |
| 125 | |
| 126 | ALTERNATIVE_PRIORITY = "80" |
| 127 | |
| 128 | ALTERNATIVE:${PN} = "ntpd" |
| 129 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" |