[libvirt] [PATCH 0/3] Improve pkg-config files

This is a small set of fixes and improvements to the pkg-config files, ultimately allowing external apps to build against libvirt source tree Daniel P. Berrange (3): Don't include @LIBS@ in libvirt.pc.in file Add pkg-config files for libvirt-qemu & libvirt-lxc Add pkg-config files to allow deps to build against source tree .gitignore | 3 ++- Makefile.am | 4 +++- configure.ac | 8 +++++++- libvirt-lxc.pc.in | 14 ++++++++++++++ libvirt-qemu.pc.in | 14 ++++++++++++++ libvirt.pc.in | 5 ++++- libvirt.spec.in | 15 ++++++++++++--- mingw-libvirt.spec.in | 2 ++ src/Makefile.am | 8 +++++++- src/libvirt-lxc.pc.in | 18 ++++++++++++++++++ src/libvirt-qemu.pc.in | 18 ++++++++++++++++++ src/libvirt.pc.in | 23 +++++++++++++++++++++++ 12 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 libvirt-lxc.pc.in create mode 100644 libvirt-qemu.pc.in create mode 100644 src/libvirt-lxc.pc.in create mode 100644 src/libvirt-qemu.pc.in create mode 100644 src/libvirt.pc.in -- 1.9.3

The libvirt.pc file we install is ending up polluted with a load of compiler flags that should be private to the libvirt build. eg Libs: -L${libdir} -lvirt -ldl -O2 -g -pipe -Wall \ -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \ -fstack-protector-strong --param=ssp-buffer-size=4 \ -grecord-gcc-switches -m64 -mtune=generic this is caused by including @LIBS@ in the Libs: line of the pkgconfig.pc.in file. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt.pc.in b/libvirt.pc.in index d456a88..58645d9 100644 --- a/libvirt.pc.in +++ b/libvirt.pc.in @@ -12,5 +12,5 @@ Name: libvirt Version: @VERSION@ Description: libvirt library Requires: -Libs: -L${libdir} -lvirt @LIBS@ +Libs: -L${libdir} -lvirt Cflags: -I${includedir} -- 1.9.3

On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
The libvirt.pc file we install is ending up polluted with a load of compiler flags that should be private to the libvirt build. eg
Libs: -L${libdir} -lvirt -ldl -O2 -g -pipe -Wall \ -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \ -fstack-protector-strong --param=ssp-buffer-size=4 \ -grecord-gcc-switches -m64 -mtune=generic
this is caused by including @LIBS@ in the Libs: line of the pkgconfig.pc.in file.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

