diff options
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux_2.37.1.bb')
| -rw-r--r-- | meta/recipes-core/util-linux/util-linux_2.37.1.bb | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux_2.37.1.bb b/meta/recipes-core/util-linux/util-linux_2.37.1.bb new file mode 100644 index 0000000000..b67c3dcb53 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux_2.37.1.bb | |||
| @@ -0,0 +1,290 @@ | |||
| 1 | require util-linux.inc | ||
| 2 | |||
| 3 | #gtk-doc is not enabled as it requires xmlto which requires util-linux | ||
| 4 | inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest | ||
| 5 | DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid" | ||
| 6 | |||
| 7 | PACKAGES =+ "${PN}-swaponoff" | ||
| 8 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}" | ||
| 9 | |||
| 10 | python util_linux_binpackages () { | ||
| 11 | def pkg_hook(f, pkg, file_regex, output_pattern, modulename): | ||
| 12 | pn = d.getVar('PN') | ||
| 13 | d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg) | ||
| 14 | |||
| 15 | if d.getVar('ALTERNATIVE:' + pkg): | ||
| 16 | return | ||
| 17 | if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): | ||
| 18 | d.setVar('ALTERNATIVE:' + pkg, modulename) | ||
| 19 | |||
| 20 | bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) | ||
| 21 | for dir in bindirs: | ||
| 22 | do_split_packages(d, root=dir, | ||
| 23 | file_regex=r'(.*)', output_pattern='${PN}-%s', | ||
| 24 | description='${PN} %s', | ||
| 25 | hook=pkg_hook, extra_depends='') | ||
| 26 | |||
| 27 | # There are some symlinks for some binaries which we have ignored | ||
| 28 | # above. Add them to the package owning the binary they are | ||
| 29 | # pointing to | ||
| 30 | extras = {} | ||
| 31 | dvar = d.getVar('PKGD') | ||
| 32 | for root in bindirs: | ||
| 33 | for walkroot, dirs, files in os.walk(dvar + root): | ||
| 34 | for f in files: | ||
| 35 | file = os.path.join(walkroot, f) | ||
| 36 | if not os.path.islink(file): | ||
| 37 | continue | ||
| 38 | |||
| 39 | pkg = os.path.basename(os.readlink(file)) | ||
| 40 | extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1) | ||
| 41 | |||
| 42 | pn = d.getVar('PN') | ||
| 43 | for pkg, links in extras.items(): | ||
| 44 | of = d.getVar('FILES:' + pn + '-' + pkg) | ||
| 45 | links = of + links | ||
| 46 | d.setVar('FILES:' + pn + '-' + pkg, links) | ||
| 47 | } | ||
| 48 | |||
| 49 | # we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS | ||
| 50 | PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages " | ||
| 51 | |||
| 52 | # skip libuuid as it will be packaged by the util-linux-libuuid recipe | ||
| 53 | python util_linux_libpackages() { | ||
| 54 | do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$', | ||
| 55 | output_pattern='${PN}-lib%s', | ||
| 56 | description='${PN} lib%s', | ||
| 57 | extra_depends='', prepend=True, allow_links=True) | ||
| 58 | } | ||
| 59 | |||
| 60 | PACKAGESPLITFUNCS =+ "util_linux_libpackages" | ||
| 61 | |||
| 62 | PACKAGES_DYNAMIC = "^${PN}-.*" | ||
| 63 | |||
| 64 | CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" | ||
| 65 | UTIL_LINUX_LIBDIR = "${libdir}" | ||
| 66 | UTIL_LINUX_LIBDIR:class-target = "${base_libdir}" | ||
| 67 | EXTRA_OECONF = "\ | ||
| 68 | --enable-libuuid --enable-libblkid \ | ||
| 69 | \ | ||
| 70 | --enable-fsck --enable-kill --enable-last --enable-mesg \ | ||
| 71 | --enable-mount --enable-partx --enable-raw --enable-rfkill \ | ||
| 72 | --enable-unshare --enable-write \ | ||
| 73 | \ | ||
| 74 | --disable-bfs --disable-login \ | ||
| 75 | --disable-makeinstall-chown --disable-minix --disable-newgrp \ | ||
| 76 | --disable-use-tty-group --disable-vipw \ | ||
| 77 | \ | ||
| 78 | --without-udev \ | ||
| 79 | \ | ||
| 80 | usrsbin_execdir='${sbindir}' \ | ||
| 81 | --libdir='${UTIL_LINUX_LIBDIR}' \ | ||
| 82 | " | ||
| 83 | |||
| 84 | EXTRA_OECONF:append:class-target = " --enable-setpriv" | ||
| 85 | EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv" | ||
| 86 | EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv" | ||
| 87 | EXTRA_OECONF:append = " --disable-hwclock-gplv3" | ||
| 88 | |||
| 89 | # enable pcre2 for native/nativesdk to match host distros | ||
| 90 | # this helps to keep same expectations when using the SDK or | ||
| 91 | # build host versions during development | ||
| 92 | # | ||
| 93 | PACKAGECONFIG ?= "pcre2" | ||
| 94 | PACKAGECONFIG:class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}" | ||
| 95 | PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam," | ||
| 96 | # Respect the systemd feature for uuidd | ||
| 97 | PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd" | ||
| 98 | # Build python bindings for libmount | ||
| 99 | PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3" | ||
| 100 | # Readline support | ||
| 101 | PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" | ||
| 102 | # PCRE support in hardlink | ||
| 103 | PACKAGECONFIG[pcre2] = ",,libpcre2" | ||
| 104 | PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" | ||
| 105 | PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh," | ||
| 106 | |||
| 107 | EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" | ||
| 108 | |||
| 109 | ALLOW_EMPTY:${PN} = "1" | ||
| 110 | FILES:${PN} = "" | ||
| 111 | FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*" | ||
| 112 | FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" | ||
| 113 | FILES:${PN}-mount = "${sysconfdir}/default/mountall" | ||
| 114 | FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*" | ||
| 115 | FILES:${PN}-su = "${sysconfdir}/pam.d/su-l" | ||
| 116 | CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l" | ||
| 117 | FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ | ||
| 118 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ | ||
| 119 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" | ||
| 120 | |||
| 121 | # Util-linux' blkid replaces the e2fsprogs one | ||
| 122 | RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" | ||
| 123 | RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" | ||
| 124 | |||
| 125 | RRECOMMENDS:${PN}:class-native = "" | ||
| 126 | RRECOMMENDS:${PN}:class-nativesdk = "" | ||
| 127 | RDEPENDS:${PN}:class-native = "" | ||
| 128 | RDEPENDS:${PN}:class-nativesdk = "" | ||
| 129 | |||
| 130 | RDEPENDS:${PN} += " util-linux-libuuid" | ||
| 131 | RDEPENDS:${PN}-dev += " util-linux-libuuid-dev" | ||
| 132 | |||
| 133 | RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev" | ||
| 134 | |||
| 135 | RDEPENDS:${PN}-bash-completion += "${PN}-lsblk" | ||
| 136 | RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod mdadm procps sed socat which xz" | ||
| 137 | RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop" | ||
| 138 | RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" | ||
| 139 | ALLOW_EMPTY:${PN}-swaponoff = "1" | ||
| 140 | |||
| 141 | #SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" | ||
| 142 | SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service" | ||
| 143 | SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable" | ||
| 144 | SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service" | ||
| 145 | SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable" | ||
| 146 | |||
| 147 | do_install () { | ||
| 148 | # with ccache the timestamps on compiled files may | ||
| 149 | # end up earlier than on their inputs, this allows | ||
| 150 | # for the resultant compilation in the install step. | ||
| 151 | oe_runmake 'CC=${CC}' 'LD=${LD}' \ | ||
| 152 | 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install | ||
| 153 | |||
| 154 | mkdir -p ${D}${base_bindir} | ||
| 155 | |||
| 156 | sbinprogs="agetty ctrlaltdel cfdisk vipw vigr" | ||
| 157 | sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin" | ||
| 158 | binprogs_a="dmesg getopt kill more umount mount login su mountpoint" | ||
| 159 | |||
| 160 | if [ "${base_sbindir}" != "${sbindir}" ]; then | ||
| 161 | mkdir -p ${D}${base_sbindir} | ||
| 162 | for p in $sbinprogs $sbinprogs_a; do | ||
| 163 | if [ -f "${D}${sbindir}/$p" ]; then | ||
| 164 | mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p" | ||
| 165 | fi | ||
| 166 | done | ||
| 167 | fi | ||
| 168 | |||
| 169 | if [ "${base_bindir}" != "${bindir}" ]; then | ||
| 170 | mkdir -p ${D}${base_bindir} | ||
| 171 | for p in $binprogs_a; do | ||
| 172 | if [ -f "${D}${bindir}/$p" ]; then | ||
| 173 | mv "${D}${bindir}/$p" "${D}${base_bindir}/$p" | ||
| 174 | fi | ||
| 175 | done | ||
| 176 | fi | ||
| 177 | |||
| 178 | install -d ${D}${sysconfdir}/default/ | ||
| 179 | echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall | ||
| 180 | |||
| 181 | rm -f ${D}${bindir}/chkdupexe | ||
| 182 | } | ||
| 183 | |||
| 184 | do_install:append:class-target () { | ||
| 185 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then | ||
| 186 | install -d ${D}${sysconfdir}/pam.d | ||
| 187 | install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser | ||
| 188 | install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l | ||
| 189 | # Required for "su -" aka "su --login" because | ||
| 190 | # otherwise it uses "other", which has "auth pam_deny.so" | ||
| 191 | # and thus prevents the operation. | ||
| 192 | ln -s su ${D}${sysconfdir}/pam.d/su-l | ||
| 193 | fi | ||
| 194 | } | ||
| 195 | # nologin causes a conflict with shadow-native | ||
| 196 | # kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) | ||
| 197 | do_install:append:class-native () { | ||
| 198 | rm -f ${D}${base_sbindir}/nologin | ||
| 199 | rm -f ${D}${base_bindir}/kill | ||
| 200 | } | ||
| 201 | |||
| 202 | # dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds | ||
| 203 | # Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it | ||
| 204 | do_install:append () { | ||
| 205 | rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid* | ||
| 206 | } | ||
| 207 | |||
| 208 | ALTERNATIVE_PRIORITY = "80" | ||
| 209 | |||
| 210 | ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" | ||
| 211 | ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" | ||
| 212 | ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" | ||
| 213 | ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn" | ||
| 214 | ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh" | ||
| 215 | ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" | ||
| 216 | ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" | ||
| 217 | ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" | ||
| 218 | ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" | ||
| 219 | ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" | ||
| 220 | ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" | ||
| 221 | ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" | ||
| 222 | ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" | ||
| 223 | ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" | ||
| 224 | ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" | ||
| 225 | ALTERNATIVE:${PN}-agetty = "getty" | ||
| 226 | ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" | ||
| 227 | ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" | ||
| 228 | ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" | ||
| 229 | ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" | ||
| 230 | ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" | ||
| 231 | ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" | ||
| 232 | ALTERNATIVE:${PN}-last = "last lastb" | ||
| 233 | ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" | ||
| 234 | ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" | ||
| 235 | ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" | ||
| 236 | ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup" | ||
| 237 | ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg" | ||
| 238 | ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap" | ||
| 239 | ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie" | ||
| 240 | ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more" | ||
| 241 | ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount" | ||
| 242 | ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint" | ||
| 243 | ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin" | ||
| 244 | ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter" | ||
| 245 | ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root" | ||
| 246 | ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit" | ||
| 247 | ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile" | ||
| 248 | ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice" | ||
| 249 | ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" | ||
| 250 | ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" | ||
| 251 | ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" | ||
| 252 | ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" | ||
| 253 | ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" | ||
| 254 | ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" | ||
| 255 | ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin" | ||
| 256 | ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff" | ||
| 257 | ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon" | ||
| 258 | ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root" | ||
| 259 | ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset" | ||
| 260 | ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount" | ||
| 261 | ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare" | ||
| 262 | ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump" | ||
| 263 | ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" | ||
| 264 | ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" | ||
| 265 | |||
| 266 | BBCLASSEXTEND = "native nativesdk" | ||
| 267 | |||
| 268 | PTEST_BINDIR = "1" | ||
| 269 | do_compile_ptest() { | ||
| 270 | oe_runmake buildtest-TESTS | ||
| 271 | } | ||
| 272 | |||
| 273 | do_install_ptest() { | ||
| 274 | mkdir -p ${D}${PTEST_PATH}/tests/ts | ||
| 275 | find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
| 276 | find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
| 277 | find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; | ||
| 278 | |||
| 279 | cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/ | ||
| 280 | cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected | ||
| 281 | cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ | ||
| 282 | cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} | ||
| 283 | |||
| 284 | sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest | ||
| 285 | |||
| 286 | # chfn needs PAM | ||
| 287 | if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then | ||
| 288 | rm -rf ${D}${PTEST_PATH}/tests/ts/chfn | ||
| 289 | fi | ||
| 290 | } | ||
