Re: lang/go: Makefile improvements
On Fri, May 04, 2018 at 04:11:51AM +1000, Joel Sing wrote: > On Saturday 07 April 2018 00:34:10 Klemens Nanni wrote: > > 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. > > I presume 'make PLIST' is the same? > > ok jsing@ with s/GOBIN/GOTOOLS/ and the other chunk reverted (or indented). Updated diff with GOTOOLS and proper indentation. OK? After that's in, I'll take care of go-1.10.2. > > GOCFG =/${GOOS}_${GOARCH} > > +GOBIN =pkg/tool/${GOCFG} > > I don't like GOBIN being used here - GOBIN has a special meaning in Go (like > GOPATH and GOROOT), so we should avoid this. Also, if anything this is the > tools directory, not the bin directory - GOTOOLS would probably work. > > 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 > > IMO this is a regression, since it now makes it difficult to read and tell > which > command the env vars are for. If you really want to do this it should be > indented such that the continuations are obvious. Index: Makefile === RCS file: /cvs/ports/lang/go/Makefile,v retrieving revision 1.52 diff -u -p -r1.52 Makefile --- Makefile6 Apr 2018 13:01:39 - 1.52 +++ Makefile5 May 2018 13:37:23 - @@ -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} +GOTOOLS = pkg/tool/${GOCFG} do-configure: . if ${GOARCH} == "unknown" @@ -53,7 +55,6 @@ do-configure: @exit 1 . endif - do-build: @cd ${WRKSRC} && \ CC="${CC}" \ @@ -62,42 +63,36 @@ do-build: GOBIN=${WRKDIST}/bin \ GOROOT_FINAL=${GOROOT} \ GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP} \ - ./make.bash --no-banner + ./make.bash --no-banner 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
Re: lang/go: Makefile improvements
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 --- Makefile6 Apr 2018 13:01:39 - 1.52 +++ Makefile6 Apr 2018 22:30:51 - @@ -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 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 - 1.18 +++ go.port.mk 6 Apr 2018 22:30:51 - @@ -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
lang/go: Makefile improvements
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? Index: Makefile === RCS file: /cvs/ports/lang/go/Makefile,v retrieving revision 1.52 diff -u -p -r1.52 Makefile --- Makefile6 Apr 2018 13:01:39 - 1.52 +++ Makefile6 Apr 2018 20:52:24 - @@ -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 @@ -53,7 +54,6 @@ do-configure: @exit 1 . endif - do-build: @cd ${WRKSRC} && \ CC="${CC}" \ @@ -67,37 +67,32 @@ 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}/pkg/tool/${GOCFG} + ${INSTALL_PROGRAM} -p ${WRKDIST}/pkg/tool/${GOCFG}/* \ + ${GOROOT}/pkg/tool/${GOCFG} .include 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 - 1.18 +++ go.port.mk 6 Apr 2018 20:52:24 - @@ -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 809 chars Stats: -5 lines Stats: -140 chars