diff mbox series

package/pkg-golang: default to rawname to install binaries

Message ID 19532_1646758392_622789F8_19532_102_1_b2db850ee51822a3272be0f6984d2e53d73e790c.1646758134.git.yann.morin@orange.com
State Accepted
Headers show
Series package/pkg-golang: default to rawname to install binaries | expand

Commit Message

Yann E. MORIN March 8, 2022, 4:53 p.m. UTC
From: "Yann E. MORIN" <yann.morin@orange.com>

The default currently is to rely on the package name to decide what to
build and install if not specified by tje caller. This works nice for
target packages, where a 'foo' package will by default build and
install a 'foo' executable.

However, for host packages, that will build and install a 'host-foo'
exzcutable, which is not really, even really not, what would be
expected.

We fix that by using the package raw name, i.e. the package name with
the host- prefix yanked away.

It is very improbable that there already have many host-golang packages
in the wild (in br2-external trees), but if there are, they would
forcibly define those variables to a sane value. This change is not
incompatible, as the values provided by packages take precendence; it's
just that those packages now carry superfluous, if innocuous, variable
assignments.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
---
 package/pkg-golang.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Korsgaard March 8, 2022, 8:13 p.m. UTC | #1
>>>>>   <yann.morin@orange.com> writes:

 > From: "Yann E. MORIN" <yann.morin@orange.com>
 > The default currently is to rely on the package name to decide what to
 > build and install if not specified by tje caller. This works nice for
 > target packages, where a 'foo' package will by default build and
 > install a 'foo' executable.

 > However, for host packages, that will build and install a 'host-foo'
 > exzcutable, which is not really, even really not, what would be
 > expected.

 > We fix that by using the package raw name, i.e. the package name with
 > the host- prefix yanked away.

 > It is very improbable that there already have many host-golang packages
 > in the wild (in br2-external trees), but if there are, they would
 > forcibly define those variables to a sane value. This change is not
 > incompatible, as the values provided by packages take precendence; it's
 > just that those packages now carry superfluous, if innocuous, variable
 > assignments.

 > Signed-off-by: Yann E. MORIN <yann.morin@orange.com>

Committed, thanks.
diff mbox series

Patch

diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index 0cb2ed73cc..0b3dc3d32f 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -59,10 +59,10 @@  $(2)_BUILD_TARGETS ?= .
 # been specified, we assume that the binaries to be produced are named
 # after each build target building them (below in <pkg>_BUILD_CMDS).
 ifeq ($$($(2)_BUILD_TARGETS),.)
-$(2)_BIN_NAME ?= $(1)
+$(2)_BIN_NAME ?= $$($(2)_RAWNAME)
 endif
 
-$(2)_INSTALL_BINS ?= $(1)
+$(2)_INSTALL_BINS ?= $$($(2)_RAWNAME)
 
 # Source files in Go usually use an import path resolved around
 # domain/vendor/software. We infer domain/vendor/software from the upstream URL