How to handle go dependencies

Matthias Fechner idefix at fechner.net
Wed Jul 10 05:22:18 UTC 2019


Am 22.06.2019 um 11:58 schrieb Matthias Fechner:
> What is the correct way to getting these dependencies fetched and
> correctly included into the work-source in the fetch step using go?


Here a short summary what I had to do to build the port successfully
with go deps.
Thanks a lot for all that helped here!

Add:
USES=    go:modules

I had to use this USES as the port is using gmake to build everything:
USES=    gmake go:modules,no_targets

As gmake is used, the GOFLAGS must be passed to gmake with:

MAKE_ENV=    GOFLAGS="${GO_BUILDFLAGS}"

The port uses gitlab to fetch the distfiles, so I had to tell the ports
that github is not the default:
USE_GITHUB=    nodefault

The next step is then to create the GH_TUPLE and GL_TUPLE (depending
where the go libs are hosted, for they were on github and gitlab).
For this a very handy tool from Dmitri is existing: ports-mgmt/modules2tuple

To simplify it, I create a new target:
gomod-deps: patch
    (cd ${WRKSRC} && go mod vendor)
    (cd ${WRKSRC} && modules2tuple vendor/modules.txt)

Just execute `make gomod-deps` and you should see the required
GH/GL_TUPLE lines.

For the GL_TUPLE lines I had to put in the full length for the commit
hash, as the short one does not work.
I'm not sure if this is a port problem or a gitlab limitation, a task
for later to look into it.

The last section of the TUPLE line must not contain the character `-` if
this is the case, replace it by a `_`.
I think the script from Dmitri is doing this already for the GH_TUPLE lines.

Put the TUPLE lines into the Makefile, run `make makesum` and your port
should be prepare to be able to build.

If you need a full example, please have a look into devel/gitaly.

Have fun and thanks again to all that helped me!

   

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20190710/e5cee49b/attachment.sig>


More information about the freebsd-ports mailing list