[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools: tweak tools/libs/libs.mk for being able to support libxenctrl

commit d400dc5729e4e132d61c2e7df57d81aaed762044
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Sun Aug 23 10:00:12 2020 +0200
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Fri Aug 28 09:02:13 2020 +0000

    tools: tweak tools/libs/libs.mk for being able to support libxenctrl
    tools/libs/libs.mk needs to be modified for being able to support
    building libxenctrl, as the pkg-config file of that library is not
    following the same conventions as those of the other libraries.
    So add support for specifying PKG_CONFIG before including libs.mk.
    In order to make life easier for unstable libraries like libxenctrl
    set MAJOR and MINOR automatically to the Xen-version and 0 when not
    specified. This removes the need to bump the versions of unstable
    libraries when switching to a new Xen version.
    As all libraries built via libs.mk require a map file generate a dummy
    one in case there is none existing. This again will help avoiding the
    need to bump the libarary version in the map file of an unstable
    library in case it is exporting all symbols.
    The clean target is missing the removal of _paths.h.
    Finally drop the foreach loop when setting PKG_CONFIG_LOCAL, as there
    is always only one element in PKG_CONFIG.
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
 tools/libs/libs.mk | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 19efc5e743..8b1ca2aa62 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -1,10 +1,13 @@
 # Common Makefile for building a lib.
 # Variables taken as input:
-#   MAJOR:   major version of lib
-#   MINOR:   minor version of lib
+#   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
+#   MAJOR:   major version of lib (Xen version if empty)
+#   MINOR:   minor version of lib (0 if empty)
 LIBNAME := $(notdir $(CURDIR))
+MAJOR ?= $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
+MINOR ?= 0
 SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
@@ -22,7 +25,7 @@ ifneq ($(nosharedlibs),y)
 LIB += libxen$(LIBNAME).so
@@ -32,7 +35,7 @@ $(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
 LIBHEADERS = $(foreach h, $(LIBHEADER), include/$(h))
 all: build
 .PHONY: build
-build: libs
+build: libs libxen$(LIBNAME).map
 .PHONY: libs
 libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
@@ -64,6 +67,9 @@ endif
+       echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
        for i in $(realpath $(LIBHEADERS)); do ln -sf $$i 
$(XEN_ROOT)/tools/include; done
@@ -87,7 +93,7 @@ install: build
        $(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR).$(MINOR) 
        $(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR) 
        for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); 
 .PHONY: uninstall
@@ -107,8 +113,9 @@ clean:
        rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
        rm -f libxen$(LIBNAME).so.$(MAJOR).$(MINOR) libxen$(LIBNAME).so.$(MAJOR)
        rm -f headers.chk
-       rm -f xen$(LIBNAME).pc
+       rm -f $(PKG_CONFIG)
        rm -f $(LIBHEADERSGLOB)
+       rm -f _paths.h
 .PHONY: distclean
 distclean: clean
generated by git-patchbot for /home/xen/git/xen.git#master



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.