mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
build: Allow C programs using libguestfs to be compiled against build dir.
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.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -337,6 +337,7 @@ Makefile.in
|
||||
/lib/libguestfs.syms
|
||||
/lib/.libs/libguestfs.so
|
||||
/lib/libvirt-is-version
|
||||
/lib/local/libguestfs.pc
|
||||
/lib/stamp-guestfs.pod
|
||||
/lib/structs-compare.c
|
||||
/lib/structs-copy.c
|
||||
|
||||
2
common
2
common
Submodule common updated: 7bcea5ce0b...be42b0b8a1
@@ -276,6 +276,7 @@ AC_CONFIG_FILES([Makefile
|
||||
java/examples/Makefile
|
||||
lib/Makefile
|
||||
lib/libguestfs.pc
|
||||
lib/local/libguestfs.pc
|
||||
lua/Makefile
|
||||
lua/examples/Makefile
|
||||
make-fs/Makefile
|
||||
|
||||
@@ -47,6 +47,7 @@ EXTRA_DIST = \
|
||||
$(BUILT_SOURCES) \
|
||||
MAX_PROC_NR \
|
||||
libguestfs.pc.in \
|
||||
local/libguestfs.pc.in \
|
||||
guestfs.pod
|
||||
|
||||
include_HEADERS = guestfs.h
|
||||
|
||||
36
lib/local/libguestfs.pc.in
Normal file
36
lib/local/libguestfs.pc.in
Normal file
@@ -0,0 +1,36 @@
|
||||
# @configure_input@
|
||||
# Copyright (C) 2020 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
# Dummy pkg-config file which is used to allow out of tree packages to
|
||||
# be configured against the libguestfs tree without libguestfs needing
|
||||
# to be installed.
|
||||
#
|
||||
# Note if you are using the ./run script then you don't need to worry
|
||||
# about this because the script sets PKG_CONFIG_PATH correctly.
|
||||
|
||||
prefix=@abs_top_builddir@
|
||||
exec_prefix=@abs_top_builddir@
|
||||
libdir=@abs_top_builddir@/lib/.libs
|
||||
includedir=@abs_top_srcdir@/lib
|
||||
|
||||
Name: libguestfs
|
||||
Version: @VERSION@
|
||||
Description: libguestfs library for accessing and modifying VM images
|
||||
Requires:
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lguestfs
|
||||
5
run.in
5
run.in
@@ -223,6 +223,11 @@ export G_DEBUG=gc-friendly
|
||||
random_val="$(@AWK@ 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
|
||||
export MALLOC_PERTURB_=$random_val
|
||||
|
||||
# Allow dependent packages like virt-v2v to be compiled against
|
||||
# local libguestfs.
|
||||
prepend PKG_CONFIG_PATH "$b/lib/local"
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
# Do we have libtool? If we have it then we can use it to make
|
||||
# running valgrind simpler. However don't depend on it.
|
||||
if libtool --help >/dev/null 2>&1; then
|
||||
|
||||
Reference in New Issue
Block a user