Skip to contentSkip to conversation

libxl: provide xenlight.pc

PATCH Applied Wei Liu 4 participants 8 messages Jan 9, 2015 – Jan 19, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: provide xenlight.pc

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 .gitignore                    |    2 ++
 config/Paths.mk.in            |    2 +-
 m4/paths.m4                   |    3 +++
 tools/configure.ac            |    1 +
 tools/libxl/Makefile          |   11 ++++++++++-
 tools/libxl/xenlight.pc.in.in |   11 +++++++++++
 6 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 tools/libxl/xenlight.pc.in.in
.gitignore +2 -0
index 8c8c06f..21f0ca6 100644
@@ -158,6 +158,8 @@ tools/include/xen/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
 tools/libxl/libxlu_cfg_y.output
+tools/libxl/xenlight.pc
+tools/libxl/xenlight.pc.in
 tools/libxl/xl
 tools/libxl/testenum
 tools/libxl/testenum.c
config/Paths.mk.in +1 -1
index fe10f76..150bae7 100644
@@ -57,7 +57,7 @@ BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
-XENFIRMWAREDIR           := $(LIBEXEC)/boot
+XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
 XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
m4/paths.m4 +3 -0
index 7ede5bd..db74f55 100644
@@ -77,6 +77,9 @@ dnl This variable will be substituted in various .in files
 LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
 AC_SUBST(LIBEXEC_BIN)
 
+XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
+AC_SUBST(XENFIRMWAREDIR)
+
 XEN_RUN_DIR=$localstatedir/run/xen
 AC_SUBST(XEN_RUN_DIR)
 
tools/configure.ac +1 -0
index 1ac63a3..741c36c 100644
@@ -27,6 +27,7 @@ hotplug/Linux/xen-backend.rules
 hotplug/Linux/xen-hotplug-common.sh
 hotplug/Linux/xendomains
 hotplug/NetBSD/rc.d/xencommons
+libxl/xenlight.pc.in
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
tools/libxl/Makefile +10 -1
index df08c8a..b6d5d22 100644
@@ -143,13 +143,15 @@ $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 
+PKG_CONFIG = xenlight.pc
+
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
 testidl.c: libxl_types.idl gentest.py libxl.h $(AUTOINCS)
 	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
 	mv testidl.c.new testidl.c
 
 .PHONY: all
-all: $(CLIENTS) $(TEST_PROGS) \
+all: $(CLIENTS) $(TEST_PROGS) $(PKG_CONFIG) \
 		libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
