diff --git a/meta-oe/conf/layer.conf b/meta-oe/conf/layer.conf index 34aa29561cc..6a0f05d9308 100644 --- a/meta-oe/conf/layer.conf +++ b/meta-oe/conf/layer.conf @@ -48,6 +48,8 @@ LICENSE_PATH += "${LAYERDIR}/licenses" PREFERRED_RPROVIDER_libdevmapper = "lvm2" PREFERRED_PROVIDER_android-tools-conf ?= "android-tools-conf" +# Configures whether coreutils or uutils-coreutils is used. +PREFERRED_PROVIDER_coreutils = "coreutils" SIGGEN_EXCLUDERECIPES_ABISAFE += " \ fbset-modes \ diff --git a/meta-oe/recipes-core/uutils-coreutils/README.txt b/meta-oe/recipes-core/uutils-coreutils/README.txt new file mode 100644 index 00000000000..cfd7b051b13 --- /dev/null +++ b/meta-oe/recipes-core/uutils-coreutils/README.txt @@ -0,0 +1,19 @@ +How to generate/update the file uutils-coreutils_XXX.bb: + +cargo with version > 1.60 is needed so cargo from Ubuntu's apt will not work +(because of https://github.com/rust-lang/cargo/issues/10623): +This package is needed (tested on Ubuntu 22.04): +sudo apt-get -y install librust-cargo+openssl-dev + +Then install cargo-bitbake with: +$ cargo install --locked cargo-bitbake + +You can now update coreutils: +$ git clone https://github.com/uutils/coreutils.git +$ cd coreutils +$ git tag +$ git checkout 0.0.XXX +$ cargo-bitbake bitbake +Wrote: coreutils_0.0.15.bb + +Verify manual changes in the bb file (rename coreutils.inc to uutils-coreutils.inc) diff --git a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils.inc b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils.inc new file mode 100644 index 00000000000..68cfa8178cf --- /dev/null +++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils.inc @@ -0,0 +1,57 @@ +# This file contains content which was not automatically generated using cargo-bitbake on the cargo.toml file of uutils-coreutils +# Copyright (c) 2022, Snap Inc. +# Released under the MIT license (see COPYING.MIT for the terms) + +PROVIDES = "coreutils" +RPROVIDES:${PN} = "coreutils" + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" + +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" + +CARGO_BUILD_FLAGS += "--features unix" +CARGO_BUILD_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', '--features feat_selinux', '', d)}" + +DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'clang-native libselinux-native', '', d)}" + +export LIBCLANG_PATH = "${WORKDIR}/recipe-sysroot-native${libdir}" +export SELINUX_LIB_DIR = "${WORKDIR}/recipe-sysroot-native${libdir}" +export SELINUX_INCLUDE_DIR = "${WORKDIR}/recipe-sysroot-native${includedir}" + +# The code which follows is strongly inspired from the GNU coreutils bitbake recipe: + +# [ df mktemp nice printenv base64 gets a special treatment and is not included in this +bindir_progs = "[ arch basename cksum comm csplit cut dir dircolors dirname du \ + env expand expr factor fmt fold groups head hostid id install \ + join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ + pinky pr printf ptx readlink realpath seq sha1sum sha224sum sha256sum \ + sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ + tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" + +bindir_progs += "${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'chcon runcon', '', d)}" + +base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ + mknod mv pwd rm rmdir sleep stty sync touch true uname stat" + +sbindir_progs= "chroot" + +inherit update-alternatives + +# Higher than busybox (which uses 50) +ALTERNATIVE_PRIORITY = "100" + +# Higher than net-tools (which uses 100) +ALTERNATIVE_PRIORITY[hostname] = "110" + +ALTERNATIVE:${PN} = "${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" + +# Use the multicall binary named "coreutils" for symlinks +ALTERNATIVE_TARGET = "${bindir}/coreutils" + +python __anonymous() { + for prog in d.getVar('base_bindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) + + for prog in d.getVar('sbindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) +} diff --git a/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.15.bb b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.15.bb new file mode 100644 index 00000000000..07004635f01 --- /dev/null +++ b/meta-oe/recipes-core/uutils-coreutils/uutils-coreutils_0.0.15.bb @@ -0,0 +1,282 @@ +# Auto-Generated by cargo-bitbake 0.3.16 +# +inherit cargo + +# If this is git based prefer versioned ones if they exist +# DEFAULT_PREFERENCE = "-1" + +# how to get coreutils could be as easy as but default to a git checkout: +# SRC_URI += "crate://crates.io/coreutils/0.0.15" +SRC_URI += "git://github.com/uutils/coreutils.git;protocol=https;nobranch=1" +SRCREV = "5b6cd6146b40f5c1391cd812b1b929edd2283994" +S = "${WORKDIR}/git" +CARGO_SRC_DIR = "" + + +# please note if you have entries that do not begin with crate:// +# you must change them to how that package can be fetched +SRC_URI += " \ + crate://crates.io/Inflector/0.11.4 \ + crate://crates.io/adler/1.0.2 \ + crate://crates.io/ahash/0.7.6 \ + crate://crates.io/aho-corasick/0.7.18 \ + crate://crates.io/aliasable/0.1.3 \ + crate://crates.io/android_system_properties/0.1.4 \ + crate://crates.io/ansi_term/0.12.1 \ + crate://crates.io/arrayref/0.3.6 \ + crate://crates.io/arrayvec/0.7.2 \ + crate://crates.io/atty/0.2.14 \ + crate://crates.io/autocfg/1.1.0 \ + crate://crates.io/bigdecimal/0.3.0 \ + crate://crates.io/binary-heap-plus/0.4.1 \ + crate://crates.io/bindgen/0.59.2 \ + crate://crates.io/bitflags/1.3.2 \ + crate://crates.io/blake2b_simd/1.0.0 \ + crate://crates.io/blake3/1.3.1 \ + crate://crates.io/block-buffer/0.10.2 \ + crate://crates.io/bstr/0.2.17 \ + crate://crates.io/bumpalo/3.10.0 \ + crate://crates.io/byte-unit/4.0.14 \ + crate://crates.io/bytecount/0.6.3 \ + crate://crates.io/byteorder/1.4.3 \ + crate://crates.io/cc/1.0.73 \ + crate://crates.io/cexpr/0.6.0 \ + crate://crates.io/cfg-if/0.1.10 \ + crate://crates.io/cfg-if/1.0.0 \ + crate://crates.io/chrono/0.4.22 \ + crate://crates.io/clang-sys/1.3.3 \ + crate://crates.io/clap/2.34.0 \ + crate://crates.io/clap/3.2.17 \ + crate://crates.io/clap_complete/3.2.4 \ + crate://crates.io/clap_lex/0.2.4 \ + crate://crates.io/compare/0.1.0 \ + crate://crates.io/constant_time_eq/0.1.5 \ + crate://crates.io/conv/0.3.3 \ + crate://crates.io/core-foundation-sys/0.8.3 \ + crate://crates.io/coz/0.1.3 \ + crate://crates.io/cpp/0.5.7 \ + crate://crates.io/cpp_build/0.4.0 \ + crate://crates.io/cpp_common/0.4.0 \ + crate://crates.io/cpp_common/0.5.7 \ + crate://crates.io/cpp_macros/0.5.7 \ + crate://crates.io/cpp_syn/0.12.0 \ + crate://crates.io/cpp_synmap/0.3.0 \ + crate://crates.io/cpp_synom/0.12.0 \ + crate://crates.io/cpufeatures/0.2.2 \ + crate://crates.io/crc32fast/1.3.2 \ + crate://crates.io/crossbeam-channel/0.5.6 \ + crate://crates.io/crossbeam-deque/0.8.2 \ + crate://crates.io/crossbeam-epoch/0.9.10 \ + crate://crates.io/crossbeam-utils/0.8.11 \ + crate://crates.io/crossterm/0.25.0 \ + crate://crates.io/crossterm_winapi/0.9.0 \ + crate://crates.io/crypto-common/0.1.6 \ + crate://crates.io/ctor/0.1.23 \ + crate://crates.io/ctrlc/3.2.3 \ + crate://crates.io/custom_derive/0.1.7 \ + crate://crates.io/data-encoding-macro-internal/0.1.10 \ + crate://crates.io/data-encoding-macro/0.1.12 \ + crate://crates.io/data-encoding/2.3.2 \ + crate://crates.io/diff/0.1.13 \ + crate://crates.io/digest/0.10.3 \ + crate://crates.io/dlv-list/0.3.0 \ + crate://crates.io/dns-lookup/1.0.8 \ + crate://crates.io/dunce/1.0.2 \ + crate://crates.io/either/1.7.0 \ + crate://crates.io/env_logger/0.8.4 \ + crate://crates.io/env_logger/0.9.0 \ + crate://crates.io/exacl/0.9.0 \ + crate://crates.io/fastrand/1.8.0 \ + crate://crates.io/file_diff/1.0.0 \ + crate://crates.io/filetime/0.2.17 \ + crate://crates.io/flate2/1.0.24 \ + crate://crates.io/fnv/1.0.7 \ + crate://crates.io/fs_extra/1.2.0 \ + crate://crates.io/fsevent-sys/4.1.0 \ + crate://crates.io/fts-sys/0.2.1 \ + crate://crates.io/gcd/2.1.0 \ + crate://crates.io/generic-array/0.14.6 \ + crate://crates.io/getrandom/0.2.7 \ + crate://crates.io/glob/0.3.0 \ + crate://crates.io/half/1.8.2 \ + crate://crates.io/hashbrown/0.12.3 \ + crate://crates.io/heck/0.4.0 \ + crate://crates.io/hermit-abi/0.1.19 \ + crate://crates.io/hex-literal/0.3.4 \ + crate://crates.io/hex/0.4.3 \ + crate://crates.io/hostname/0.3.1 \ + crate://crates.io/humantime/2.1.0 \ + crate://crates.io/iana-time-zone/0.1.45 \ + crate://crates.io/indexmap/1.9.1 \ + crate://crates.io/inotify-sys/0.1.5 \ + crate://crates.io/inotify/0.9.6 \ + crate://crates.io/instant/0.1.12 \ + crate://crates.io/itertools/0.10.3 \ + crate://crates.io/itoa/1.0.3 \ + crate://crates.io/js-sys/0.3.59 \ + crate://crates.io/keccak/0.1.2 \ + crate://crates.io/kernel32-sys/0.2.2 \ + crate://crates.io/kqueue-sys/1.0.3 \ + crate://crates.io/kqueue/1.0.6 \ + crate://crates.io/lazy_static/1.4.0 \ + crate://crates.io/lazycell/1.3.0 \ + crate://crates.io/libc/0.2.132 \ + crate://crates.io/libloading/0.7.3 \ + crate://crates.io/lock_api/0.4.7 \ + crate://crates.io/log/0.4.17 \ + crate://crates.io/lscolors/0.12.0 \ + crate://crates.io/match_cfg/0.1.0 \ + crate://crates.io/md-5/0.10.1 \ + crate://crates.io/memchr/1.0.2 \ + crate://crates.io/memchr/2.5.0 \ + crate://crates.io/memmap2/0.5.7 \ + crate://crates.io/memoffset/0.6.5 \ + crate://crates.io/minimal-lexical/0.2.1 \ + crate://crates.io/miniz_oxide/0.5.3 \ + crate://crates.io/mio/0.8.4 \ + crate://crates.io/nix/0.25.0 \ + crate://crates.io/nom/7.1.1 \ + crate://crates.io/notify/5.0.0-pre.16 \ + crate://crates.io/num-bigint/0.4.3 \ + crate://crates.io/num-integer/0.1.45 \ + crate://crates.io/num-traits/0.2.15 \ + crate://crates.io/num_cpus/1.13.1 \ + crate://crates.io/num_threads/0.1.6 \ + crate://crates.io/number_prefix/0.4.0 \ + crate://crates.io/numtoa/0.1.0 \ + crate://crates.io/once_cell/1.13.1 \ + crate://crates.io/onig/6.3.2 \ + crate://crates.io/onig_sys/69.8.1 \ + crate://crates.io/ordered-multimap/0.4.3 \ + crate://crates.io/os_display/0.1.3 \ + crate://crates.io/os_str_bytes/6.0.1 \ + crate://crates.io/ouroboros/0.15.2 \ + crate://crates.io/ouroboros_macro/0.15.2 \ + crate://crates.io/output_vt100/0.1.3 \ + crate://crates.io/parking_lot/0.12.1 \ + crate://crates.io/parking_lot_core/0.9.3 \ + crate://crates.io/paste/1.0.8 \ + crate://crates.io/peeking_take_while/0.1.2 \ + crate://crates.io/phf/0.10.1 \ + crate://crates.io/phf_codegen/0.10.0 \ + crate://crates.io/phf_generator/0.10.0 \ + crate://crates.io/phf_shared/0.10.0 \ + crate://crates.io/pin-utils/0.1.0 \ + crate://crates.io/pkg-config/0.3.25 \ + crate://crates.io/platform-info/1.0.0 \ + crate://crates.io/ppv-lite86/0.2.16 \ + crate://crates.io/pretty_assertions/1.2.1 \ + crate://crates.io/proc-macro-error-attr/1.0.4 \ + crate://crates.io/proc-macro-error/1.0.4 \ + crate://crates.io/proc-macro2/1.0.43 \ + crate://crates.io/quick-error/2.0.1 \ + crate://crates.io/quickcheck/1.0.3 \ + crate://crates.io/quote/0.3.15 \ + crate://crates.io/quote/1.0.21 \ + crate://crates.io/rand/0.8.5 \ + crate://crates.io/rand_chacha/0.3.1 \ + crate://crates.io/rand_core/0.6.3 \ + crate://crates.io/rayon-core/1.9.3 \ + crate://crates.io/rayon/1.5.3 \ + crate://crates.io/redox_syscall/0.2.16 \ + crate://crates.io/redox_termios/0.1.2 \ + crate://crates.io/reference-counted-singleton/0.1.1 \ + crate://crates.io/regex-automata/0.1.10 \ + crate://crates.io/regex-syntax/0.6.27 \ + crate://crates.io/regex/1.6.0 \ + crate://crates.io/remove_dir_all/0.5.3 \ + crate://crates.io/remove_dir_all/0.7.0 \ + crate://crates.io/retain_mut/0.1.7 \ + crate://crates.io/rlimit/0.8.3 \ + crate://crates.io/rust-ini/0.18.0 \ + crate://crates.io/rustc-hash/1.1.0 \ + crate://crates.io/rustversion/1.0.9 \ + crate://crates.io/same-file/1.0.6 \ + crate://crates.io/scopeguard/1.1.0 \ + crate://crates.io/selinux-sys/0.5.2 \ + crate://crates.io/selinux/0.2.7 \ + crate://crates.io/sha1/0.10.1 \ + crate://crates.io/sha2/0.10.2 \ + crate://crates.io/sha3/0.10.2 \ + crate://crates.io/shlex/1.1.0 \ + crate://crates.io/signal-hook-mio/0.2.3 \ + crate://crates.io/signal-hook-registry/1.4.0 \ + crate://crates.io/signal-hook/0.3.14 \ + crate://crates.io/siphasher/0.3.10 \ + crate://crates.io/smallvec/1.9.0 \ + crate://crates.io/smawk/0.3.1 \ + crate://crates.io/socket2/0.4.4 \ + crate://crates.io/strsim/0.10.0 \ + crate://crates.io/strsim/0.8.0 \ + crate://crates.io/strum/0.24.1 \ + crate://crates.io/strum_macros/0.24.3 \ + crate://crates.io/subtle/2.4.1 \ + crate://crates.io/syn/1.0.99 \ + crate://crates.io/tempfile/3.3.0 \ + crate://crates.io/term_grid/0.1.7 \ + crate://crates.io/termcolor/1.1.3 \ + crate://crates.io/terminal_size/0.1.17 \ + crate://crates.io/termion/1.5.6 \ + crate://crates.io/termsize/0.1.6 \ + crate://crates.io/textwrap/0.11.0 \ + crate://crates.io/textwrap/0.15.0 \ + crate://crates.io/thiserror-impl/1.0.32 \ + crate://crates.io/thiserror/1.0.32 \ + crate://crates.io/time-macros/0.2.4 \ + crate://crates.io/time/0.3.9 \ + crate://crates.io/typenum/1.15.0 \ + crate://crates.io/unicode-ident/1.0.3 \ + crate://crates.io/unicode-linebreak/0.1.2 \ + crate://crates.io/unicode-segmentation/1.9.0 \ + crate://crates.io/unicode-width/0.1.9 \ + crate://crates.io/unicode-xid/0.0.4 \ + crate://crates.io/unindent/0.1.10 \ + crate://crates.io/unix_socket/0.5.0 \ + crate://crates.io/users/0.11.0 \ + crate://crates.io/utf-8/0.7.6 \ + crate://crates.io/utf8-width/0.1.6 \ + crate://crates.io/uuid/1.1.2 \ + crate://crates.io/vec_map/0.8.2 \ + crate://crates.io/version_check/0.9.4 \ + crate://crates.io/walkdir/2.3.2 \ + crate://crates.io/wasi/0.11.0+wasi-snapshot-preview1 \ + crate://crates.io/wasm-bindgen-backend/0.2.82 \ + crate://crates.io/wasm-bindgen-macro-support/0.2.82 \ + crate://crates.io/wasm-bindgen-macro/0.2.82 \ + crate://crates.io/wasm-bindgen-shared/0.2.82 \ + crate://crates.io/wasm-bindgen/0.2.82 \ + crate://crates.io/which/4.2.5 \ + crate://crates.io/wild/2.1.0 \ + crate://crates.io/winapi-build/0.1.1 \ + crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \ + crate://crates.io/winapi-util/0.1.5 \ + crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \ + crate://crates.io/winapi/0.2.8 \ + crate://crates.io/winapi/0.3.9 \ + crate://crates.io/windows-sys/0.36.1 \ + crate://crates.io/windows_aarch64_msvc/0.36.1 \ + crate://crates.io/windows_i686_gnu/0.36.1 \ + crate://crates.io/windows_i686_msvc/0.36.1 \ + crate://crates.io/windows_x86_64_gnu/0.36.1 \ + crate://crates.io/windows_x86_64_msvc/0.36.1 \ + crate://crates.io/xattr/0.2.3 \ + crate://crates.io/z85/3.0.5 \ + crate://crates.io/zip/0.6.2 \ +" + + + +# FIXME: update generateme with the real MD5 of the license file +LIC_FILES_CHKSUM = " \ + file://LICENSE;md5=41f7469eaacac62c67d5664fff2c062d \ +" + +SUMMARY = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" +HOMEPAGE = "https://github.com/uutils/coreutils" +LICENSE = "MIT" + +# includes this file if it exists but does not fail +# this is useful for anything you may want to override from +# what cargo-bitbake generates. +include uutils-coreutils-${PV}.inc +include uutils-coreutils.inc