Skip to contentSkip to conversation

tools: split xl into a separate directory

PATCH In review Wei Liu 2 participants 13 messages Feb 21, 2017 – Feb 23, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover tools: split xl into a separate directory

Xl has grown sufficiently large to warrnant its own directory. We also need clear separation between the client (xl) and library (libxl).

This patch series moves xl into tools/xl directory.

Use find to generate a list of files to be installed from staging and wip branch, then diff -q staging wip. No output is produced from diff.

I also CC some folks who will be affected by this change. If this affects your work heavily, please let me know.

Wei Liu (2):
tools: provide libxlutil compiling and linking options
tools: move xl to a dedicated directory

 .gitignore                          |  2 +-
 tools/Rules.mk                      |  7 ++++++
 tools/libxl/Makefile                | 22 ++++---------------
 tools/xl/Makefile                   | 43 +++++++++++++++++++++++++++++++++++++
 tools/{libxl => xl}/bash-completion |  0
 tools/{libxl => xl}/xl.c            |  0
 tools/{libxl => xl}/xl.h            |  0
 tools/{libxl => xl}/xl_cmdimpl.c    |  0
 tools/{libxl => xl}/xl_cmdtable.c   |  0
 tools/{libxl => xl}/xl_sxp.c        |  0
 10 files changed, 55 insertions(+), 19 deletions(-)
 create mode 100644 tools/xl/Makefile
 rename tools/{libxl => xl}/bash-completion (100%)
 rename tools/{libxl => xl}/xl.c (100%)
 rename tools/{libxl => xl}/xl.h (100%)
 rename tools/{libxl => xl}/xl_cmdimpl.c (100%)
 rename tools/{libxl => xl}/xl_cmdtable.c (100%)
 rename tools/{libxl => xl}/xl_sxp.c (100%)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH 1/2 tools: provide libxlutil compiling and linking options

We are about to split out xl (which depends on libxlutil) to a different directory. Provide the proper options for compiling and linking in Rules.mk, and replace the hardcoded string in libxl/Makefile.

No functional change.

---
 tools/Rules.mk       | 7 +++++++
 tools/libxl/Makefile | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
tools/Rules.mk +7 -0
index b35999b21b..8a16013335 100644
@@ -17,6 +17,8 @@ XEN_LIBXENCALL     = $(XEN_ROOT)/tools/libs/call
 XEN_LIBXENFOREIGNMEMORY = $(XEN_ROOT)/tools/libs/foreignmemory
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 XEN_XENLIGHT       = $(XEN_ROOT)/tools/libxl
+# Currently libxlutil lives in the same directory as libxenlight
+XEN_XLUTIL         = $(XEN_XENLIGHT)
 XEN_XENSTORE       = $(XEN_ROOT)/tools/xenstore
 XEN_LIBXENSTAT     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
 XEN_BLKTAP2        = $(XEN_ROOT)/tools/blktap2
@@ -172,6 +174,11 @@ SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapc
 LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension)
 SHLIB_libxenlight  = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
 
+CFLAGS_libxlutil = -I$(XEN_XLUTIL)
+SHDEPS_libxlutil = $(SHLIB_libxenlight)
+LDLIBS_libxlutil = $(SHDEPS_libxlutil) $(XEN_XENLIGHT)/libxlutil$(libextension)
+SHLIB_libxlutil  = $(SHDEPS_libxlutil) -Wl,-rpath-link=$(XEN_XLUTIL)
+
 CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
 
 # Get gcc to generate the dependencies for us.
tools/libxl/Makefile +1 -1
index 6cc7b4511b..0f642cc57a 100644
@@ -289,7 +289,7 @@ libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
 
 xl: $(XL_OBJS) libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxlutil) $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS)
 
 test_%: test_%.o test_common.o libxlutil.so libxenlight_test.so
 	$(CC) $(LDFLAGS) -o $@ $^ $(filter-out %libxenlight.so, $(LDLIBS_libxenlight)) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#2 lore raw

PATCH 2/2 tools: move xl to a dedicated directory

In reply to Wei Liu

It makes clear distinction between the client (xl) and library (libxl), which should help design better APIs. This will also help reduce the code size in libxl directory.

