1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

GNUmakefile: support skipping manpages and completions

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.
This commit is contained in:
Brandon Maier 2025-02-17 12:45:40 -06:00
parent b186f1f00f
commit 9082f9ba57
2 changed files with 33 additions and 14 deletions

View file

@ -3,6 +3,8 @@
# Config options # Config options
PROFILE ?= debug PROFILE ?= debug
MULTICALL ?= n MULTICALL ?= n
COMPLETIONS ?= y
MANPAGES ?= y
INSTALL ?= install INSTALL ?= install
ifneq (,$(filter install, $(MAKECMDGOALS))) ifneq (,$(filter install, $(MAKECMDGOALS)))
override PROFILE:=release override PROFILE:=release
@ -343,12 +345,23 @@ clean:
distclean: clean distclean: clean
$(CARGO) clean $(CARGOFLAGS) && $(CARGO) update $(CARGOFLAGS) $(CARGO) clean $(CARGOFLAGS) && $(CARGO) update $(CARGOFLAGS)
ifeq ($(MANPAGES),y)
manpages: build-coreutils manpages: build-coreutils
mkdir -p $(BUILDDIR)/man/ mkdir -p $(BUILDDIR)/man/
$(foreach prog, $(INSTALLEES), \ $(foreach prog, $(INSTALLEES), \
$(BUILDDIR)/coreutils manpage $(prog) > $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1 $(newline) \ $(BUILDDIR)/coreutils manpage $(prog) > $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1 $(newline) \
) )
install-manpages: manpages
mkdir -p $(DESTDIR)$(DATAROOTDIR)/man/man1
$(foreach prog, $(INSTALLEES), \
$(INSTALL) $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1 $(DESTDIR)$(DATAROOTDIR)/man/man1/ $(newline) \
)
else
install-manpages:
endif
ifeq ($(COMPLETIONS),y)
completions: build-coreutils completions: build-coreutils
mkdir -p $(BUILDDIR)/completions/zsh $(BUILDDIR)/completions/bash $(BUILDDIR)/completions/fish mkdir -p $(BUILDDIR)/completions/zsh $(BUILDDIR)/completions/bash $(BUILDDIR)/completions/fish
$(foreach prog, $(INSTALLEES), \ $(foreach prog, $(INSTALLEES), \
@ -357,7 +370,20 @@ completions: build-coreutils
$(BUILDDIR)/coreutils completion $(prog) fish > $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish $(newline) \ $(BUILDDIR)/coreutils completion $(prog) fish > $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish $(newline) \
) )
install: build manpages completions install-completions: completions
mkdir -p $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions
mkdir -p $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions
mkdir -p $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d
$(foreach prog, $(INSTALLEES), \
$(INSTALL) $(BUILDDIR)/completions/zsh/_$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/ $(newline) \
$(INSTALL) $(BUILDDIR)/completions/bash/$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/ $(newline) \
$(INSTALL) $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/ $(newline) \
)
else
install-completions:
endif
install: build install-manpages install-completions
mkdir -p $(INSTALLDIR_BIN) mkdir -p $(INSTALLDIR_BIN)
ifeq (${MULTICALL}, y) ifeq (${MULTICALL}, y)
$(INSTALL) $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils $(INSTALL) $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils
@ -371,19 +397,6 @@ else
) )
$(if $(findstring test,$(INSTALLEES)), $(INSTALL) $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[) $(if $(findstring test,$(INSTALLEES)), $(INSTALL) $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[)
endif endif
mkdir -p $(DESTDIR)$(DATAROOTDIR)/man/man1
$(foreach prog, $(INSTALLEES), \
$(INSTALL) $(BUILDDIR)/man/$(PROG_PREFIX)$(prog).1 $(DESTDIR)$(DATAROOTDIR)/man/man1/ $(newline) \
)
mkdir -p $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions
mkdir -p $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions
mkdir -p $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d
$(foreach prog, $(INSTALLEES), \
$(INSTALL) $(BUILDDIR)/completions/zsh/_$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/ $(newline) \
$(INSTALL) $(BUILDDIR)/completions/bash/$(PROG_PREFIX)$(prog) $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/ $(newline) \
$(INSTALL) $(BUILDDIR)/completions/fish/$(PROG_PREFIX)$(prog).fish $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/ $(newline) \
)
uninstall: uninstall:
ifeq (${MULTICALL}, y) ifeq (${MULTICALL}, y)

View file

@ -223,6 +223,12 @@ Installing with `make` installs shell completions for all installed utilities
for `bash`, `fish` and `zsh`. Completions for `elvish` and `powershell` can also for `bash`, `fish` and `zsh`. Completions for `elvish` and `powershell` can also
be generated; See `Manually install shell completions`. be generated; See `Manually install shell completions`.
To skip installation of completions and manpages:
```shell
make COMPLETIONS=n MANPAGES=n install
```
### Manually install shell completions ### Manually install shell completions
The `coreutils` binary can generate completions for the `bash`, `elvish`, The `coreutils` binary can generate completions for the `bash`, `elvish`,