diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2011-03-17 19:15:18 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2011-03-17 19:15:18 +0000 |
commit | 10128bdb23b42d84545c29c5e6864463183fd9b4 (patch) | |
tree | 46525a6e492bf0d27f05666c3664bef16d2d8da7 /tools/python/setup.py | |
parent | f45b59ff53641c2ff19c86a1e23829e61d47dde0 (diff) | |
download | xen-10128bdb23b42d84545c29c5e6864463183fd9b4.tar.gz xen-10128bdb23b42d84545c29c5e6864463183fd9b4.tar.bz2 xen-10128bdb23b42d84545c29c5e6864463183fd9b4.zip |
tools: link each shared library or binary only against the libraries it uses
In particular if binary A uses libB and libB uses libC entirely
internally then A does not need to link against libC only libB.
However when linking binary A the linker does need to have visibility
of the libraries which libB links against (libC in this example). For
out of tree uses this is achieved without fuss due because the
libraries are installed in a standard path. However in the case of
in-tree users the linker needs a hint in the form of the -rpath-link
option. Therefore a new class of build variable, $(SHLIB_FOO), is
introduced which includes the linker options needed to link against a
library which uses libFOO. The intention is that $(LDLIBS_bar) will
include the $(SHLIB_foo)s which it uses where necessary rather
requiring that users are aware of this.
For the python extensions this change appears particularly large since
previously each of python bindings were linked against the union of
all possible libraries used by all bindings instead of just what they
individually needed.
This change removes a dependency on libdl.so from nearly everything
in the system, only libxenctrl actually uses it.
In the context of xl/libxl the intention of libxl is to remove any
need for a user of libxl to know about libxenstore or libxenctrl,
however in the current build it is xl which links against those
libraries rather than libxl (which only links against libc). After
this change libxl correctly depends on the libraries it uses and xl
does not depend on libraries which it is not support to be required to
know about. Note that xl does depend on libxenctrl.so since it uses
xtl_* directly.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/python/setup.py')
-rw-r--r-- | tools/python/setup.py | 134 |
1 files changed, 56 insertions, 78 deletions
diff --git a/tools/python/setup.py b/tools/python/setup.py index 28c4d85e67..f803632d3b 100644 --- a/tools/python/setup.py +++ b/tools/python/setup.py @@ -6,119 +6,98 @@ XEN_ROOT = "../.." extra_compile_args = [ "-fno-strict-aliasing", "-Werror" ] -include_dirs = [ XEN_ROOT + "/tools/libxc", - XEN_ROOT + "/tools/xenstore", - XEN_ROOT + "/tools/include", - XEN_ROOT + "/tools/libxl", - ] - -library_dirs = [ XEN_ROOT + "/tools/libxc", - XEN_ROOT + "/tools/xenstore", - XEN_ROOT + "/tools/libxl" - ] - -libraries = [ "xenctrl", "xenguest", "xenstore" ] - -depends = [ XEN_ROOT + "/tools/libxc/libxenctrl.so", - XEN_ROOT + "/tools/libxc/libxenguest.so", - XEN_ROOT + "/tools/xenstore/libxenstore.so" - ] - -plat = os.uname()[0] -if plat == 'Linux': - uuid_libs = ["uuid"] - blktap_ctl_libs = ["blktapctl"] - library_dirs.append(XEN_ROOT + "/tools/blktap2/control") - blktab_ctl_depends = [ XEN_ROOT + "/tools/blktap2/control/libblktapctl.so" ] -else: - uuid_libs = [] - blktap_ctl_libs = [] - blktab_ctl_depends = [] +PATH_XEN = XEN_ROOT + "/tools/include" +PATH_LIBXC = XEN_ROOT + "/tools/libxc" +PATH_LIBXL = XEN_ROOT + "/tools/libxl" +PATH_XENSTORE = XEN_ROOT + "/tools/xenstore" xc = Extension("xc", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/xc" ], - library_dirs = library_dirs, - libraries = libraries, - depends = depends, + include_dirs = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/xc" ], + library_dirs = [ PATH_LIBXC ], + libraries = [ "xenctrl", "xenguest" ], + depends = [ PATH_LIBXC + "/libxenctrl.so", PATH_LIBXC + "/libxenguest.so" ], sources = [ "xen/lowlevel/xc/xc.c" ]) xs = Extension("xs", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/xs" ], - library_dirs = library_dirs, - libraries = libraries, - depends = depends, + include_dirs = [ PATH_XEN, PATH_XENSTORE, "xen/lowlevel/xs" ], + library_dirs = [ PATH_XENSTORE ], + libraries = [ "xenstore" ], + depends = [ PATH_XENSTORE + "/libxenstore.so" ], sources = [ "xen/lowlevel/xs/xs.c" ]) scf = Extension("scf", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/scf" ], - library_dirs = library_dirs, - libraries = libraries, - depends = depends, + include_dirs = [ "xen/lowlevel/scf" ], + library_dirs = [ ], + libraries = [ ], + depends = [ ], sources = [ "xen/lowlevel/scf/scf.c" ]) - + process = Extension("process", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/process" ], - library_dirs = library_dirs, - libraries = libraries + [ "contract" ], - depends = depends, + include_dirs = [ "xen/lowlevel/process" ], + library_dirs = [ ], + libraries = [ "contract" ], + depends = [ ], sources = [ "xen/lowlevel/process/process.c" ]) acm = Extension("acm", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/acm" ], - library_dirs = library_dirs, - libraries = libraries, - depends = depends, + include_dirs = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/acm" ], + library_dirs = [ PATH_LIBXC ], + libraries = [ "xenctrl" ], + depends = [ PATH_LIBXC + "/libxenctrl.so" ], sources = [ "xen/lowlevel/acm/acm.c" ]) flask = Extension("flask", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/flask" ] + - [ "../flask/libflask/include" ], - library_dirs = library_dirs + [ "../flask/libflask" ], - libraries = libraries + [ "flask" ], - depends = depends + [ XEN_ROOT + "/tools/flask/libflask/libflask.so" ], + include_dirs = [ PATH_XEN, PATH_LIBXC, "xen/lowlevel/flask", + "../flask/libflask/include" ], + library_dirs = [ PATH_LIBXC, "../flask/libflask" ], + libraries = [ "xenctrl", "flask" ], + depends = [ PATH_LIBXC + "/libxenctrl.so", + XEN_ROOT + "/tools/flask/libflask/libflask.so" ], sources = [ "xen/lowlevel/flask/flask.c" ]) ptsname = Extension("ptsname", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "ptsname" ], - library_dirs = library_dirs, - libraries = libraries, - depends = depends, + include_dirs = [ "ptsname" ], + library_dirs = [ ], + libraries = [ ], + depends = [ ], sources = [ "ptsname/ptsname.c" ]) checkpoint = Extension("checkpoint", - extra_compile_args = extra_compile_args, - include_dirs = include_dirs, - library_dirs = library_dirs, - libraries = libraries + [ "rt" ], - depends = depends, - sources = [ "xen/lowlevel/checkpoint/checkpoint.c", - "xen/lowlevel/checkpoint/libcheckpoint.c"]) + extra_compile_args = extra_compile_args, + include_dirs = [ PATH_XEN, PATH_LIBXC, PATH_XENSTORE ], + library_dirs = [ PATH_LIBXC, PATH_XENSTORE ], + libraries = [ "xenctrl", "xenguest", "xenstore", "rt" ], + depends = [ PATH_LIBXC + "/libxenctrl.so", + PATH_LIBXC + "/libxenguest.so", + PATH_XENSTORE + "/libxenstore.so" ], + sources = [ "xen/lowlevel/checkpoint/checkpoint.c", + "xen/lowlevel/checkpoint/libcheckpoint.c"]) netlink = Extension("netlink", - extra_compile_args = extra_compile_args, - include_dirs = include_dirs, - library_dirs = library_dirs, - libraries = libraries, - depends = depends, - sources = [ "xen/lowlevel/netlink/netlink.c", - "xen/lowlevel/netlink/libnetlink.c"]) + extra_compile_args = extra_compile_args, + include_dirs = [ ], + library_dirs = [ ], + libraries = [ ], + depends = [ ], + sources = [ "xen/lowlevel/netlink/netlink.c", + "xen/lowlevel/netlink/libnetlink.c"]) xl = Extension("xl", extra_compile_args = extra_compile_args, - include_dirs = include_dirs + [ "xen/lowlevel/xl" ], - library_dirs = library_dirs, - libraries = libraries + ["xenlight" ] + blktap_ctl_libs + uuid_libs, - depends = depends + blktab_ctl_depends + - [ XEN_ROOT + "/tools/libxl/libxenlight.so" ], + include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, PATH_XENSTORE, "xen/lowlevel/xl" ], + library_dirs = [ PATH_LIBXL ], + libraries = [ "xenlight" ], + depends = [ PATH_LIBXL + "/libxenlight.so" ], sources = [ "xen/lowlevel/xl/xl.c", "xen/lowlevel/xl/_pyxl_types.c" ]) +plat = os.uname()[0] modules = [ xc, xs, ptsname, acm, flask, xl ] if plat == 'SunOS': modules.extend([ scf, process ]) @@ -143,7 +122,6 @@ setup(name = 'xen', 'xen.sv', 'xen.xsview', 'xen.remus', - 'xen.xend.tests', 'xen.xend.server.tests', 'xen.xend.xenstore.tests', |