Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty manpage generated if help2man does not exist #58

Open
tomparkin opened this issue Sep 4, 2024 · 0 comments
Open

Empty manpage generated if help2man does not exist #58

tomparkin opened this issue Sep 4, 2024 · 0 comments

Comments

@tomparkin
Copy link

tomparkin commented Sep 4, 2024

Due to the Makefile's use of a pipe to generate mons.1.gz, if help2man is not installed locally then the build apparently succeeds but generates an empty manpage:

$ rm mons.1.gz
$ make mons.1.gz
help2man -N -n "POSIX Shell script to quickly manage 2-monitors display." -h -h -v -v ./mons.sh | gzip - > mons.1.gz
/bin/sh: 1: help2man: not found
$ echo $?
0
$ ls -l mons.1.gz
-rw-rw-r-- 1 tom tom 20 Sep  4 15:08 mons.1.gz

I fixed this by adding a check for help2man:

diff --git a/Makefile b/Makefile
index b04ba89..69ad61f 100644
--- a/Makefile
+++ b/Makefile
@@ -27,11 +27,14 @@ install: $(LIB) $(MANPAGE)
        cp $(SCRIPT) $(BINDIR)/$(PKGNAME)
        sed -i -e "s#%LIBDIR%#$(LIBDIR)#" $(BINDIR)/$(PKGNAME)
 
-$(MANPAGE):
+check_help2man:
+       which help2man
+
+$(MANPAGE): check_help2man
        help2man -N -n "$(PKGDESC)" -h -h -v -v ./$(SCRIPT) | gzip - > $@
 
 uninstall:
        $(RM) -r $(LICENSEDIR) $(LIBDIR)
        $(RM) $(MANDIR)/$(MANPAGE) $(BINDIR)/$(PKGNAME)
 
-.PHONY: install uninstall
+.PHONY: install uninstall check_help2man

This then causes the build to fail in a more obvious fashion if help2man is not installed:

$ make mons.1.gz
which help2man
make: *** [Makefile:31: check_help2man] Error 1
$ ls mons.1.gz
ls: cannot access 'mons.1.gz': No such file or directory
$ sudo apt install help2man
$ make mons.1.gz
which help2man
/usr/bin/help2man
help2man -N -n "POSIX Shell script to quickly manage 2-monitors display." -h -h -v -v ./mons.sh | gzip - > mons.1.gz$ ls -l mons.1.gz
-rw-rw-r-- 1 tom tom 1148 Sep  4 15:13 mons.1.gz
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

No branches or pull requests

1 participant