Skip to content

Commit 298b404

Browse files
fcunyJohan-Liebert1
authored andcommitted
build: Add DISABLE_DOCS to skip man pages
When bootc is built from source and its `make install` tree is copied into a minimized image, the man pages end up in an image that excludes documentation everywhere else: Fedora container images set `tsflags=nodocs` for dnf, Ubuntu minimized images exclude /usr/share/man for dpkg. A distro package goes through that filter, a source build doesn't, so the Makefile is where that choice has to be made. Setting DISABLE_DOCS=1 skips generating and installing the man pages. This also skips the extra docgen-featured build of bootc, and the dependency on go-md2man. The name and check follow skopeo's Makefile, which has the same switch. The default is unchanged, so packaging isn't affected. Files under /usr/share/doc/bootc are still installed: they're base image configuration, not documentation. While there, add the missing section 7 to the man page directories listed in the packaging docs. Moving the man pages to a separate install target was considered and discarded: the man pages have to be built before the binary, so that the production build overwrites the docgen one in target/release (see e747216, "cli: Fix rhsm feature propagation and manpage build order"). Assisted-by: AI Signed-off-by: Franck Cuny <franck@fcuny.net>
1 parent 6af0131 commit 298b404

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎Makefile‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,21 @@ CARGO_FEATURES ?= $(CARGO_FEATURES_DEFAULT)
4949
# again. The unit test targets (install-unit-tests) don't use this and always
5050
# build with the default features.
5151
CARGO_OPTIONS ?= --features "$(CARGO_FEATURES)"
52+
# Set to 1 to skip generating and installing man pages, e.g. for source
53+
# builds into images that exclude documentation:
54+
# make install DISABLE_DOCS=1
55+
# This doesn't affect $(prefix)/share/doc/bootc/baseimage, which holds base
56+
# image configuration rather than documentation.
57+
DISABLE_DOCS ?=
5258

5359
# Build all binaries
5460
.PHONY: bin
61+
# The man pages are built first so that the production binary below
62+
# overwrites the docgen-featured one in target/release.
63+
ifneq ($(DISABLE_DOCS),1)
5564
bin: manpages
65+
endif
66+
bin:
5667
cargo build --release $(CARGO_OPTIONS) --bins
5768

5869
# The docgen feature this adds implies install-to-disk, so the man pages
@@ -77,9 +88,11 @@ install: completion
7788
ln -s "$(STORAGE_RELATIVE_PATH)" "$(DESTDIR)$(prefix)/lib/bootc/storage"
7889
install -D -m 0755 crates/cli/bootc-generator-stub $(DESTDIR)$(prefix)/lib/systemd/system-generators/bootc-systemd-generator
7990
install -d $(DESTDIR)$(prefix)/lib/bootc/install
91+
ifneq ($(DISABLE_DOCS),1)
8092
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man5 target/man/*.5
8193
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man7 target/man/*.7
8294
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man8 target/man/*.8
95+
endif
8396
install -D -m 0644 target/completion/bootc.bash $(DESTDIR)$(prefix)/share/bash-completion/completions/bootc
8497
install -D -m 0644 target/completion/bootc.elvish $(DESTDIR)$(prefix)/share/elvish/lib/bootc.elv
8598
install -D -m 0644 target/completion/bootc.fish $(DESTDIR)$(prefix)/share/fish/vendor_completions.d/bootc.fish

‎docs/src/bootc-packaging-and-integration.7.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,23 @@ make install DESTDIR=/path/to/staging/root
3535

3636
The install target handles:
3737
- Binary installation to `$(prefix)/bin`
38-
- Man pages to `$(prefix)/share/man/man{5,8}`
38+
- Man pages to `$(prefix)/share/man/man{5,7,8}`
3939
- systemd units to `$(prefix)/lib/systemd/system`
4040
- Documentation and examples to `$(prefix)/share/doc/bootc`
4141
- Dracut module to `/usr/lib/dracut/modules.d/51bootc`
4242
- Base image configuration files
4343

44+
To skip building and installing the man pages, for example when building
45+
from source into a container image that excludes documentation, set
46+
`DISABLE_DOCS=1`:
47+
48+
```bash
49+
make install DISABLE_DOCS=1 DESTDIR=/path/to/staging/root
50+
```
51+
52+
This also drops the build-time dependency on `go-md2man`. The base image
53+
files under `$(prefix)/share/doc/bootc` are still installed.
54+
4455
### Optional Installation Targets
4556

4657
#### install-ostree-hooks

0 commit comments

Comments
 (0)