Use external libstdbuf.so when building with make, as embedding the library
is only needed to work around "cargo install" limitations with shared libraries.
Also change default installation directory to /usr/local/libexec/coreutils/ for consistency
with GNU coreutils
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
When packaging uutils for Conda-Forge and a cross-compiled architecture,
the install of completion scripts and manpages fails with the following
error.
> .../coreutils manpage arch > .../man/arch.1
> /bin/sh: .../coreutils: Bad CPU type in executable
> make: *** [GNUmakefile:349: manpages] Error 126
When cross-compiling, the `coreutils` tool will be for a different
architecture then the build platform. So we won't be able to extract the
manpages and completions.
Provide build arguments that let us skip the build and install of
manpages and completions.
When packaging uutils for Conda-Forge, the install of completion scripts
fails with the following error.
make: /bin/sh: Argument list too long
The completion scripts are installed with a `foreach` loop that expands
into a single long command. That command hits the maximum argument
length on the build platform used by Conda-Forge.
To fix, we change the Make command to split each install into a seperate
command. This is done by embedding a newline in the command. See the
following for an example of how this works.
https://www.extrema.is/blog/2021/12/17/makefile-foreach-commands
This makes it easier to install binaries into an arch-dependent
directory (e.g. /usr/${host}/bin) while keeping arch-independent files
like the shell completions under /usr/share by specifying e.g.
PREFIX=/usr/${host} and DATAROOTDIR=/usr/share
The ToDo list was updated to mark `chcon` as done.
Building and testing `chcon` requires enabling the `feat_selinux` feature. If `make` is used for building, then please specify `SELINUX_ENABLED=1` if building and testing on a system where SELinux is not enabled.
This adds a hidden `completion` subcommand to coreutils. When invoked with
`coreutils completion <utility> <shell>` a completion file will be printed
to stdout. When running `make install` those files will be created for all
utilities and copied to the appropriate locations.
`make install` will install completions for zsh, fish and bash; however,
clap also supports generating completions for powershell and elvish.
With this patch all utilities are required to have a publich uu_app function
that returns a clap::App in addition to the uumain function.