On Wed, Feb 05, 2025 at 11:18:08PM +0000, Stuart Henderson wrote:
> On 2025/02/05 21:50, Lucas Gabriel Vuotto wrote:
> > Hi ports,
> > 
> > I've a WIP port for a Grafana plugin. Grafana expects the binaries in
> > the plugin to be called whatever_plugin_openbsd_{amd64,arm64,...}. In
> > my WIP port, I solved that by using _GOARCH and adding it to SUBST_VARS,
> > but it might make sense to have the same facility for all the other
> > consumers. Here's a patch that renames _GOARCH to MODGO_ARCH and adds
> > it to SUBST_VARS.
> > 
> > Comments? ok?
> 
> I think it makes sense to expose this as MODGO_ARCH rather than a
> variable named with an _ prefix i.e. intended to be internal only,
> however I don't think it will be particularly widely used in PLISTs and
> I'd be slightly worried about it matching strings which _shouldn't_ be
> substituted, so I'd prefer to leave adding to SUBST_VARS to individual
> ports which need it.

Alright.

> Also, watch out for sysutils/cloud-sql-proxy.

Thanks, I missed its use of _GOARCH.

This is what I'd like to commit, including cloud-sql-proxy and manpage
bits.


diff /usr/src
path + /usr/src
commit - 0e95c6a6994d9b59a4dc5e83eea248beff4ca2e8
blob - 46cd297b67dd6a14cb2b7c1a1ab1bb17528a1a98
file + share/man/man5/go-module.5
--- share/man/man5/go-module.5
+++ share/man/man5/go-module.5
@@ -165,6 +165,8 @@ These are required by Go to determine the full depende
 .El
 .Pp
 Additionally defines
+.Ev MODGO_ARCH
+(application architecture name used by Go),
 .Ev MODGO_PACKAGES ,
 .Ev MODGO_SOURCES
 and
diff refs/heads/master c3f78f488f592c43d7fb9ec71eb496445e6a3965
commit - a4502989e54ac919a7b74beadb076c5f308e6d28
commit + c3f78f488f592c43d7fb9ec71eb496445e6a3965
blob - f99eabc4b636f368f66d0115f02df4db0fedb489
blob + 80164014860a3740009293d6ad826d44b4b6c7f5
--- lang/go/go.port.mk
+++ lang/go/go.port.mk
@@ -24,21 +24,21 @@ BUILD_DEPENDS +=    ${MODGO_BUILD_DEPENDS}
 .endif
 
 .if ${MACHINE_ARCH} == "aarch64"
-_GOARCH =      arm64
+MODGO_ARCH =   arm64
 .elif ${MACHINE_ARCH} == "amd64"
-_GOARCH =      amd64
+MODGO_ARCH =   amd64
 .elif ${MACHINE_ARCH} == "arm"
-_GOARCH =      arm
+MODGO_ARCH =   arm
 .elif ${MACHINE_ARCH} == "i386"
-_GOARCH =      386
+MODGO_ARCH =   386
 .elif ${MACHINE_ARCH} == "riscv64"
-_GOARCH =      riscv64
+MODGO_ARCH =   riscv64
 .endif
 
 MODGO_PACKAGE_PATH =   ${PREFIX}/go-pkg
-MODGO_PACKAGES =       go-pkg/pkg/openbsd_${_GOARCH}
+MODGO_PACKAGES =       go-pkg/pkg/openbsd_${MODGO_ARCH}
 MODGO_SOURCES =                go-pkg/src
-MODGO_TOOLS =          go-pkg/tool/openbsd_${_GOARCH}
+MODGO_TOOLS =          go-pkg/tool/openbsd_${MODGO_ARCH}
 
 SUBST_VARS +=          MODGO_TOOLS MODGO_PACKAGES MODGO_SOURCES
 
blob - e4f4dae8433f4d272644c22b9f7765b18a7ede31
blob + 4a2d2562b09b6072b39c352dbc9ec92f3a6146ee
--- sysutils/cloud-sql-proxy/Makefile
+++ sysutils/cloud-sql-proxy/Makefile
@@ -22,6 +22,6 @@ WANTLIB += c pthread
 MODULES=               lang/go
 
 # .build/gcs_upload.yaml
-MODGO_LDFLAGS +=       -X main.metadataString=openbsd.${_GOARCH}
+MODGO_LDFLAGS +=       -X main.metadataString=openbsd.${MODGO_ARCH}
 
 .include <bsd.port.mk>

Reply via email to