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" |
| 5 | LIC_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 | |
| 10 | DEPENDS += "bison-native \ |
| 11 | openssl \ |
| 12 | python3" |
| 13 | |
| 14 | SRC_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 | |
| 21 | SRC_URI[sha256sum] = "f2684835116c80b8f21782a5959a805ba3c44e3a681dd6c17c7cb00cc242c27a" |
| 22 | |
| 23 | inherit pkgconfig python3-dir python3targetconfig systemd update-alternatives update-rc.d useradd waf features_check |
| 24 | |
| 25 | # RDEPENDS on gnuplot with this restriction |
| 26 | REQUIRED_DISTRO_FEATURES = "x11" |
| 27 | |
| 28 | PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'seccomp systemd', d)} \ |
| 29 | cap \ |
| 30 | leap-smear \ |
| 31 | mdns \ |
| 32 | mssntp \ |
| 33 | nts \ |
| 34 | refclocks" |
| 35 | |
| 36 | PACKAGECONFIG:remove:riscv32 = "seccomp" |
| 37 | |
| 38 | PACKAGECONFIG[cap] = ",,libcap" |
| 39 | PACKAGECONFIG[docs] = "--enable-doc --enable-manpage,--disable-doc --disable-manpage," |
| 40 | PACKAGECONFIG[leap-smear] = "--enable-leap-smear" |
| 41 | PACKAGECONFIG[mdns] = ",,mdns" |
| 42 | PACKAGECONFIG[mssntp] = "--enable-mssntp" |
| 43 | PACKAGECONFIG[nts] = ",--disable-nts" |
| 44 | PACKAGECONFIG[refclocks] = "--refclock=all,,pps-tools" |
| 45 | PACKAGECONFIG[seccomp] = "--enable-seccomp,,libseccomp" |
| 46 | PACKAGECONFIG[systemd] = ",,systemd" |
| 47 | |
| 48 | CC[unexport] = "1" |
| 49 | CFLAGS[unexport] = "1" |
| 50 | LDFLAGS[unexport] = "1" |
| 51 | |
| 52 | export PYTHON_VERSION = "${PYTHON_BASEVERSION}" |
| 53 | export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}" |
| 54 | export pyext_PATTERN = "%s.so" |
| 55 | export PYTHON_LDFLAGS = "-lpthread -ldl" |
| 56 | |
| 57 | CFLAGS:append = " -I${PYTHON_INCLUDE_DIR}" |
| 58 | |
| 59 | EXTRA_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 | |
| 69 | EXTRA_OEWAF_BUILD ?= "-v" |
| 70 | |
| 71 | NTP_USER_HOME ?= "/var/lib/ntp" |
| 72 | |
| 73 | do_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 | |
| 88 | PACKAGE_BEFORE_PN = "${PN}-python ${PN}-utils ${PN}-viz" |
| 89 | |
| 90 | FILES:${PN} += "${nonarch_libdir}/tmpfiles.d/ntpsec.conf" |
| 91 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR} \ |
| 92 | ${libdir}/libntpc.so.*" |
| 93 | FILES:${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" |
| 102 | FILES:${PN}-viz = "${bindir}/ntplogtemp \ |
| 103 | ${bindir}/ntpviz" |
| 104 | |
| 105 | RDEPENDS:${PN} += "libgcc" |
| 106 | RDEPENDS:${PN}-utils += "${PN}-python python3-core" |
| 107 | RDEPENDS:${PN}-viz += "gnuplot ${PN}-python python3-core python3-compression python3-ctypes python3-logging python3-shell" |
| 108 | |
| 109 | USERADD_PACKAGES = "${PN}" |
| 110 | USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ |
| 111 | --no-create-home \ |
| 112 | --shell /bin/false --user-group ntp" |
| 113 | |
| 114 | INITSCRIPT_NAME = "ntpd" |
| 115 | |
| 116 | SYSTEMD_PACKAGES = "${PN} ${PN}-viz" |
| 117 | SYSTEMD_SERVICE:${PN} = "ntpd.service ntp-wait.service" |
| 118 | SYSTEMD_SERVICE:${PN}-viz = "ntplogtemp.service ntpviz-weekly.timer ntpviz-weekly.service ntpviz-daily.timer ntpviz-daily.service ntplogtemp.timer" |
| 119 | |
| 120 | ALTERNATIVE_PRIORITY = "80" |
| 121 | |
| 122 | ALTERNATIVE:${PN} = "ntpd" |
| 123 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" |