For some reason there have never been pkg-config files created for the libvirt-qemu.so and libvirt-lxc.so libraries. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- .gitignore | 2 +- Makefile.am | 4 +++- configure.ac | 5 ++++- libvirt-lxc.pc.in | 14 ++++++++++++++ libvirt-qemu.pc.in | 14 ++++++++++++++ libvirt.pc.in | 3 +++ libvirt.spec.in | 15 ++++++++++++--- mingw-libvirt.spec.in | 2 ++ 8 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 libvirt-lxc.pc.in create mode 100644 libvirt-qemu.pc.in diff --git a/.gitignore b/.gitignore index 8c3b870..a3d992f 100644 --- a/.gitignore +++ b/.gitignore @@ -84,7 +84,7 @@ /libtool /libvirt-*.tar.gz /libvirt-[0-9]* -/libvirt.pc +/libvirt*.pc /libvirt.spec /ltconfig /ltmain.sh diff --git a/Makefile.am b/Makefile.am index abc5a2f..a374e1a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,6 +38,8 @@ EXTRA_DIST = \ libvirt.spec libvirt.spec.in \ mingw-libvirt.spec.in \ libvirt.pc.in \ + libvirt-qemu.pc.in \ + libvirt-lxc.pc.in \ autobuild.sh \ Makefile.nonreentrant \ autogen.sh \ @@ -47,7 +49,7 @@ EXTRA_DIST = \ $(XML_EXAMPLES) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libvirt.pc +pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ diff --git a/configure.ac b/configure.ac index 710cb71..c2094d5 100644 --- a/configure.ac +++ b/configure.ac @@ -2727,7 +2727,10 @@ AC_CONFIG_FILES([\ docs/schemas/Makefile \ gnulib/lib/Makefile \ gnulib/tests/Makefile \ - libvirt.pc libvirt.spec mingw-libvirt.spec \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + libvirt.spec mingw-libvirt.spec \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ daemon/Makefile \ diff --git a/libvirt-lxc.pc.in b/libvirt-lxc.pc.in new file mode 100644 index 0000000..d78ccb6 --- /dev/null +++ b/libvirt-lxc.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ + +libvirt_lxc_api=@datadir@/libvirt/api/libvirt-lxc-api.xml + +Name: libvirt-lxc +Version: @VERSION@ +Description: libvirt LXC library +Requires: libvirt +Libs: -L${libdir} -lvirt-lxc +Cflags: -I${includedir} diff --git a/libvirt-qemu.pc.in b/libvirt-qemu.pc.in new file mode 100644 index 0000000..0cb336a --- /dev/null +++ b/libvirt-qemu.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ + +libvirt_qemu_api=@datadir@/libvirt/api/libvirt-qemu-api.xml + +Name: libvirt-qemu +Version: @VERSION@ +Description: libvirt QEMU library +Requires: libvirt +Libs: -L${libdir} -lvirt-qemu +Cflags: -I${includedir} diff --git a/libvirt.pc.in b/libvirt.pc.in index 58645d9..a81df61 100644 --- a/libvirt.pc.in +++ b/libvirt.pc.in @@ -5,6 +5,9 @@ includedir=@includedir@ datarootdir=@datarootdir@ libvirt_api=@datadir@/libvirt/api/libvirt-api.xml + +# For compat with older versions - also present +# in libvirt-qemu.pc / libvirt-lxc.pc libvirt_qemu_api=@datadir@/libvirt/api/libvirt-qemu-api.xml libvirt_lxc_api=@datadir@/libvirt/api/libvirt-lxc-api.xml diff --git a/libvirt.spec.in b/libvirt.spec.in index 344748c..2ec7eed 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -2148,7 +2148,9 @@ exit 0 %{_bindir}/virt-xml-validate %{_bindir}/virt-pki-validate %{_bindir}/virt-host-validate -%{_libdir}/lib*.so.* +%{_libdir}/libvirt.so.* +%{_libdir}/libvirt-qemu.so.* +%{_libdir}/libvirt-lxc.so.* %if %{with_dtrace} %{_datadir}/systemtap/tapset/libvirt_probes*.stp @@ -2205,10 +2207,17 @@ exit 0 %files devel %defattr(-, root, root) -%{_libdir}/lib*.so +%{_libdir}/libvirt.so +%{_libdir}/libvirt-qemu.so +%{_libdir}/libvirt-lxc.so %dir %{_includedir}/libvirt -%{_includedir}/libvirt/*.h +%{_includedir}/libvirt/virterror.h +%{_includedir}/libvirt/libvirt.h +%{_includedir}/libvirt/libvirt-qemu.h +%{_includedir}/libvirt/libvirt-lxc.h %{_libdir}/pkgconfig/libvirt.pc +%{_libdir}/pkgconfig/libvirt-qemu.pc +%{_libdir}/pkgconfig/libvirt-lxc.pc %dir %{_datadir}/libvirt/api/ %{_datadir}/libvirt/api/libvirt-api.xml diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 1b505e6..91c2dc2 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -195,6 +195,8 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh %{mingw32_libdir}/libvirt.dll.a %{mingw32_libdir}/pkgconfig/libvirt.pc +%{mingw32_libdir}/pkgconfig/libvirt-qemu.pc +%{mingw32_libdir}/pkgconfig/libvirt-lxc.pc %{mingw32_libdir}/libvirt-lxc.dll.a %{mingw32_libdir}/libvirt-qemu.dll.a -- 1.9.3

On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
For some reason there have never been pkg-config files created for the libvirt-qemu.so and libvirt-lxc.so libraries.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- .gitignore | 2 +- Makefile.am | 4 +++- configure.ac | 5 ++++- libvirt-lxc.pc.in | 14 ++++++++++++++ libvirt-qemu.pc.in | 14 ++++++++++++++ libvirt.pc.in | 3 +++ libvirt.spec.in | 15 ++++++++++++--- mingw-libvirt.spec.in | 2 ++ 8 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 libvirt-lxc.pc.in create mode 100644 libvirt-qemu.pc.in
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

When testing language bindings it is useful to be able to build them against an uninstalled libvirt source tree. Add a dummy set of pkg-config files to allow for this. This can be used by setting export PKG_CONFIG_PATH=/path/to/libvirt/git/src Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- .gitignore | 1 + configure.ac | 3 +++ src/Makefile.am | 8 +++++++- src/libvirt-lxc.pc.in | 18 ++++++++++++++++++ src/libvirt-qemu.pc.in | 18 ++++++++++++++++++ src/libvirt.pc.in | 23 +++++++++++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/libvirt-lxc.pc.in create mode 100644 src/libvirt-qemu.pc.in create mode 100644 src/libvirt.pc.in diff --git a/.gitignore b/.gitignore index a3d992f..2d4d401 100644 --- a/.gitignore +++ b/.gitignore @@ -98,6 +98,7 @@ /run /sc_* /src/.*.stamp +/src/*.pc /src/access/org.libvirt.api.policy /src/access/viraccessapicheck.c /src/access/viraccessapicheck.h diff --git a/configure.ac b/configure.ac index c2094d5..060a88a 100644 --- a/configure.ac +++ b/configure.ac @@ -2730,6 +2730,9 @@ AC_CONFIG_FILES([\ libvirt.pc \ libvirt-qemu.pc \ libvirt-lxc.pc \ + src/libvirt.pc \ + src/libvirt-qemu.pc \ + src/libvirt-lxc.pc \ libvirt.spec mingw-libvirt.spec \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ diff --git a/src/Makefile.am b/src/Makefile.am index 2b9ac61..bcd119b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,13 @@ AM_LDFLAGS = $(DRIVER_MODULE_LDFLAGS) \ $(NO_INDIRECT_LDFLAGS) \ $(NULL) -EXTRA_DIST = $(conf_DATA) util/keymaps.csv +EXTRA_DIST = \ + $(conf_DATA) \ + util/keymaps.csv \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + $(NULL) BUILT_SOURCES = CLEANFILES = diff --git a/src/libvirt-lxc.pc.in b/src/libvirt-lxc.pc.in new file mode 100644 index 0000000..20f173b --- /dev/null +++ b/src/libvirt-lxc.pc.in @@ -0,0 +1,18 @@ +# Dummy pkg-config file to allow lang bindings +# to build against a libvirt source tree eg +# export PKG_CONFIG_PATH=/path/to/libvirt/git/src + +prefix=@abs_top_builddir@ +exec_prefix=@abs_top_builddir@ +libdir=@abs_top_builddir@/src +includedir=@abs_top_builddir@/include +datarootdir=@abs_top_builddir@ + +libvirt_lxc_api=@datadir@/docs/libvirt-lxc-api.xml + +Name: libvirt +Version: @VERSION@ +Description: libvirt LXC library +Requires: +Libs: -L${libdir} -lvirt-lxc +Cflags: -I${includedir} diff --git a/src/libvirt-qemu.pc.in b/src/libvirt-qemu.pc.in new file mode 100644 index 0000000..1e2cadf --- /dev/null +++ b/src/libvirt-qemu.pc.in @@ -0,0 +1,18 @@ +# Dummy pkg-config file to allow lang bindings +# to build against a libvirt source tree eg +# export PKG_CONFIG_PATH=/path/to/libvirt/git/src + +prefix=@abs_top_builddir@ +exec_prefix=@abs_top_builddir@ +libdir=@abs_top_builddir@/src +includedir=@abs_top_builddir@/include +datarootdir=@abs_top_builddir@ + +libvirt_qemu_api=@datadir@/docs/libvirt-qemu-api.xml + +Name: libvirt +Version: @VERSION@ +Description: libvirt QEMU library +Requires: +Libs: -L${libdir} -lvirt-qemu +Cflags: -I${includedir} diff --git a/src/libvirt.pc.in b/src/libvirt.pc.in new file mode 100644 index 0000000..fa798cf --- /dev/null +++ b/src/libvirt.pc.in @@ -0,0 +1,23 @@ +# Dummy pkg-config file to allow lang bindings +# to build against a libvirt source tree eg +# export PKG_CONFIG_PATH=/path/to/libvirt/git/src + +prefix=@abs_top_builddir@ +exec_prefix=@abs_top_builddir@ +libdir=@abs_top_builddir@/src +includedir=@abs_top_builddir@/include +datarootdir=@abs_top_builddir@ + +libvirt_api=@datadir@/docs/libvirt-api.xml + +# For compat with older versions - also present +# in libvirt-qemu.pc / libvirt-lxc.pc +libvirt_qemu_api=@datadir@/docs/libvirt-qemu-api.xml +libvirt_lxc_api=@datadir@/docs/libvirt-lxc-api.xml + +Name: libvirt +Version: @VERSION@ +Description: libvirt library +Requires: +Libs: -L${libdir} -lvirt +Cflags: -I${includedir} -- 1.9.3

On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
When testing language bindings it is useful to be able to build them against an uninstalled libvirt source tree. Add a dummy set of pkg-config files to allow for this. This can be used by setting
export PKG_CONFIG_PATH=/path/to/libvirt/git/src
Yay - we need to document this trick in libvirt-python.git as well.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- .gitignore | 1 + configure.ac | 3 +++ src/Makefile.am | 8 +++++++- src/libvirt-lxc.pc.in | 18 ++++++++++++++++++ src/libvirt-qemu.pc.in | 18 ++++++++++++++++++ src/libvirt.pc.in | 23 +++++++++++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/libvirt-lxc.pc.in create mode 100644 src/libvirt-qemu.pc.in create mode 100644 src/libvirt.pc.in
+++ b/src/Makefile.am @@ -45,7 +45,13 @@ AM_LDFLAGS = $(DRIVER_MODULE_LDFLAGS) \ $(NO_INDIRECT_LDFLAGS) \ $(NULL)
-EXTRA_DIST = $(conf_DATA) util/keymaps.csv +EXTRA_DIST = \ + $(conf_DATA) \ + util/keymaps.csv \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + $(NULL)
NACK to this hunk - the .pc files should NOT be part of the tarball, because they contain contents that depend on configure results, while the tarball must be independent. End users will get their own .pc file as soon as they do ./configure && make. ACK to the rest. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, Jun 20, 2014 at 01:02:46PM -0600, Eric Blake wrote:
On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
When testing language bindings it is useful to be able to build them against an uninstalled libvirt source tree. Add a dummy set of pkg-config files to allow for this. This can be used by setting
export PKG_CONFIG_PATH=/path/to/libvirt/git/src
Yay - we need to document this trick in libvirt-python.git as well.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- .gitignore | 1 + configure.ac | 3 +++ src/Makefile.am | 8 +++++++- src/libvirt-lxc.pc.in | 18 ++++++++++++++++++ src/libvirt-qemu.pc.in | 18 ++++++++++++++++++ src/libvirt.pc.in | 23 +++++++++++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/libvirt-lxc.pc.in create mode 100644 src/libvirt-qemu.pc.in create mode 100644 src/libvirt.pc.in
+++ b/src/Makefile.am @@ -45,7 +45,13 @@ AM_LDFLAGS = $(DRIVER_MODULE_LDFLAGS) \ $(NO_INDIRECT_LDFLAGS) \ $(NULL)
-EXTRA_DIST = $(conf_DATA) util/keymaps.csv +EXTRA_DIST = \ + $(conf_DATA) \ + util/keymaps.csv \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + $(NULL)
NACK to this hunk - the .pc files should NOT be part of the tarball, because they contain contents that depend on configure results, while the tarball must be independent. End users will get their own .pc file as soon as they do ./configure && make.
Obviously that was meant to be the .pc.in files Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 06/23/2014 02:52 AM, Daniel P. Berrange wrote:
On Fri, Jun 20, 2014 at 01:02:46PM -0600, Eric Blake wrote:
On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
When testing language bindings it is useful to be able to build them against an uninstalled libvirt source tree. Add a dummy set of pkg-config files to allow for this. This can be used by setting
export PKG_CONFIG_PATH=/path/to/libvirt/git/src
Yay - we need to document this trick in libvirt-python.git as well.
-EXTRA_DIST = $(conf_DATA) util/keymaps.csv +EXTRA_DIST = \ + $(conf_DATA) \ + util/keymaps.csv \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + $(NULL)
NACK to this hunk - the .pc files should NOT be part of the tarball, because they contain contents that depend on configure results, while the tarball must be independent. End users will get their own .pc file as soon as they do ./configure && make.
Obviously that was meant to be the .pc.in files
Doesn't automake automatically ship any .in file that are required by their use in AC_CONFIG_FILES? [I'd have to actually test 'make dist' to prove one way or the other.] But if not, then yes, adding the .pc.in files to EXTRA_DIST is appropriate. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Jun 23, 2014 at 09:15:19AM -0600, Eric Blake wrote:
On 06/23/2014 02:52 AM, Daniel P. Berrange wrote:
On Fri, Jun 20, 2014 at 01:02:46PM -0600, Eric Blake wrote:
On 06/20/2014 10:51 AM, Daniel P. Berrange wrote:
When testing language bindings it is useful to be able to build them against an uninstalled libvirt source tree. Add a dummy set of pkg-config files to allow for this. This can be used by setting
export PKG_CONFIG_PATH=/path/to/libvirt/git/src
Yay - we need to document this trick in libvirt-python.git as well.
-EXTRA_DIST = $(conf_DATA) util/keymaps.csv +EXTRA_DIST = \ + $(conf_DATA) \ + util/keymaps.csv \ + libvirt.pc \ + libvirt-qemu.pc \ + libvirt-lxc.pc \ + $(NULL)
NACK to this hunk - the .pc files should NOT be part of the tarball, because they contain contents that depend on configure results, while the tarball must be independent. End users will get their own .pc file as soon as they do ./configure && make.
Obviously that was meant to be the .pc.in files
Doesn't automake automatically ship any .in file that are required by their use in AC_CONFIG_FILES? [I'd have to actually test 'make dist' to prove one way or the other.] But if not, then yes, adding the .pc.in files to EXTRA_DIST is appropriate.
You're right, it isn't needed at all. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake