Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # This file contains content which was not automatically generated using cargo-bitbake on the cargo.toml file of uutils-coreutils |
| 2 | # Copyright (c) 2022, Snap Inc. |
| 3 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 4 | |
| 5 | PROVIDES = "coreutils" |
| 6 | RPROVIDES:${PN} = "coreutils" |
| 7 | |
| 8 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" |
| 9 | |
| 10 | PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" |
| 11 | |
| 12 | CARGO_BUILD_FLAGS += "--features unix" |
| 13 | CARGO_BUILD_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', '--features feat_selinux', '', d)}" |
| 14 | |
| 15 | DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'clang-native libselinux-native', '', d)}" |
| 16 | |
| 17 | export LIBCLANG_PATH = "${WORKDIR}/recipe-sysroot-native${libdir}" |
| 18 | export SELINUX_LIB_DIR = "${WORKDIR}/recipe-sysroot-native${libdir}" |
| 19 | export SELINUX_INCLUDE_DIR = "${WORKDIR}/recipe-sysroot-native${includedir}" |
| 20 | |
| 21 | # The code which follows is strongly inspired from the GNU coreutils bitbake recipe: |
| 22 | |
| 23 | # [ df mktemp nice printenv base64 gets a special treatment and is not included in this |
| 24 | bindir_progs = "[ arch basename cksum comm csplit cut dir dircolors dirname du \ |
| 25 | env expand expr factor fmt fold groups head hostid id install \ |
| 26 | join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ |
| 27 | pinky pr printf ptx readlink realpath seq sha1sum sha224sum sha256sum \ |
| 28 | sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ |
| 29 | tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" |
| 30 | |
| 31 | bindir_progs += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'chcon runcon', '', d)}" |
| 32 | |
| 33 | base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ |
| 34 | mknod mv pwd rm rmdir sleep stty sync touch true uname stat" |
| 35 | |
| 36 | sbindir_progs= "chroot" |
| 37 | |
| 38 | inherit update-alternatives |
| 39 | |
| 40 | # Higher than busybox (which uses 50) |
| 41 | ALTERNATIVE_PRIORITY = "100" |
| 42 | |
| 43 | # Higher than net-tools (which uses 100) |
| 44 | ALTERNATIVE_PRIORITY[hostname] = "110" |
| 45 | |
| 46 | ALTERNATIVE:${PN} = "${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" |
| 47 | |
| 48 | # Use the multicall binary named "coreutils" for symlinks |
| 49 | ALTERNATIVE_TARGET = "${bindir}/coreutils" |
| 50 | |
| 51 | python __anonymous() { |
| 52 | for prog in d.getVar('base_bindir_progs').split(): |
| 53 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) |
| 54 | |
| 55 | for prog in d.getVar('sbindir_progs').split(): |
| 56 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) |
| 57 | } |