@@ -248,6 +250,10 @@ libxl-save-helper: $(SAVE_HELPER_OBJS) libxenlight.so
 testidl: testidl.o libxlutil.so libxenlight.so
 	$(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xenlight.pc: xenlight.pc.in Makefile
+	@sed -e 's/@@version@@/$(MAJOR).$(MINOR)/g' < xenlight.pc.in > [email protected]
+	@mv -f [email protected] $@
+
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
@@ -255,6 +261,7 @@ install: all
 	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/pkgconfig
 	$(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR)
 	$(INSTALL_PROG) xen-init-dom0 $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(LIBEXEC_BIN)
@@ -268,12 +275,14 @@ install: all
 	$(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
 	$(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
+	$(INSTALL_DATA) xenlight.pc $(DESTDIR)$(SHAREDIR)/pkgconfig/
 
 .PHONY: clean
 clean:
 	$(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
 	$(RM) -f _*.c *.pyc _paths.*.tmp _*.api-for-check
 	$(RM) -f testidl.c.new testidl.c *.api-ok
+	$(RM) -f xenlight.pc xenlight.pc.in
 
 distclean: clean
 
tools/libxl/xenlight.pc.in.in new file +11 -0
new file mode 100644
index 0000000..c27872e
@@ -0,0 +1,11 @@
+prefix=@prefix@
+includedir=@includedir@
+libdir=@libdir@
+xenfirmwaredir=@XENFIRMWAREDIR@
+libexec_bin=@LIBEXEC_BIN@
+
+Name: Xenlight
+Description: The Xenlight library for Xen hypervisor
+Version: @@version@@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lxenlight
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wei Liu

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>

This seems like a reasonable thing to provide and the manner which you do so seems sane. I've not actually read any pkg-config specs to check the content, but it looks plausible:

We ought to consider if there are any other libraries we should do this for, I think non-stable API ones like libxenctrl/guest should be explicitly excluded.

Ian.

#2 lore raw
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Wei Liu

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Please rerun autogen.sh after applying this patch.

Forgot to reply to this earlier:

Should there really be another file.in.in.in.in mess? I think the major/minor values could be placed into some m4 file so that they can be substituted properly by configure.

Olaf

author
#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Wei Liu

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Please rerun autogen.sh after applying this patch.

Forgot to reply to this earlier:

Should there really be another file.in.in.in.in mess? I think the major/minor values could be placed into some m4 file so that they can be substituted properly by configure.

I was two minded when I wrote this path. On one hand I didn't want to place a m4 file here, on the other I didn't want to leak library version numbers to top level m4 directory. Finally I decided to do the .in.in trick.

So if you have an argument for either of these please convince me... Or you have other idea about file placement please tell me.

Wei.

Quoted 1 line

Olaf

#4 lore raw
Quoted 18 lines · Wei Liu
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Wei Liu

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Please rerun autogen.sh after applying this patch.

Forgot to reply to this earlier:

Should there really be another file.in.in.in.in mess? I think the major/minor values could be placed into some m4 file so that they can be substituted properly by configure.

Quoted 7 lines

I was two minded when I wrote this path. On one hand I didn't want to place a m4 file here, on the other I didn't want to leak library version numbers to top level m4 directory. Finally I decided to do the .in.in trick.

So if you have an argument for either of these please convince me... Or you have other idea about file placement please tell me.

I think the library SONAME belongs in the relevant Makefile, not hidden in the m4 somewhere. Which I think necessitates .in.in. I think we can live with that.

Ian.

#5 lore raw
In reply to Ian Campbell

Ian Campbell writes ("Re: [PATCH] libxl: provide xenlight.pc"):

Quoted 5 lines · Wei Liu
Quoted 4 lines

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

...

Quoted 3 lines

This seems like a reasonable thing to provide and the manner which you do so seems sane. I've not actually read any pkg-config specs to check the content, but it looks plausible:

Thanks, Ian. (I haven't checked the supplied .pc file.)

Quoted 5 lines

We ought to consider if there are any other libraries we should do this for, I think non-stable API ones like libxenctrl/guest should be explicitly excluded.

The obvious one is xenstore. I'm not sure how much we want to consider that to have a stable API.

Also, what about libxl users who want to use xentoollog ?

Ian.

#6 lore raw
Quoted 15 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH] libxl: provide xenlight.pc"):

Quoted 5 lines · Wei Liu
Quoted 4 lines

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

...

Quoted 3 lines

This seems like a reasonable thing to provide and the manner which you do so seems sane. I've not actually read any pkg-config specs to check the content, but it looks plausible:

Thanks, Ian. (I haven't checked the supplied .pc file.)

Quoted 2 lines
Quoted 8 lines
Quoted 3 lines

We ought to consider if there are any other libraries we should do this for, I think non-stable API ones like libxenctrl/guest should be explicitly excluded.

The obvious one is xenstore. I'm not sure how much we want to consider that to have a stable API.

Also, what about libxl users who want to use xentoollog ?

I think both of those should be candidates for a .pc file, but that needn't block this patch IMHO.

xentoollog could do with moving out of tools/libxc, but ISTR trying that years ago and it turned into a yakk of some sort.

Ian.

Applied
#7 lore raw
In reply to Ian Jackson
Quoted 6 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH] libxl: provide xenlight.pc"):

Quoted 5 lines · Wei Liu
Quoted 4 lines

A pkg-config file for libxl. It also contains two variables (xenfirmwaredir and libexec_bin) so that tools that are very keen on knowing the locations of Xen binaries (say, libvirt) can use them to determine the location of the binaries.

Quoted 8 lines

...

Quoted 3 lines

This seems like a reasonable thing to provide and the manner which you do so seems sane. I've not actually read any pkg-config specs to check the content, but it looks plausible:

Thanks, Ian. (I haven't checked the supplied .pc file.)

Quoted 1 line

Applied, thanks.

Quoted 8 lines
Quoted 3 lines

We ought to consider if there are any other libraries we should do this for, I think non-stable API ones like libxenctrl/guest should be explicitly excluded.

The obvious one is xenstore. I'm not sure how much we want to consider that to have a stable API.

Also, what about libxl users who want to use xentoollog ?

I figured there was no point waiting for these, they can happen as and when.

Ian.