---
 .gitignore                          |  2 +-
 tools/libxl/Makefile                | 22 ++++---------------
 tools/xl/Makefile                   | 43 +++++++++++++++++++++++++++++++++++++
 tools/{libxl => xl}/bash-completion |  0
 tools/{libxl => xl}/xl.c            |  0
 tools/{libxl => xl}/xl.h            |  0
 tools/{libxl => xl}/xl_cmdimpl.c    |  0
 tools/{libxl => xl}/xl_cmdtable.c   |  0
 tools/{libxl => xl}/xl_sxp.c        |  0
 9 files changed, 48 insertions(+), 19 deletions(-)
 create mode 100644 tools/xl/Makefile
 rename tools/{libxl => xl}/bash-completion (100%)
 rename tools/{libxl => xl}/xl.c (100%)
 rename tools/{libxl => xl}/xl.h (100%)
 rename tools/{libxl => xl}/xl_cmdimpl.c (100%)
 rename tools/{libxl => xl}/xl_cmdtable.c (100%)
 rename tools/{libxl => xl}/xl_sxp.c (100%)
.gitignore +1 -1
index c8d56d1bdb..a785006e44 100644
@@ -189,7 +189,6 @@ tools/libxl/ssdt*
 tools/libxl/testenum
 tools/libxl/testenum.c
 tools/libxl/tmp.*
-tools/libxl/xl
 tools/misc/cpuperf/cpuperf-perfcntr
 tools/misc/cpuperf/cpuperf-xen
 tools/misc/xc_shadow
@@ -380,6 +379,7 @@ tools/firmware/etherboot/ipxe/
 tools/python/xen/lowlevel/xl/_pyxl_types.c
 tools/python/xen/lowlevel/xl/_pyxl_types.h
 tools/xenstore/xenstore-watch
