[Bug 260608] sysutils/zrepl: build does not include version

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 22 Dec 2021 14:05:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260608

            Bug ID: 260608
           Summary: sysutils/zrepl: build does not include version
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: lcook@freebsd.org
          Reporter: lapo@lapo.it
             Flags: maintainer-feedback?(lcook@freebsd.org)
          Assignee: lcook@freebsd.org

current:

# pkg install zrepl
# zrepl version
client: zrepl version= go=go1.17.3 GOOS=freebsd GOARCH=amd64 Compiler=gc

expected:

# zrepl version
client: zrepl version=0.4.0 go=go1.17.3 GOOS=freebsd GOARCH=amd64 Compiler=gc

The reason is that the port is using `go build` directly, instead of using
`gmake`. I tried like this:

  USES=           gmake go:modules,no_targets
  USE_RC_SUBR=    zrepl
  MAKE_ENV=       ZREPL_VERSION=${DISTVERSION}

but it gets a bit complex as it would probably require modifications to the
Makefile (but, as we're not using it, should USES=gmake removed from the
port?).

I finally managed like this (but is a bit more hackish and breaks WITH_DEBUG as
it overrides "-ldflags=-s" as would be otherwise done in
/usr/ports/Mk/Uses/go.mk) but it's simple enough and works in the general case:

  GO_BUILDFLAGS+= -ldflags="-X
github.com/zrepl/zrepl/version.zreplVersion=${DISTVERSION}"

-- 
You are receiving this mail because:
You are the assignee for the bug.