build golang tools
cover build golang tools
These patches add support for the golang tools in the build system.
The behavior of configure with respect to the new variable, CONFIG_GOLANG_TOOLS is copied from other components, such as the Ocaml tools. Namely, build the tools by default if the go compiler is found.
Nick Rosbrook (2):
tools: build golang tools if go compiler is present golang/xenlight: stop tracking generated files
.gitignore | 3 + .hgignore | 2 + config/Tools.mk.in | 1 + m4/golang.m4 | 4 + tools/Makefile | 2 +- tools/Rules.mk | 2 - tools/configure | 138 + tools/configure.ac | 12 + tools/golang/xenlight/Makefile | 1 + tools/golang/xenlight/helpers.gen.go | 4658 -------------------------- tools/golang/xenlight/types.gen.go | 1225 ------- 11 files changed, 162 insertions(+), 5886 deletions(-) create mode 100644 m4/golang.m4 delete mode 100644 tools/golang/xenlight/helpers.gen.go delete mode 100644 tools/golang/xenlight/types.gen.go
Signature · 1 line
2.17.1
PATCH 1/2 tools: build golang tools if go compiler is present
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang tools.
The new corresponding make variable is CONFIG_GOLANG_TOOLS. Remove CONFIG_GOLANG from tools/Rules.mk since the new variable is set by configure.
--- config/Tools.mk.in | 1 + m4/golang.m4 | 4 ++ tools/Makefile | 2 +- tools/Rules.mk | 2 - tools/configure | 138 +++++++++++++++++++++++++++++++++++++++++++++ tools/configure.ac | 12 ++++ 6 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 m4/golang.m4
config/Tools.mk.in +1 -0
@@ -55,6 +55,7 @@ CONFIG_QEMU_TRAD := @qemu_traditional@ CONFIG_QEMU_XEN := @qemu_xen@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ CONFIG_LIBNL := @libnl@ +CONFIG_GOLANG_TOOLS := @golang_tools@ CONFIG_SYSTEMD := @systemd@ SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@
m4/golang.m4 new file +4 -0
@@ -0,0 +1,4 @@ +AC_DEFUN([AC_PROG_GO], [ + dnl Check for the go compiler + AC_CHECK_TOOL([GO],[go],[no]) +])
tools/Makefile +1 -1
@@ -31,7 +31,7 @@ endif SUBDIRS-y += xenpmd SUBDIRS-y += libxl -SUBDIRS-$(CONFIG_GOLANG) += golang +SUBDIRS-$(CONFIG_GOLANG_TOOLS) += golang SUBDIRS-y += xl SUBDIRS-y += helpers SUBDIRS-$(CONFIG_X86) += xenpaging
tools/Rules.mk +0 -2
@@ -35,8 +35,6 @@ XENSTORE_XENSTORED ?= y debug ?= y debug_symbols ?= $(debug) -# Set CONFIG_GOLANG=y in .config (or in make) to build golang -CONFIG_GOLANG ?= n XEN_GOPATH = $(XEN_ROOT)/tools/golang XEN_GOCODE_URL = golang.xenproject.org
tools/configure +138 -0
180 lines not on this page · raw message
tools/configure.ac +12 -0
@@ -73,6 +73,7 @@ m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) m4_include([../m4/paths.m4]) m4_include([../m4/systemd.m4]) +m4_include([../m4/golang.m4]) AX_XEN_EXPAND_CONFIG()
@@ -84,6 +85,7 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools]) AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation]) AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF]) AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS]) +AX_ARG_DEFAULT_ENABLE([golang_tools], [Disable Go tools]) AC_ARG_WITH([linux-backend-modules], AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"],
@@ -320,6 +322,16 @@ AS_IF([test "x$ocamltools" = "xy"], [ ]) ]) +AS_IF([test "x$golang_tools" = "xy"], [ + AC_PROG_GO + AS_IF([test "x$GO" = "xno"], [ + AS_IF([test "x$enable_golang_tools" = "xyes"], [ + AC_MSG_ERROR([Go tools enabled, but missing go compiler]) + ]) + golang_tools="n" + ]) +]) + m4_include([../m4/xenstored.m4]) AX_XENSTORE_OPTIONS AX_XENSTORE_SET
Signature · 1 line
2.17.1
PATCH 2/2 golang/xenlight: stop tracking generated files
In reply to Nick RosbrookThe generated go files were tracked temporarily while the initial implementation of gengotypes.py was in progress. They can now be removed and ignored by git and hg.
While here, make sure generated files are removed by make clean.
--- .gitignore | 3 + .hgignore | 2 + tools/golang/xenlight/Makefile | 1 + tools/golang/xenlight/helpers.gen.go | 4658 -------------------------- tools/golang/xenlight/types.gen.go | 1225 ------- 5 files changed, 6 insertions(+), 5883 deletions(-) delete mode 100644 tools/golang/xenlight/helpers.gen.go delete mode 100644 tools/golang/xenlight/types.gen.go
.gitignore +3 -0
@@ -405,6 +405,9 @@ tools/xenstore/xenstore-watch tools/xl/_paths.h tools/xl/xl +tools/golang/src +tools/golang/*/*.gen.go + docs/txt/misc/*.txt docs/txt/man/*.txt docs/figs/*.png
.hgignore +2 -0
@@ -282,6 +282,8 @@ ^tools/ocaml/test/xtl$ ^tools/ocaml/test/send_debug_keys$ ^tools/ocaml/test/list_domains$ +^tools/golang/src$ +^tools/golang/.*/.*\.gen\.go$ ^tools/autom4te\.cache$ ^tools/config\.h$ ^tools/config\.log$
tools/golang/xenlight/Makefile +1 -0
@@ -49,6 +49,7 @@ install: build clean: $(RM) -r $(XEN_GOPATH)$(GOXL_PKG_DIR) $(RM) $(XEN_GOPATH)/pkg/*/$(XEN_GOCODE_URL)/xenlight.a + $(RM) *.gen.go .PHONY: distclean distclean: clean
tools/golang/xenlight/helpers.gen.go deleted +0 -4658
2,976 lines not on this page · raw message
tools/golang/xenlight/types.gen.go deleted +0 -1225
1,225 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
In reply to Nick RosbrookQuoted 3 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang
--enable-golang-tools here.
Quoted 7 lines
tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>
Note to self: fix commit message and maybe rerun autogen.sh.
Re: [PATCH 2/2] golang/xenlight: stop tracking generated files
In reply to Nick RosbrookQuoted 7 lines · Nick Rosbrook
The generated go files were tracked temporarily while the initial implementation of
gengotypes.pywas in progress. They can now be removed and ignored by git and hg.While here, make sure generated files are removed by make clean.
Signed-off-by Nick Rosbrook <[email protected]>
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
In reply to Wei LiuQuoted 13 lines · Wei Liu
Quoted 3 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang
--enable-golang-tools here.
Quoted 6 lines
tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.
Quoted 6 lines
Quoted 1 line
Signed-off-by Nick Rosbrook <[email protected]>Acked-by Wei Liu <[email protected]>Note to self: fix commit message and maybe rerun
autogen.sh.
It doesn't look like that's a typo -- if you want it to be - instead of _, the patch needs to be changed (at least as far as I can tell w/ my admittedly limited automake-foo).
-George
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
Quoted 17 lines · George Dunlap
Quoted 15 lines · Wei Liu
Quoted 3 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang
--enable-golang-tools here.
Quoted 7 lines
tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>
Quoted 8 lines
Quoted 4 lines
Acked-by Wei Liu <[email protected]>Note to self: fix commit message and maybe rerun
autogen.sh.It doesn't look like that's a typo -- if you want it to be
-instead of_, the patch needs to be changed (at least as far as I can tell w/ my admittedly limited automake-foo).
My bad. The code indeed says --enable-golang_tools.
Wei.
Quoted 2 lines
-George
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
In reply to Nick RosbrookQuoted 39 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>--- config/Tools.mk.in | 1 + m4/golang.m4 | 4 ++ tools/Makefile | 2 +- tools/Rules.mk | 2 - tools/configure | 138 +++++++++++++++++++++++++++++++++++++++++++++ tools/configure.ac | 12 ++++ 6 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 m4/golang.m4config/Tools.mk.in +1
-0@@ -55,6 +55,7 @@ CONFIG_QEMU_TRAD := @qemu_traditional@ CONFIG_QEMU_XEN := @qemu_xen@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ CONFIG_LIBNL := @libnl@ +CONFIG_GOLANG_TOOLS := @golang_tools@ CONFIG_SYSTEMD := @systemd@ SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@m4/golang.m4 new file +0
-0
m4/golang.m4 line 4
Quoted 4 lines
m4/golang.m4 new file +4
-0@@ -0,0 +1,4 @@ +AC_DEFUN([AC_PROG_GO], [ + dnl Check for the go compiler + AC_CHECK_TOOL([GO],[go],[no]) +])
AFAICT this only checks for the existence of the binary. Will the bindings compile with all versions of go? If not, should we try to check the version here?
Thanks,
-George
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
Quoted 35 lines · George Dunlap
Quoted 31 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>--- config/Tools.mk.in | 1 + m4/golang.m4 | 4 ++ tools/Makefile | 2 +- tools/Rules.mk | 2 - tools/configure | 138 +++++++++++++++++++++++++++++++++++++++++++++ tools/configure.ac | 12 ++++ 6 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 m4/golang.m4config/Tools.mk.in +1
-0@@ -55,6 +55,7 @@ CONFIG_QEMU_TRAD := @qemu_traditional@ CONFIG_QEMU_XEN := @qemu_xen@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ CONFIG_LIBNL := @libnl@ +CONFIG_GOLANG_TOOLS := @golang_tools@
Quoted 15 lines
m4/golang.m4 line 4
Quoted 12 lines
config/Tools.mk.in +0
-0CONFIG_SYSTEMD := @systemd@ SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@m4/golang.m4 new file +4
-0@@ -0,0 +1,4 @@ +AC_DEFUN([AC_PROG_GO], [ + dnl Check for the go compiler + AC_CHECK_TOOL([GO],[go],[no]) +])AFAICT this only checks for the existence of the binary. Will the bindings compile with all versions of go? If not, should we try to check the version here?
There are no obvious pieces to me that won't compile on fairly recent (i.e. >= 1.9) versions of go, but yes it would probably be best to check for a minimum version. I will do some more work to figure out an appropriate minimum version, but I think go 1.10 might be a reasonable start.
Thanks,
-NR
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
In reply to Wei LiuQuoted 10 lines · Wei Liu
Quoted 3 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang
--enable-golang-tools here.
Quoted 2 lines
tools.
Quoted 7 lines
Quoted 5 lines
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>Acked-by Wei Liu <[email protected]>
Thanks!
-NR
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
In reply to Nick RosbrookQuoted 56 lines · Nick Rosbrook
Quoted 35 lines · George Dunlap
Quoted 31 lines · Nick Rosbrook
By default, if the go compiler is found by the configure script, build the golang tools. If the compiler is not found, and --enable-golang_tools was not explicitly set, do not build to the golang tools.
The new corresponding make variable is
CONFIG_GOLANG_TOOLS. RemoveCONFIG_GOLANGfromtools/Rules.mksince the new variable is set by configure.Signed-off-by Nick Rosbrook <[email protected]>---
config/Tools.mk.in | 1 + m4/golang.m4 | 4 ++ tools/Makefile | 2 +- tools/Rules.mk | 2 - tools/configure | 138 +++++++++++++++++++++++++++++++++++++++++++++ tools/configure.ac | 12 ++++ 6 files changed, 156 insertions(+), 3 deletions(-)create mode 100644 m4/golang.m4
config/Tools.mk.in +0
-0@@ -55,6 +55,7 @@ CONFIG_QEMU_TRAD := @qemu_traditional@
CONFIG_QEMU_XEN:= @qemu_xen@
CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@CONFIG_LIBNL:= @libnl@
+CONFIG_GOLANG_TOOLS := @golang_tools@Quoted 15 lines
m4/golang.m4 line 4
Quoted 12 lines
CONFIG_SYSTEMD:= @systemd@SYSTEMD_CFLAGS:= @SYSTEMD_CFLAGS@m4/golang.m4 new file +4
-0@@ -0,0 +1,4 @@ +AC_DEFUN([AC_PROG_GO], [ + dnl Check for the go compiler + AC_CHECK_TOOL([GO],[go],[no]) +])AFAICT this only checks for the existence of the binary. Will the bindings compile with all versions of go? If not, should we try to check the version here?
Quoted 5 lines
There are no obvious pieces to me that won't compile on fairly recent (i.e. >= 1.9) versions of go, but yes it would probably be best to check for a minimum version. I will do some more work to figure out an appropriate minimum version, but I think go 1.10 might be a reasonable start.
OK — I didn’t mean you had to; I just thought it was worth bringing up.
The underscore thing though — I think it’s a bad idea to mix - and _; —enable-golang_tools just isn’t a good idea IMHO. :-)
Do you need _tools? Could it just be —enable-golang?
-George
Re: [PATCH 1/2] tools: build golang tools if go compiler is present
Quoted 3 lines
The underscore thing though — I think it’s a bad idea to mix
-and_; —enable-golang_tools just isn’t a good idea IMHO. :-)Do you need
_tools? Could it just be —enable-golang?
I agree, I don't like mixing the '-' and '_'. From what I could tell, that was how the other options were named in tools/configure.ac and Tools.mk.in (unless I missed a way to tell the --enable flag to just use '-'), so I went with that. I can just do --enable-golang, but I was trying to make it a bit more descriptive if possible.
-NR
Re: [PATCH 2/2] golang/xenlight: stop tracking generated files
In reply to Nick RosbrookQuoted 10 lines · Nick Rosbrook
The generated go files were tracked temporarily while the initial implementation of
gengotypes.pywas in progress. They can now be removed and ignored by git and hg.While here, make sure generated files are removed by make clean.
Signed-off-by Nick Rosbrook <[email protected]>
Just to be clear, to onlookers (particularly committers): it’s looking like we’re going to leave the generated files in the tree; so this patch is probably obsolete.
-George