+tools/xl/xl
 
 docs/txt/misc/*.txt
 docs/txt/man/*.txt
tools/libxl/Makefile +4 -18
index 0f642cc57a..f00d9ef355 100644
@@ -178,16 +178,9 @@ LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
 	libxlu_disk_l.o libxlu_disk.o libxlu_vif.o libxlu_pci.o
 $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
-CLIENTS = xl testidl libxl-save-helper
+$(TEST_PROG_OBJS) _libxl.api-for-check: CFLAGS += $(CFLAGS_libxentoollog)
 
-CFLAGS_XL += $(CFLAGS_libxenlight)
-CFLAGS_XL += -Wshadow
-
-XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o
-$(XL_OBJS) $(TEST_PROG_OBJS) _libxl.api-for-check: \
-            CFLAGS += $(CFLAGS_libxentoollog)
-$(XL_OBJS): CFLAGS += $(CFLAGS_XL)
-$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
+CLIENTS = testidl libxl-save-helper
 
 libxl_dom.o: CFLAGS += -I$(XEN_ROOT)/tools  # include libacpi/x86.h
 libxl_x86_acpi.o: CFLAGS += -I$(XEN_ROOT)/tools
@@ -207,7 +200,7 @@ all: $(CLIENTS) $(TEST_PROGS) $(PKG_CONFIG) \
 		libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \
+$(LIBXL_OBJS) $(LIBXLU_OBJS) $(SAVE_HELPER_OBJS) \
 		$(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): \
 	$(AUTOINCS) libxl.api-ok
 
@@ -249,7 +242,7 @@ libxl_internal_json.h: _libxl_types_internal_json.h
 xl.h: _paths.h
 
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \
-	$(XL_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h
+	$(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
@@ -288,9 +281,6 @@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS) libxenlight.so
 libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
 
-xl: $(XL_OBJS) libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxlutil) $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS)
-
 test_%: test_%.o test_common.o libxlutil.so libxenlight_test.so
 	$(CC) $(LDFLAGS) -o $@ $^ $(filter-out %libxenlight.so, $(LDLIBS_libxenlight)) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS)
 
@@ -306,13 +296,10 @@ $(PKG_CONFIG): % : %.in Makefile
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
-	$(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DIR) $(DESTDIR)$(PKG_INSTALLDIR)
-	$(INSTALL_PROG) xl $(DESTDIR)$(sbindir)
 	$(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenlight.so.$(MAJOR)
@@ -323,7 +310,6 @@ install: all
 	$(SYMLINK_SHLIB) libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(libdir)/libxlutil.so
 	$(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 libxlutil.h $(DESTDIR)$(includedir)
-	$(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
 	$(INSTALL_DATA) xenlight.pc $(DESTDIR)$(PKG_INSTALLDIR)
 	$(INSTALL_DATA) xlutil.pc $(DESTDIR)$(PKG_INSTALLDIR)
 
tools/xl/Makefile new file +43 -0

43 lines not on this page · raw message

tools/xl/bash-completion renamed from tools/libxl/bash-completion +0 -0
similarity index 100%
rename from tools/libxl/bash-completion
rename to tools/xl/bash-completion
tools/xl/xl.c renamed from tools/libxl/xl.c +0 -0
similarity index 100%
rename from tools/libxl/xl.c
rename to tools/xl/xl.c
tools/xl/xl.h renamed from tools/libxl/xl.h +0 -0
similarity index 100%
rename from tools/libxl/xl.h
rename to tools/xl/xl.h
tools/xl/xl_cmdimpl.c renamed from tools/libxl/xl_cmdimpl.c +0 -0
similarity index 100%
rename from tools/libxl/xl_cmdimpl.c
rename to tools/xl/xl_cmdimpl.c
tools/xl/xl_cmdtable.c renamed from tools/libxl/xl_cmdtable.c +0 -0
similarity index 100%
rename from tools/libxl/xl_cmdtable.c
rename to tools/xl/xl_cmdtable.c
tools/xl/xl_sxp.c renamed from tools/libxl/xl_sxp.c +0 -0
similarity index 100%
rename from tools/libxl/xl_sxp.c
rename to tools/xl/xl_sxp.c
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on the v1 series
#3 lore raw
In reply to Wei Liu

Wei Liu writes ("[PATCH 0/2] tools: split xl into a separate directory"):

Quoted 2 lines

Xl has grown sufficiently large to warrnant its own directory. We also need clear separation between the client (xl) and library (libxl).

This is a fine idea.

Both patches,

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw
Quoted 10 lines · Ian Jackson

Wei Liu writes ("[PATCH 0/2] tools: split xl into a separate directory"):

Quoted 2 lines

Xl has grown sufficiently large to warrnant its own directory. We also need clear separation between the client (xl) and library (libxl).

This is a fine idea.

Both patches,

Hmm... It turns out the build system needs a bit more attention. Parallel build failed. I will rework and resend.

Wei.

Quoted 2 lines

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw
Quoted 7 lines · Wei Liu
Quoted 6 lines · Ian Jackson

Wei Liu writes ("[PATCH 0/2] tools: split xl into a separate directory"):

Quoted 2 lines

Xl has grown sufficiently large to warrnant its own directory. We also need clear separation between the client (xl) and library (libxl).

This is a fine idea.

Quoted 8 lines
Quoted 4 lines

Both patches,

Hmm... It turns out the build system needs a bit more attention. Parallel build failed. I will rework and resend.

So libxl needs to be built before xl.

Basically this needs to be folded into xl/Makefile:

+# libxenlight should be built before building xl
+.PHONY: libxl
+libxl:
+ $(MAKE) -C $(XEN_ROOT)/tools/libxl
+$(XL_OBJS): libxl
+

This is in line with how we do things: libxl/Makefile has something similar to build libacpi.

Please let me know if you have objection to this.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Review

Quoted 7 lines

Basically this needs to be folded into xl/Makefile:

(quoted diff) +5 -0
+# libxenlight should be built before building xl
+.PHONY: libxl
+libxl:
+       $(MAKE) -C $(XEN_ROOT)/tools/libxl
+$(XL_OBJS): libxl

OMG.

Quoted 4 lines

This is in line with how we do things: libxl/Makefile has something similar to build libacpi.

Please let me know if you have objection to this.

I hadn't noticed that libxl/Makefile had that.

No, this is entirely wrong. You will end up running make in tools/libxl twice simultaneously.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#7 lore raw
Quoted 14 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Review

Quoted 7 lines

Basically this needs to be folded into xl/Makefile:

(quoted diff) +5 -0
+# libxenlight should be built before building xl
+.PHONY: libxl
+libxl:
+       $(MAKE) -C $(XEN_ROOT)/tools/libxl
+$(XL_OBJS): libxl

OMG.

Quoted 3 lines

This is in line with how we do things: libxl/Makefile has something similar to build libacpi.

Quoted 6 lines
Quoted 1 line

Please let me know if you have objection to this.

I hadn't noticed that libxl/Makefile had that.

No, this is entirely wrong. You will end up running make in tools/libxl twice simultaneously.

Libacpi can be built in different directories by setting ACPI_BUILD_DIR.

Libxl doesn't have that, yet. We can do that, too. But it might involve quite a bit of fiddling with libxl/Makefile.

Wei.

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

No, this is entirely wrong. You will end up running make in tools/libxl twice simultaneously.

Libacpi can be built in different directories by setting ACPI_BUILD_DIR.

Aha. So it's built multiple times (presumably with different build options, etc).

Quoted 2 lines

Libxl doesn't have that, yet. We can do that, too. But it might involve quite a bit of fiddling with libxl/Makefile.

This is not the right approach for libxl.

Rather the parent Makefile should have a dependency, so that the make in `tools' knows to complete libxl before starting xl.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#9 lore raw
Quoted 10 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

No, this is entirely wrong. You will end up running make in tools/libxl twice simultaneously.

Libacpi can be built in different directories by setting ACPI_BUILD_DIR.

Aha. So it's built multiple times (presumably with different build options, etc).

Quoted 8 lines
Quoted 2 lines

Libxl doesn't have that, yet. We can do that, too. But it might involve quite a bit of fiddling with libxl/Makefile.

This is not the right approach for libxl.

Rather the parent Makefile should have a dependency, so that the make in `tools' knows to complete libxl before starting xl.

I think this is better.

But I am now very confused how we encode this in our build system. Obviously there is already such need. Say, all the tools under misc would require libxc to be built before hand, but the dependency doesn't seem to be explicitly encoded.

Wei.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#10 lore raw
Quoted 20 lines · Wei Liu
Quoted 10 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

No, this is entirely wrong. You will end up running make in tools/libxl twice simultaneously.

Libacpi can be built in different directories by setting ACPI_BUILD_DIR.

Aha. So it's built multiple times (presumably with different build options, etc).

Quoted 8 lines
Quoted 2 lines

Libxl doesn't have that, yet. We can do that, too. But it might involve quite a bit of fiddling with libxl/Makefile.

This is not the right approach for libxl.

Rather the parent Makefile should have a dependency, so that the make in `tools' knows to complete libxl before starting xl.

Quoted 7 lines

I think this is better.

But I am now very confused how we encode this in our build system. Obviously there is already such need. Say, all the tools under misc would require libxc to be built before hand, but the dependency doesn't seem to be explicitly encoded.

OIC: the order matters in tools/Makefile

I just need to move

SUBDIRS-y += xl after SUBDIRS-y += libxl

Let me know what you think.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Quoted 7 lines · Wei Liu
Quoted 4 lines

But I am now very confused how we encode this in our build system. Obviously there is already such need. Say, all the tools under misc would require libxc to be built before hand, but the dependency doesn't seem to be explicitly encoded.

OIC: the order matters in tools/Makefile

Yes. The loop is a shell loop, not a lot of parallel make targets.

Quoted 3 lines

I just need to move

SUBDIRS-y += xl after SUBDIRS-y += libxl

Precisely.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#12 lore raw
Quoted 9 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 0/2] tools: split xl into a separate directory"):

Quoted 7 lines · Wei Liu
Quoted 4 lines

But I am now very confused how we encode this in our build system. Obviously there is already such need. Say, all the tools under misc would require libxc to be built before hand, but the dependency doesn't seem to be explicitly encoded.

OIC: the order matters in tools/Makefile

Quoted 8 lines

Yes. The loop is a shell loop, not a lot of parallel make targets.

Quoted 3 lines

I just need to move

SUBDIRS-y += xl after SUBDIRS-y += libxl

Precisely.

Right. I will push the updated version soon.

Wei.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel