Commit a265fddf authored by Jiri Denemark's avatar Jiri Denemark

setup: Use cflags and ldflags properly

The setup.py script reads cflags and ldflags from pkg-config and uses
them when compiling/linking C modules. Since both cflags and ldflags may
include multiple compiler arguments we need to split them rather than
concatenating them into a single argument.
Signed-off-by: default avatarJiri Denemark <jdenemar@redhat.com>
parent a0f43200
...@@ -88,17 +88,15 @@ def get_module_lists(): ...@@ -88,17 +88,15 @@ def get_module_lists():
c_modules = [] c_modules = []
py_modules = [] py_modules = []
ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False) ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split()
cflags = get_pkgconfig_data(["--cflags"], "libvirt", False) cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split()
module = Extension('libvirtmod', module = Extension('libvirtmod',
sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'], sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'],
libraries = [ "virt" ], libraries = [ "virt" ],
include_dirs = [ "." ]) include_dirs = [ "." ])
if cflags != "": module.extra_compile_args.extend(cflags)
module.extra_compile_args.append(cflags) module.extra_link_args.extend(ldflags)
if ldflags != "":
module.extra_link_args.append(ldflags)
c_modules.append(module) c_modules.append(module)
py_modules.append("libvirt") py_modules.append("libvirt")
...@@ -107,10 +105,8 @@ def get_module_lists(): ...@@ -107,10 +105,8 @@ def get_module_lists():
sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'], sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'],
libraries = [ "virt-qemu" ], libraries = [ "virt-qemu" ],
include_dirs = [ "." ]) include_dirs = [ "." ])
if cflags != "": moduleqemu.extra_compile_args.extend(cflags)
moduleqemu.extra_compile_args.append(cflags) moduleqemu.extra_link_args.extend(ldflags)
if ldflags != "":
moduleqemu.extra_link_args.append(ldflags)
c_modules.append(moduleqemu) c_modules.append(moduleqemu)
py_modules.append("libvirt_qemu") py_modules.append("libvirt_qemu")
...@@ -120,10 +116,8 @@ def get_module_lists(): ...@@ -120,10 +116,8 @@ def get_module_lists():
sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'], sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'],
libraries = [ "virt-lxc" ], libraries = [ "virt-lxc" ],
include_dirs = [ "." ]) include_dirs = [ "." ])
if cflags != "": modulelxc.extra_compile_args.extend(cflags)
modulelxc.extra_compile_args.append(cflags) modulelxc.extra_link_args.extend(ldflags)
if ldflags != "":
modulelxc.extra_link_args.append(ldflags)
c_modules.append(modulelxc) c_modules.append(modulelxc)
py_modules.append("libvirt_lxc") py_modules.append("libvirt_lxc")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment