Page MenuHomeFreeBSD

Mk/Uses/go.mk: Allow naming output executable in GO_TARGET, make GH_ACCOUNT/GH_PROJECT usage less surprising
ClosedPublic

Authored by dmgk on Sep 8 2019, 12:46 PM.
Tags
None
Referenced Files
F81613757: D21562.diff
Thu, Apr 18, 11:46 PM
Unknown Object (File)
Jan 31 2024, 11:53 AM
Unknown Object (File)
Jan 1 2024, 12:32 PM
Unknown Object (File)
Dec 22 2023, 9:18 PM
Unknown Object (File)
Dec 21 2023, 12:38 PM
Unknown Object (File)
Nov 14 2023, 8:04 AM
Unknown Object (File)
Nov 12 2023, 8:11 AM
Unknown Object (File)
Nov 8 2023, 9:45 AM
Subscribers
None

Details

Summary
  • Allow GO_TARGET to be specified as a tuple in the form package:output, which will instruct Go to write resulting executable to ${GO_WRKDIR_BIN}/${output} instead of the default behaviour of naming executable using the last component of the package name. This often removes the need for custom do/post-install that rename executables.

Examples:

  • audio/pms-devel

GO_TARGET= :pms-devel
instead of

do-install:
       ${INSTALL_PROGRAM} ${WRKSRC}/pms-${GH_TAGNAME} ${STAGEDIR}${PREFIX}/bin/${GO_PKGNAME}
  • databases/mongodb40-tools

Targets can be just listed in VARS:

BSONDUMP_VARS=         go_target+=./bsondump/main:bsondump
MONGOSTAT_VARS=                go_target+=./mongostat/main:mongostat
MONGOFILES_VARS=       go_target+=./mongofiles/main:mongofiles

instead of renaming directories in post-patch.

  • Swtich to shell looping in do-build/install. Unfortunately .for over GO_TARGET doesn't really work there because bsd.sites.mk is included too late for GH_ACCOUNT/GH_PROJECT to work correctly in GO_PKGNAME/GO_TARGET (example: textproc/minify)
  • Clarify that GO_PKGNAME is not needed in modules mode.
  • Fix spelling.

Depends on: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240414

Test Plan

poudriere bulk of all Go ports.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dmgk retitled this revision from Allow naming output executable in GO_TARGET, make GH_ACCOUNT/GH_PROJECT usage less surprising to Mk/Uses/go.mk: Allow naming output executable in GO_TARGET, make GH_ACCOUNT/GH_PROJECT usage less surprising.Sep 8 2019, 1:01 PM

Update GO_PKGNAME description, use ECHO_CMD.

Mk/Uses/go.mk
128 ↗(On Diff #61802)

Since this is a message from the framework use ${ECHO_MSG} here.

140 ↗(On Diff #61802)

I feel like this should somehow also support installing the binaries into a different path altogether like ${PREFIX}/sbin or ${PREFIX}/libexec. Example ports that would benefit are net/gobgp, www/gitea, www/webhook, ...

GO_TARGET=	./bsondump/main:${PREFIX}/sbin/bsondump

where the short form of

GO_TARGET=	./bsondump/main:bsondump

would still just install it as ${PREFIX}/bin/bsondump

Use ECHO_MSG, add support for specifying full installation path in GO_TARGET.

dmgk marked 2 inline comments as done.Sep 9 2019, 4:41 PM

mkdir the destination dir if installing using a full path.

I have only tested a couple of ports, but this looks fine to me.

Can you ask for an exp-run to make sure this does not break anything?

I have only tested a couple of ports, but this looks fine to me.

Can you ask for an exp-run to make sure this does not break anything?

devel/gb is expected to break. Should I declare exp-run PR dependent on https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240414 ?

In D21562#470983, @dg_syrec.org wrote:

I have only tested a couple of ports, but this looks fine to me.

Can you ask for an exp-run to make sure this does not break anything?

devel/gb is expected to break. Should I declare exp-run PR dependent on https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240414 ?

Since you already have a fix for that just include it in the exp-run patch too.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 14 2019, 8:20 AM
This revision was automatically updated to reflect the committed changes.