[Libguestfs] [PATCH 1/2] golang: Fix for out-of-tree builds

Hilko Bengen bengen at hilluzination.de
Fri Dec 13 17:53:50 UTC 2013


* Richard W.M. Jones:

> I think the vvv below part is a hack and we shouldn't put it upstream.
> I appreciate how complicated Go packaging is, as it defies proper
> distro packaging, but I still don't want to take this.

This is what we do for the Perl bindings in hivex...

,----[ hivex/perl/Makefile.am ]
| Makefile-pl: Makefile.PL
| 	-[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/.
| 	perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
`----

... and from what I have seen, the Golang build tool has similarly
strong opinions on how project directories should be laid out.

What about a simple symlink, like this?

,----
| diff --git a/golang/Makefile.am b/golang/Makefile.am
| index 58cafc6..ba13691 100644
| --- a/golang/Makefile.am
| +++ b/golang/Makefile.am
| @@ -49,6 +49,7 @@ golangpkg_DATA = \
|  	pkg/$(GOOS)_$(GOARCH)/$(pkg).a
|  
|  pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go
| +	-[ $(srcdir) != $(builddir) ] && ln -s $(abs_srcdir)/src $(builddir)/src
|  	$(top_builddir)/run $(GOLANG) install $(pkg)
|  
|  golangsrc_DATA = $(source_files)
| @@ -62,4 +63,5 @@ endif
|  CLEANFILES = *~ src/$(pkg)/*~
|  
|  clean-local:
| +	-[ $(srcdir) != $(builddir) ] && rm -f $(builddir)/src
|  	rm -rf pkg
`----

Cheers,
-Hilko




More information about the Libguestfs mailing list