Stuart Henderson said:
>> Index: lang/go/go.port.mk
>> ===================================================================
>> RCS file: /var/cvs/ports/lang/go/go.port.mk,v
>> retrieving revision 1.1
>> diff -u -p -r1.1 go.port.mk
>> --- lang/go/go.port.mk       15 May 2015 07:30:41 -0000      1.1
>> +++ lang/go/go.port.mk       25 May 2015 17:55:00 -0000
>> @@ -15,4 +15,4 @@ GO_PKG ?=          pkg/tool/openbsd_${MACHINE_AR
>>  
>>  SUBST_VARS +=               GO_PKG
>>  
>> -GOPATH ?=           "${WRKSRC}:${LOCALBASE}/go"
>> +GOPATH :=           "${GOPATH}:${WRKSRC}:${LOCALBASE}/go"
> 
> Including ${GOPATH} here, especially at the start of the path, still
> seems a bit fragile?

Some go ports will need to specify GOPATH=${WRKSRC:=subdir/}, and it may
be necessary to prioritize it over ${WRKSRC}.  (Eg. we need to build
sources from ${WRKSRC:=openbsd/} instead of ${WRKSRC}.  Such ports
should be able to add to beginning of GOPATH.  As long as modules are
included after the contents of the port I see basically two ways of
doing it:

 * set GOPATH explicitly in every port or
 * append ${WRKSRC} to the end of ${GOPATH} in module.

The latter appears to be quite safe.  Eg. I have GOPATH=/home/ddc/go in
my profile.  With the patch above and modification to textproc/godoc
below I have:

  $ make show=GOPATH
  
"/usr/ports/pobj/godoc-1.4/gotools-1.4:/usr/ports/pobj/godoc-1.4/gotools-1.4/src/golang.org/x/tools:/usr/local/go"

Which overrides my GOPATH setting via Makefile and consequently adds
${WRKSRC} and ${LOCALBASE}/go as fallback options.

FWIW I doubt we really need ${LOCALBASE}/go in GOPATH - if requested
object is not found in GOPATH, GOROOT is searched instead, and that
should (and does) point to ${LOCALBASE}/go anyway.

-- 
Dmitrij D. Czarkoff

Index: Makefile
===================================================================
RCS file: /var/cvs/ports/textproc/godoc/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- Makefile    15 May 2015 07:32:00 -0000      1.3
+++ Makefile    26 May 2015 08:33:40 -0000
@@ -25,12 +25,13 @@ MODULES =           lang/go
 RUN_DEPENDS =          ${MODGO_RUN_DEPENDS}
 
 WRKSRC =               ${WRKDIST}/src/golang.org/x/tools
+GOPATH =               ${WRKDIST}
 
 do-build:
-       cd ${WRKSRC}/cmd/godoc && GOPATH="${WRKDIST}" go build -v
+       cd ${WRKSRC}/cmd/godoc && GOPATH="${GOPATH}" go build -v
 
 do-test:
-       cd ${WRKSRC}/cmd/godoc && GOPATH="${WRKDIST}" go test -v
+       cd ${WRKSRC}/cmd/godoc && GOPATH="${GOPATH}" go test -v
 
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/cmd/godoc/godoc ${PREFIX}/bin/godoc

Reply via email to