pkgsrc-WIP-changes archive

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

Rename go-package.mk to go-module.mk.



Module Name:	pkgsrc-wip
Committed By:	Benny Siegert <bsiegert%gmail.com@localhost>
Pushed By:	bsiegert
Date:		Sat Mar 14 14:47:03 2020 +0100
Changeset:	9587ed801e97ed996f1033e093c292625cf89c2d

Modified Files:
	lf/Makefile
Added Files:
	go/go-module.mk
Removed Files:
	go/go-package.mk

Log Message:
Rename go-package.mk to go-module.mk.

Get rid of the GO_MODULES settings, it is just too messy. Instead,
we will have go-module.mk (module-based build) and go-package.mk
(gopath build).

Adapt the wip/lf package accordingly.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9587ed801e97ed996f1033e093c292625cf89c2d

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 go/go-module.mk  |  95 ++++++++++++++++++++++++++++++++++++
 go/go-package.mk | 143 -------------------------------------------------------
 lf/Makefile      |   9 +---
 3 files changed, 96 insertions(+), 151 deletions(-)

diffs:
diff --git a/go/go-module.mk b/go/go-module.mk
new file mode 100644
index 0000000000..c64cf75ccd
--- /dev/null
+++ b/go/go-module.mk
@@ -0,0 +1,95 @@
+# $NetBSD: go-package.mk,v 1.21 2018/11/30 18:38:19 rillig Exp $
+#
+# This file implements common logic for compiling Go programs in pkgsrc.
+#
+# === Package-settable variables ===
+#
+# GO_BUILD_PATTERN (optional)
+#	Argument used for 'go install'.
+#	In most cases, the default is fine.
+#
+#	Default:
+#		"...", which means all files below the top-level directory.
+#
+# GO_MODULE_FILES (optional)
+#	List of dependency files to be downloaded from the Go module proxy.
+#	Can be filled out from the output of "make show-go-modules".
+#
+# Keywords: go golang
+#
+
+# Implementation notes
+#
+# The compiled Go code is tied to a specific compiler version, and the
+# compilation is fast. So the plan is:
+#
+# 1. Compile everything.
+# 2. Install binaries into bin/.
+# 3. Install source code and packages into a separate gopkg tree.
+#
+# We implement buildlink by creating a separate tree during the build and
+# linking only the packages explicitly mentioned in dependencies there.
+#
+# All packages build-depend on the default Go release. Go packages should be
+# revbumped when that package is updated.
+#
+
+.include "../../lang/go/version.mk"
+
+GO_BUILD_PATTERN?=	...
+
+MAKE_JOBS_SAFE=		no
+INSTALLATION_DIRS+=	bin
+USE_TOOLS+=		pax
+
+PRINT_PLIST_AWK+=	/^@pkgdir bin$$/ { next; }
+
+MAKE_ENV+=	GO111MODULE=on GOPATH=${WRKDIR}/.gopath GOPROXY=file://${WRKDIR}/.goproxy
+MAKE_ENV+=	GOCACHE=${WRKDIR}/.cache/go-build
+
+.if !target(do-build)
+do-build:
+	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} install -v ${GO_BUILD_PATTERN}
+.endif
+
+.if !target(do-test)
+do-test:
+	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${TEST_ENV} ${MAKE_ENV} ${GO} test -v ${GO_BUILD_PATTERN}
+.endif
+
+.if !target(do-install)
+do-install:
+	${RUN} cd ${WRKDIR}/.gopath && [ ! -d bin ] || ${PAX} -rw bin ${DESTDIR}${PREFIX}
+.endif
+
+# FIXME This needs to depend on extract
+.PHONY: show-go-modules
+show-go-modules:
+	# cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} env
+	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} get -d
+	${RUN} cd ${WRKDIR}/.gopath/pkg/mod/cache/download && ${FIND} . -type f -name "*.mod" | ${SED} -e 's/\.\//GO_MODULE_FILES+=	/'
+	${RUN} cd ${WRKDIR}/.gopath/pkg/mod/cache/download && ${FIND} . -type f -name "*.zip" | ${SED} -e 's/\.\//GO_MODULE_FILES+=	/'
+
+DISTFILES?=	${DEFAULT_DISTFILES}
+.for i in ${GO_MODULE_FILES}
+DISTFILES+=	${i:!basename $i!}
+SITES.${i:!basename $i!}= https://proxy.golang.org/${i:!dirname $i!}/
+.endfor
+
+post-extract:
+.for i in ${GO_MODULE_FILES}
+	${MKDIR} ${WRKDIR}/.goproxy/${i:!dirname $i!}
+	cp ${DISTDIR}/${DIST_SUBDIR}/${i:!basename $i!} ${WRKDIR}/.goproxy/$i
+.endfor
+
+_VARGROUPS+=		go
+_PKG_VARS.go=		GO_BUILD_PATTERN
+_USER_VARS.go=		GO_VERSION_DEFAULT
+_SYS_VARS.go=		GO GO_VERSION GOVERSSUFFIX GOARCH GOCHAR \
+			GOOPT GOTOOLDIR GO_PLATFORM
+_DEF_VARS.go=		GO14_VERSION GO19_VERSION GO110_VERSION \
+			GO111_VERSION INSTALLATION_DIRS MAKE_JOBS_SAFE \
+			NOT_FOR_PLATFORM ONLY_FOR_PLATFORM SSP_SUPPORTED \
+			WRKSRC
+_USE_VARS.go=		GO_PACKAGE_DEP
+_SORTED_VARS.go=	INSTALLATION_DIRS *_FOR_PLATFORM
diff --git a/go/go-package.mk b/go/go-package.mk
deleted file mode 100644
index bf5ddabdac..0000000000
--- a/go/go-package.mk
+++ /dev/null
@@ -1,143 +0,0 @@
-# $NetBSD: go-package.mk,v 1.21 2018/11/30 18:38:19 rillig Exp $
-#
-# This file implements common logic for compiling Go programs in pkgsrc.
-#
-# === Package-settable variables ===
-#
-# GO_MODULE (optional)
-#	Set to "yes" to do a module-based build (EXPERIMENTAL).
-#
-# GO_SRCPATH (required)
-#	The patch that can be used with "go get" to import the current
-#	package. This is usually the URL without the leading protocol.
-#
-#	Examples:
-#		github.com/username/repository
-#		gopkg.in/check.v1
-#
-# GO_DIST_BASE (optional)
-#	Path this package extracts to.
-#
-#	Default:
-#		The last path component of ${GO_SRCPATH}
-#	Examples:
-#		${GITHUB_PROJECT}-${GITHUB_TAG}*
-#		${GITHUB_PROJECT}-${GITHUB_TAG:S/v//}
-#		${DISTNAME}
-#
-# GO_BUILD_PATTERN (optional)
-#	Argument used for 'go install'.
-#	In most cases, the default is fine.
-#
-#	Default:
-#		"${GO_SRCPATH}/...", which means all files below GO_SRCPATH.
-#
-# Keywords: go golang
-#
-
-# Implementation notes
-#
-# The compiled Go code is tied to a specific compiler version, and the
-# compilation is fast. So the plan is:
-#
-# 1. Compile everything.
-# 2. Install binaries into bin/.
-# 3. Install source code and packages into a separate gopkg tree.
-#
-# We implement buildlink by creating a separate tree during the build and
-# linking only the packages explicitly mentioned in dependencies there.
-#
-# All packages build-depend on the default Go release. Go packages should be
-# revbumped when that package is updated.
-#
-
-.include "../../lang/go/version.mk"
-
-.if !empty(GO_MODULE:M[Yy][Ee][Ss])
-GO_BUILD_PATTERN?=	...
-.else
-_GO_DIST_BASE!=		basename ${GO_SRCPATH}
-GO_DIST_BASE?=		${_GO_DIST_BASE}
-
-GO_BUILD_PATTERN?=	${GO_SRCPATH}/...
-WRKSRC=			${WRKDIR}/src/${GO_SRCPATH}
-.endif
-
-MAKE_JOBS_SAFE=		no
-INSTALLATION_DIRS+=	bin gopkg
-USE_TOOLS+=		pax
-
-BUILD_DEPENDS+=		${GO_PACKAGE_DEP}
-
-GOTOOLDIR=		go${GOVERSSUFFIX}/pkg/tool/${GO_PLATFORM}
-
-PRINT_PLIST_AWK+=	/^@pkgdir bin$$/ { next; }
-PRINT_PLIST_AWK+=	/^@pkgdir gopkg$$/ { next; }
-
-.if !empty(GO_MODULE:M[Yy][Ee][Ss])
-MAKE_ENV+=	GO111MODULE=on GOPATH=${WRKDIR}/.gopath GOPROXY=file://${WRKDIR}/.goproxy
-.else
-MAKE_ENV+=	GO111MODULE=off GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg 
-.endif
-MAKE_ENV+=	GOCACHE=${WRKDIR}/.cache/go-build
-
-.if !target(post-extract) && empty(GO_MODULE:M[Yy][Ee][Ss])
-post-extract:
-	${RUN} ${MKDIR} ${WRKSRC}
-	${RUN} ${RM} -fr ${WRKDIR}/${GO_DIST_BASE}/.hg
-	${RUN} ${MV} ${WRKDIR}/${GO_DIST_BASE}/* ${WRKSRC}
-.endif
-
-.if !target(do-build)
-do-build:
-	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} install -v ${GO_BUILD_PATTERN}
-.endif
-
-.if !target(do-test)
-do-test:
-	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${TEST_ENV} ${MAKE_ENV} ${GO} test -v ${GO_BUILD_PATTERN}
-.endif
-
-.if !target(do-install)
-do-install:
-.if empty(GO_MODULE:M[Yy][Ee][Ss])
-	${RUN} cd ${WRKDIR}; [ ! -d bin ] || ${PAX} -rw bin ${DESTDIR}${PREFIX}
-	${RUN} cd ${WRKDIR}; [ ! -d pkg ] || ${PAX} -rw src pkg ${DESTDIR}${PREFIX}/gopkg
-.else
-	${RUN} cd ${WRKDIR}/.gopath && [ ! -d bin ] || ${PAX} -rw bin ${DESTDIR}${PREFIX}
-.endif
-.endif
-
-.if !empty(GO_MODULE:M[Yy][Ee][Ss])
-# FIXME This needs to depend on extract
-.PHONY: show-go-modules
-show-go-modules:
-	# cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} env
-	${RUN} cd ${WRKSRC} && ${PKGSRC_SETENV} ${MAKE_ENV} ${GO} get -d
-	${RUN} cd ${WRKDIR}/.gopath/pkg/mod/cache/download && ${FIND} . -type f -name "*.mod" | ${SED} -e 's/\.\//GO_MODULE_FILES+=	/'
-	${RUN} cd ${WRKDIR}/.gopath/pkg/mod/cache/download && ${FIND} . -type f -name "*.zip" | ${SED} -e 's/\.\//GO_MODULE_FILES+=	/'
-
-.for i in ${GO_MODULE_FILES}
-DISTFILES+= ${i:!basename $i!}
-SITES.${i:!basename $i!}= https://proxy.golang.org/${i:!dirname $i!}/
-.endfor
-
-post-extract:
-.for i in ${GO_MODULE_FILES}
-	${MKDIR} ${WRKDIR}/.goproxy/${i:!dirname $i!}
-	cp ${DISTDIR}/${DIST_SUBDIR}/${i:!basename $i!} ${WRKDIR}/.goproxy/$i
-.endfor
-
-.endif
-
-_VARGROUPS+=		go
-_PKG_VARS.go=		GO_SRCPATH GO_DIST_BASE GO_BUILD_PATTERN
-_USER_VARS.go=		GO_VERSION_DEFAULT
-_SYS_VARS.go=		GO GO_VERSION GOVERSSUFFIX GOARCH GOCHAR \
-			GOOPT GOTOOLDIR GO_PLATFORM
-_DEF_VARS.go=		GO14_VERSION GO19_VERSION GO110_VERSION \
-			GO111_VERSION INSTALLATION_DIRS MAKE_JOBS_SAFE \
-			NOT_FOR_PLATFORM ONLY_FOR_PLATFORM SSP_SUPPORTED \
-			WRKSRC
-_USE_VARS.go=		GO_PACKAGE_DEP
-_SORTED_VARS.go=	INSTALLATION_DIRS *_FOR_PLATFORM
diff --git a/lf/Makefile b/lf/Makefile
index 98f04a16bd..670640270f 100644
--- a/lf/Makefile
+++ b/lf/Makefile
@@ -10,13 +10,7 @@ HOMEPAGE=		https://${GO_SRCPATH}
 COMMENT=		Terminal file manager
 LICENSE=		2-clause-bsd
 
-#GO_SRCPATH=		github.com/gokcehan/lf
-# GO_DIST_BASE=		${GITHUB_PROJECT}-${GITHUB_TAG}*
-
-GO_MODULE=		yes
-
 DIST_SUBDIR=		${PKGNAME_NOREV}
-DISTFILES?=		${DEFAULT_DISTFILES}
 
 GO_MODULE_FILES+=       github.com/mattn/go-runewidth/@v/v0.0.4.mod
 GO_MODULE_FILES+=       github.com/mattn/go-runewidth/@v/v0.0.4.zip
@@ -24,6 +18,5 @@ GO_MODULE_FILES+=       github.com/nsf/termbox-go/@v/v0.0.0-20190325093121-28851
 GO_MODULE_FILES+=       github.com/nsf/termbox-go/@v/v0.0.0-20190325093121-288510b9734e.mod
 
 
-.include "../../devel/go-termbox/buildlink3.mk"
-.include "../../wip/go/go-package.mk"
+.include "../../wip/go/go-module.mk"
 .include "../../mk/bsd.pkg.mk"


Home | Main Index | Thread Index | Old Index