tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ALTERNATIVES framework and multiple package versions question



On Sun, Dec 6, 2020 at 12:01 PM nia <nia%netbsd.org@localhost> wrote:
> > build: client_with_deps
> >         go mod download
> >         PATH=$(GOPATH)/bin:$(PATH) go generate ./...
> >         CGO_ENABLED=0 go build -ldflags="-s -w -X
> > main.version=$(VERSION) -X main.channel=$(CHANNEL) -X
> > main.goarm=$(GOARM)"
> >         PATH=$(GOPATH)/bin:$(PATH) packr clean
> >
> > And I am wondering what is the "pkgsrc way" of building it:
> > - should it be corrected with SUBST framework?
> > - is allowing "go mod download" a good idea during package build? Or
> > should pkgsrc Go modules be used?

> It still looks like it's a go program, so it should use the pkgsrc way
> to build Go programs and probably not this custom thing?
>
> Yeh, packages shouldn't download files during the build process, they
> should all be in distfiles.
>
> I think we're moving away from having go modules in pkgsrc itself and
> intead using GO_MODULE_FILES.

We have lang/go/go-module.mk for module-based builds. You can do the following:

make show-go-modules > go-modules.mk

and include that file in your Makefile. Then "make makesum" will make
sure all the module files are present and fetched as part of "make
fetch".

Note that go-module.mk sets up a number of flags and variables so that
the build actually uses the downloaded module files. So you will need
to fiddle a little bit with the Makefile so that it does that too, and
patch out the "go mod download" line.

Good luck!

-- 
Benny


Home | Main Index | Thread Index | Old Index