[Libguestfs] [PATCH libguestfs 1/2] build: Allow C programs using libguestfs to be compiled against build dir.

Richard W.M. Jones rjones at redhat.com
Wed Mar 11 14:23:28 UTC 2020


On Wed, Mar 11, 2020 at 06:52:04AM -0500, Eric Blake wrote:
> On 3/10/20 10:05 AM, Richard W.M. Jones wrote:
> >We use a similar trick to libvirt to allow external C programs that
> >use libguestfs to be compiled against the built (but not installed)
> >libguestfs with:
> >
> >   ../libguestfs/run ./configure
> >   make
> >
> >What actually happens is we have a second pkg-config file
> >(lib/local/libguestfs.pc) which points to the locally built
> >libguestfs.  The ./run script sets up PKG_CONFIG_PATH to point to this
> >directory.  Assuming that ./configure is using pkg-config/pkgconf and
> >not some other half-baked solution it will pick up the libguestfs.pc
> >file from here which will set CFLAGS and LIBS appropriately.
> >---
> >  .gitignore                 |  1 +
> >  configure.ac               |  1 +
> >  lib/Makefile.am            |  1 +
> >  lib/local/libguestfs.pc.in | 36 ++++++++++++++++++++++++++++++++++++
> >  run.in                     |  5 +++++
> >  5 files changed, 44 insertions(+)
> >
> 
> I like it. Should we do the same for libnbd's run script?

The trick was actually copied from libvirt so I can't really take
credit for it.  Re libnbd, yes it seems worthwhile.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list