Skip to content

Embed manpages into the binaries#93

Merged
haesbaert merged 1 commit into
mainfrom
man-embedder
Oct 28, 2024
Merged

Embed manpages into the binaries#93
haesbaert merged 1 commit into
mainfrom
man-embedder

Conversation

@haesbaert
Copy link
Copy Markdown
Collaborator

With this invoking one of the utilities with -h will display the manpage.

Since quark is not a "system utility", we can't expect people to go to the trouble of installing manpages, and typing man ./quark-mon.8 is a pain. It's also likely that the binary is sent somewhere and thus the man relationship was lost.

I had to write a mini-utility to embed the manpage, it's a bit sad that there isn't a mandoc -T c to export the manpage as a C struct.

@haesbaert haesbaert requested a review from a team as a code owner October 28, 2024 14:42
Comment thread quark-test.c
Comment thread quark-mon.c
Comment thread quark-btf.c
Comment thread display_man.c Outdated
Comment thread man-embedder.c
@haesbaert
Copy link
Copy Markdown
Collaborator Author

Oh this breaks the arm64 cross compilation, I'll work on a fix

With this invoking one of the utilities with `-h` will display the manpage.

Since quark is not a "system utility", we can't expect people to go to the
trouble of installing manpages, and typing `man ./quark-mon.8` is a pain. It's
also likely that the binary is sent somewhere and thus the man relationship was
lost.

I had to write a mini-utility to embed the manpage, it's a bit sad that there
isn't a `mandoc -T c` to export the manpage as a C struct.

Arm64 cross compilation gets a little bit trickier:

In order to build quark-mon, quark-btf and quark-test, it needs to build
manpage.h, and to build manpage.h it needs to build man-embedder. But it can't
build man-embedder for arm64, since we must be able to execute it!

We fix it by cheating the order build, we force manpages.h to be evaluated
before `all` in the host system. Which pulls man-embedder for the host and
generates manpage.h. The only drawback is that man-embedder will stay built for
the host system, which is fine since it's a build-system executable.
@haesbaert haesbaert merged commit e34ddae into main Oct 28, 2024
@haesbaert haesbaert deleted the man-embedder branch November 12, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants