On Sat, Apr 07, 2018 at 12:11:38AM +0200, Klemens Nanni wrote: > This cleans up some whitespace nits, makes more use of defined variables > where appropiate and simplifies the do-install target my reducing > duplicate code. Also avoid walking the tree twice for every directory by > combining two finds into one. > > No changes in built or installed files. > > Feedback? OK? I missed the GOBIN sync from lang/go-bootstrap, updated diff.
Index: Makefile =================================================================== RCS file: /cvs/ports/lang/go/Makefile,v retrieving revision 1.52 diff -u -p -r1.52 Makefile --- Makefile 6 Apr 2018 13:01:39 -0000 1.52 +++ Makefile 6 Apr 2018 22:30:51 -0000 @@ -23,7 +23,8 @@ WANTLIB = c pthread MASTER_SITES = https://golang.org/dl/ -BUILD_DEPENDS = lang/go-bootstrap shells/bash +BUILD_DEPENDS = lang/go-bootstrap \ + shells/bash SEPARATE_BUILD = simple CONFIGURE_STYLE = None @@ -34,10 +35,10 @@ WRKSRC = ${WRKDIST}/src INSTALL_STRIP = -GOOS = openbsd +GOOS = openbsd GOARCH = unknown -GOROOT = ${PREFIX}/go -GOROOT_BOOTSTRAP = ${PREFIX}/go/bootstrap +GOROOT = ${PREFIX}/go +GOROOT_BOOTSTRAP = ${GOROOT}/bootstrap .if ${MACHINE_ARCH} == "amd64" GOARCH = amd64 @@ -46,6 +47,7 @@ GOARCH = 386 .endif GOCFG = /${GOOS}_${GOARCH} +GOBIN = pkg/tool/${GOCFG} do-configure: . if ${GOARCH} == "unknown" @@ -53,7 +55,6 @@ do-configure: @exit 1 . endif - do-build: @cd ${WRKSRC} && \ CC="${CC}" \ @@ -67,37 +68,31 @@ do-build: do-test: @cd ${WRKSRC} && \ ulimit -n 256 -d 2097152 && \ - PATH=${WRKDIST}/bin:${PATH} GOROOT=${WRKDIST} GOCACHE=off ./run.bash + PATH=${WRKDIST}/bin:${PATH} \ + GOROOT=${WRKDIST} \ + GOCACHE=off \ + ./run.bash do-install: - ${INSTALL_PROGRAM_DIR} ${GOROOT} - ${INSTALL_PROGRAM_DIR} ${GOROOT}/bin - ${INSTALL_PROGRAM} -p ${WRKDIST}/bin/go{,fmt} ${GOROOT}/bin - @cd ${PREFIX}/bin && \ - ln -sf ../go/bin/go go - @cd ${PREFIX}/bin && \ - ln -sf ../go/bin/gofmt gofmt - - @cd ${WRKDIST} && \ - find . -type f -maxdepth 1 \ - -exec ${INSTALL_DATA} -p {} \ - ${GOROOT} \; +. for prog in go gofmt + ${INSTALL_PROGRAM} -p ${WRKDIST}/bin/${prog} ${GOROOT}/bin + @ln -s ../go/bin/${prog} ${PREFIX}/bin/${prog} +. endfor + + find ${WRKDIST} -maxdepth 1 -type f \ + -exec ${INSTALL_DATA} -p {} ${GOROOT} \; . for dir in api doc lib misc src pkg/include pkg/${GOCFG} test - @cd ${WRKDIST} && \ + cd ${WRKDIST} && \ find ${dir} -type d \ - -exec ${INSTALL_DATA_DIR} \ - ${GOROOT}/{} \; - @cd ${WRKDIST} && \ - find ${dir} ! -name \*.orig -type f \ - -exec ${INSTALL_DATA} -p {} \ - ${GOROOT}/{} \; + -exec ${INSTALL_DATA_DIR} ${GOROOT}/{} \; \ + -o -type f ! -name \*.orig \ + -exec ${INSTALL_DATA} -p {} ${GOROOT}/{} \; . endfor - ${INSTALL_PROGRAM_DIR} ${GOROOT}/pkg/tool/${GOOS}_${GOARCH} - ${INSTALL_PROGRAM} -p ${WRKDIST}/pkg/tool/${GOOS}_${GOARCH}/* \ - ${GOROOT}/pkg/tool/${GOOS}_${GOARCH} + ${INSTALL_PROGRAM_DIR} ${GOROOT}/${GOBIN} + ${INSTALL_PROGRAM} -p ${WRKDIST}/${GOBIN}/* ${GOROOT}/${GOBIN} .include <bsd.port.mk> Index: go.port.mk =================================================================== RCS file: /cvs/ports/lang/go/go.port.mk,v retrieving revision 1.18 diff -u -p -r1.18 go.port.mk --- go.port.mk 14 Mar 2018 14:12:02 -0000 1.18 +++ go.port.mk 6 Apr 2018 22:30:51 -0000 @@ -64,8 +64,8 @@ MODGO_INSTALL_TARGET = ${INSTALL_PROGRAM MODGO_INSTALL_TARGET += ${INSTALL_DATA_DIR} ${MODGO_PACKAGE_PATH} && \ cd ${MODGO_WORKSPACE} && \ find src pkg -type d -exec ${INSTALL_DATA_DIR} \ - ${MODGO_PACKAGE_PATH}/{} \; && \ - find src pkg -type f -exec ${INSTALL_DATA} -p \ + ${MODGO_PACKAGE_PATH}/{} \; \ + -o -type f -exec ${INSTALL_DATA} -p \ ${MODGO_WORKSPACE}/{} \ ${MODGO_PACKAGE_PATH}/{} \; =================================================================== Stats: --- 30 lines 949 chars Stats: +++ 25 lines 803 chars Stats: -5 lines Stats: -146 chars