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

Re: [Xen-devel] [PATCH RFC 1/8] golang/xenlight: Create stub package



On 18/01/17 19:56, Ronald Rojas wrote:
> Create a basic Makefile to build and install libxenlight Golang
> bindings. Also add a stub package which only opens libxl context.
> 
> Include a global xenlight.Ctx variable which can be used as the
> default context by the entire program if desired.
> 
> For now, return simple errors. Proper error handling will be
> added in next patch.
> 
> Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx>
> ---
>  tools/Makefile                    | 15 +++++++-
>  tools/golang/xenlight/Makefile    | 29 ++++++++++++++
>  tools/golang/xenlight/xenlight.go | 80 
> +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 123 insertions(+), 1 deletion(-)
>  create mode 100644 tools/golang/xenlight/Makefile
>  create mode 100644 tools/golang/xenlight/xenlight.go
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 77e0723..fd49e7f 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -6,12 +6,13 @@ SUBDIRS-y += include
>  SUBDIRS-y += libs
>  SUBDIRS-y += libxc
>  SUBDIRS-y += flask
> -SUBDIRS-y += fuzz
>  SUBDIRS-y += xenstore
>  SUBDIRS-y += misc
>  SUBDIRS-y += examples
>  SUBDIRS-y += hotplug
>  SUBDIRS-y += xentrace
> +#Uncomment line to build Golang libxl
> +#SUBDIRS-y += golang/xenlight
>  SUBDIRS-$(CONFIG_XCUTILS) += xcutils
>  SUBDIRS-$(CONFIG_X86) += firmware
>  SUBDIRS-y += console
> @@ -322,6 +323,18 @@ subdir-install-debugger/kdd: .phony
>  subdir-all-debugger/kdd: .phony
>       $(MAKE) -C debugger/kdd all
>  
> +subdir-clean-golang/xenlight: .phony
> +     $(MAKE) -C golang/xenlight clean
> +
> +subdir-distclean-golang/xenlight: .phony
> +     $(MAKE) -C golang/xenlight distclean
> +
> +subdir-install-golang/xenlight: .phony
> +     $(MAKE) -C golang/xenlight install
> +
> +subdir-all-golang/xenlight: .phony
> +     $(MAKE) -C golang/xenlight all
> +
>  subdir-distclean-firmware: .phony
>       $(MAKE) -C firmware distclean
>  
> diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
> new file mode 100644
> index 0000000..a45336b
> --- /dev/null
> +++ b/tools/golang/xenlight/Makefile
> @@ -0,0 +1,29 @@
> +XEN_ROOT=$(CURDIR)/../../..
> +include $(XEN_ROOT)/tools/Rules.mk
> +
> +BINARY = xenlightgo
> +GO = go
> +
> +.PHONY: all
> +all: build
> +
> +.PHONY: build
> +build: xenlight
> +
> +.PHONY: install
> +install: build
> +     ! [ -f $(BINARY) ] || $(INSTALL_PROG) xenlight.go $(DESTDIR)$(bindir)
> +
> +.PHONY: clean
> +clean:
> +     $(RM) $(BINARY)
> +
> +.PHONY: distclean
> +distclean: clean
> +
> +
> +xenlight: xenlight.go
> +     $(GO) build -o $(BINARY) xenlight.go

Actually, one more thing here -- this will build using whatever version
of libxl you have installed *on the host system*, not the one you just
build as part of the build process.

You need to point the go compiler to use the version of libxl you've
just built in-tree, like this:

CGO_CFLAGS = -I$(DESTDIR)$(includedir)
CGO_LDFLAGS = -L$(DESTDIR)$(libdir) -Wl,-rpath-link=$(DESTDIR)$(libdir)
xenlight: xenlight.go
        CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) build -o
$(BINARY) xenlight.go


 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.