Solved man page in Makefile

Hello,

I am creating a new port. The program is written in Go and the source has a man page (1). You can find it here: https://github.com/steffenfritz/mxcheck

I wrote a Makefile,
Bash:
make stage
and
Bash:
make stage-qa
are working without problems, everything's in place, i.e. the binary is in work/stage/usr/local/bin

However,
Code:
make package
fails with the missing man page:

Code:
===>  Building package for mxcheck-1.4.2_1
pkg-static: Unable to access file /usr/ports/security/mxcheck_freebsd/work/stage/usr/local/man/man1/mxcheck.1.gz:No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/ports/security/mxcheck_freebsd

I referenced the man page in PLIST_FILES, nothing else.

How can I copy the man page into its place? What is missing in the Makefile?

The Makefile:

Code:
PORTNAME=    mxcheck
DISTVERSIONPREFIX=    v
DISTVERSION=    1.4.2
PORTREVISION=    1
CATEGORIES=    security

MAINTAINER=    steffen@fritz.wtf
COMMENT=    Terminal based e-mail server configuration and DNS scanner
WWW=        https://github.com/steffenfritz/mxcheck

LICENSE=    GPLv3
LICENSE_FILE=    ${WRKSRC}/LICENSE

USES=        go:modules

GO_MODULE=    github.com/steffenfritz/mxcheck

PLIST_FILES=     bin/${PORTNAME} \
                  man/man1/mxcheck.1.gz

.include <bsd.port.mk>

EDIT: Indentation is ok, just messed up in the code snippet
 
Who is compressing the manpage, and when?
Good question. First attempt was without .gz suffix - because the man page is not compressed. In the porter's handbook all examples are with the suffix. So desperately I tried adding it, hoping for some magic.
 
Looks like an issue with the upstream install. Did you check what you end up in the stagedir with? Is the manpage installed in some wrong path, or not installed at all? If nothing else helps, you can add a post-install target to your port Makefile and copy the manpage manually where it should be, preferably using the INSTALL_MAN macro, see also https://docs.freebsd.org/en/books/porters-handbook/book/#install-macros
It is not installed at all.

Adding this post-install and keeping the .gz in PLIST_FILES, fixed the issue:

Code:
PLIST_FILES=    bin/${PORTNAME} \
        man/man1/mxcheck.1.gz

post-install:
    ${INSTALL_MAN} ${WRKSRC}/mxcheck.1 ${STAGEDIR}/usr/local/man/man1/


Thanks for the directions!
 
Steffen please replace /usr/local with ${LOCALBASE} or ${PREFIX}. I don't know if anybody ever used that, but there is sysctl user.localbase, so, don't hardcode the path for "local packages" :)
 
Steffen please replace /usr/local with ${LOCALBASE} or ${PREFIX}. I don't know if anybody ever used that, but there is sysctl user.localbase, so, don't hardcode the path for "local packages" :)
portlint told me this, too :) I had the feeling that hard coding is NOT the way...

Fixed it thanks again!
 
Steffen just a few hints if you're serious about ports development:
  • Try portclippy from ports-mgmt/portfmt as well. As with any linter (portlint included), take the output with a grain of salt: Linters will always have "false-positives", and sometimes, it's better to deviate from the standard. But the output definitely helps to improve your ports.
  • Instead of running stage-qa manually, consider using ports-mgmt/poudriere (or ports-mgmt/poudriere-devel). It will run the QA steps automatically for testport runs, it can even incorporate portlint automatically, and it will find issues you'll never identify otherwise by running each build in a clean environment (typically missing depends).
 
Back
Top