Discussion:
Ports Makefile rules install vs do-install
Xavier Humbert
2021-05-28 07:22:54 UTC
Permalink
Hi,

This is only my second port, the first has never been released. So
please be indulgent.

I'm porting rudder agent (https://www.rudder.io) to FreeBSD. My Makefile
PORTNAME=     �  rudder-agent
DISTVERSION=    6.2.7
CATEGORIES=        sysutils
MASTER_SITES=    https://github.com/WHATEVER
COMMENT=        Agent for Rudder
LICENSE=        GPLv2+
SHORT_NAME=        rudder
NO_BUILD=    yes
NO_ARCH=    yes
USE_GITHUB=    yes
GH_ACCOUNT=
GH_PROJECT=
BUILD_DEPENDS+=shellcheck:devel/hs-ShellCheck
        -e s=/'bin/bash'=/'bin/sh'= \
        -e s='\^\#\!'='^#\\!'= \
        ${WRKSRC}/qa-test
    cd ${WRKSRC}/man && make all
    ${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
    ${MKDIR} ${STAGEDIR}${PREFIX}/${SHORT_NAME}/share/commands
    ${MKDIR} ${STAGEDIR}${PREFIX}/${SHORT_NAME}/share/lib
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/${SHORT_NAME}
${STAGEDIR}${PREFIX}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/share/commands/*
${STAGEDIR}${PREFIX}/${SHORT_NAME}/share/commands
    ${INSTALL_SCRIPT}
${WRKSRC}/etc/bash_completion.d/${SHORT_NAME}.sh
${STAGEDIR}${PREFIX}/etc/bash_completion.d/
.for ii in package_upgrade.py timestamp
    ${INSTALL_SCRIPT} ${WRKSRC}/share/lib/${ii}
${STAGEDIR}${PREFIX}/${SHORT_NAME}/share/lib
.endfor
.for f in api_call.sh cfengine_parsing.sh common.sh report.sh reports.awk
    ${INSTALL_DATA} ${WRKSRC}/share/lib/${f}
${STAGEDIR}${PREFIX}/${SHORT_NAME}/share/lib
.endfor
    ${INSTALL_MAN} ${WRKSRC}/man/${SHORT_NAME}.8
${STAGEDIR}${PREFIX}/share/man/man8/
do-test: # runs the qa testsuite
The problem is :
* target "do-install" is not invoked if I call make install.
* calling manually "make do-install" stages the port correctly.
* if I rename this target to "install", it complains about
"work/rudder-agent-6.2.7/Makefile" missing, despite the flag NO_BUILD= yes
* the pkg-plist is conform
* however, the target "do-test" is correctly called by "make test"

I've carefully read the Porter's Handbook, and can't see where my
mistake is. I'm not a Makefile guru.

Thanks for help,

Regards,

Xavier
--
Xavier HUMBERT - Unix/Win/MacOSX Sysadmin/Network Senior Engineer
https://www.amdh.fr
Gleb Popov
2021-05-28 07:32:13 UTC
Permalink
Post by Xavier Humbert
* target "do-install" is not invoked if I call make install.
* calling manually "make do-install" stages the port correctly.
* if I rename this target to "install", it complains about
"work/rudder-agent-6.2.7/Makefile" missing, despite the flag NO_BUILD= yes
* the pkg-plist is conform
* however, the target "do-test" is correctly called by "make test"
I've carefully read the Porter's Handbook, and can't see where my
mistake is. I'm not a Makefile guru.
Thanks for help,
Regards,
Xavier
--
Xavier HUMBERT - Unix/Win/MacOSX Sysadmin/Network Senior Engineer
https://www.amdh.fr
Do you have

.include <bsd.port.mk>

at the end of your Makefile?
Xavier Humbert
2021-05-28 08:11:22 UTC
Permalink
Do you have > > .include <bsd.port.mk <http://bsd.port.mk>> > > at
the end of your Makefile?

Yes, obviously. There were a bunch of comments before, so I forgot to
mention it

Xavier
--
Xavier HUMBERT - Unix/Win/MacOSX Sysadmin/Network Senior Engineer
https://www.amdh.fr
Tatsuki Makino
2021-05-28 08:38:07 UTC
Permalink
What happens if make restage is executed?
Xavier Humbert
2021-05-28 08:43:54 UTC
Permalink
Post by Tatsuki Makino
What happens if make restage is executed?
Everything is fine, staging is OK

Xavier
--
Xavier HUMBERT - Unix/Win/MacOSX Sysadmin/Network Senior Engineer
https://www.amdh.fr
Tatsuki Makino
2021-05-28 09:13:17 UTC
Permalink
Post by Xavier Humbert
Everything is fine, staging is OK
do-install target is invoked by stage target.
(make -C /usr/ports/some/where -V _STAGE_SEQ)
So I don't think do-install will be executed if stage is completed.
And the target to force stage to be rerun is restage.

Loading...