diff mbox series

tools/go: honor append build flags

Message ID 20210707071531.69001-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series tools/go: honor append build flags | expand

Commit Message

Roger Pau Monne July 7, 2021, 7:15 a.m. UTC
Make the go build use APPEND_{C/LD}FLAGS when necessary, just like
other parts of the build.

Reported-by: Ting-Wei Lan <lantw44@gmail.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Note sure if it's the best way to add the appended flags, I'm not
familiar with the go build system. In any case this fixes the build
when required libraries (ie: yajl) are not part of the system search
path and instead passed in APPEND_{C/LD}FLAGS.
---
 tools/golang/xenlight/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Rosbrook July 7, 2021, 1:42 p.m. UTC | #1
On Wed, Jul 07, 2021 at 09:15:31AM +0200, Roger Pau Monne wrote:
> Make the go build use APPEND_{C/LD}FLAGS when necessary, just like
> other parts of the build.
> 
> Reported-by: Ting-Wei Lan <lantw44@gmail.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Note sure if it's the best way to add the appended flags, I'm not
> familiar with the go build system. In any case this fixes the build
> when required libraries (ie: yajl) are not part of the system search
> path and instead passed in APPEND_{C/LD}FLAGS.

This is right. The CGO_{C,LD}FLAGS environment variables basically work
just like regular {C,LD}FLAGS.

> ---
>  tools/golang/xenlight/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
> index e394ef9b2b..64671f246c 100644
> --- a/tools/golang/xenlight/Makefile
> +++ b/tools/golang/xenlight/Makefile
> @@ -27,7 +27,7 @@ GOXL_GEN_FILES = types.gen.go helpers.gen.go
>  # so that it can find the actual library.
>  .PHONY: build
>  build: xenlight.go $(GOXL_GEN_FILES)
> -	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
> +	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
>  
>  .PHONY: install
>  install: build
> -- 
> 2.31.1
> 
> 
Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com>

Thanks,
NR
Roger Pau Monne Sept. 13, 2021, 11:20 a.m. UTC | #2
On Wed, Jul 07, 2021 at 09:42:20AM -0400, Nick Rosbrook wrote:
> On Wed, Jul 07, 2021 at 09:15:31AM +0200, Roger Pau Monne wrote:
> > Make the go build use APPEND_{C/LD}FLAGS when necessary, just like
> > other parts of the build.
> > 
> > Reported-by: Ting-Wei Lan <lantw44@gmail.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Note sure if it's the best way to add the appended flags, I'm not
> > familiar with the go build system. In any case this fixes the build
> > when required libraries (ie: yajl) are not part of the system search
> > path and instead passed in APPEND_{C/LD}FLAGS.
> 
> This is right. The CGO_{C,LD}FLAGS environment variables basically work
> just like regular {C,LD}FLAGS.
> 
> > ---
> >  tools/golang/xenlight/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
> > index e394ef9b2b..64671f246c 100644
> > --- a/tools/golang/xenlight/Makefile
> > +++ b/tools/golang/xenlight/Makefile
> > @@ -27,7 +27,7 @@ GOXL_GEN_FILES = types.gen.go helpers.gen.go
> >  # so that it can find the actual library.
> >  .PHONY: build
> >  build: xenlight.go $(GOXL_GEN_FILES)
> > -	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
> > +	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
> >  
> >  .PHONY: install
> >  install: build
> > -- 
> > 2.31.1
> > 
> > 
> Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com>

Ping?

Unless someone else has opinions I think this is ready to be
committed. Can a committer please queue it up?

Thanks, Roger.
Ian Jackson Sept. 13, 2021, 12:39 p.m. UTC | #3
Roger Pau Monné writes ("Re: [PATCH] tools/go: honor append build flags"):
> Unless someone else has opinions I think this is ready to be
> committed. Can a committer please queue it up?

Thanks for the ping.  Committed, with my ack.

Thanks,
Ian.
diff mbox series

Patch

diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
index e394ef9b2b..64671f246c 100644
--- a/tools/golang/xenlight/Makefile
+++ b/tools/golang/xenlight/Makefile
@@ -27,7 +27,7 @@  GOXL_GEN_FILES = types.gen.go helpers.gen.go
 # so that it can find the actual library.
 .PHONY: build
 build: xenlight.go $(GOXL_GEN_FILES)
-	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog)" $(GO) build -x
+	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
 
 .PHONY: install
 install: build