summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-02 01:32:21 (GMT)
committerGreg Ward <gward@python.net>2000-03-02 01:32:21 (GMT)
commit60f64330d10ecd4a3763dec38e3f50dbed742555 (patch)
tree92d0e312a8c75351ae3b74c645991f52975d9980
parent833dfd52e557fb7864c60bad140e97bb5a7b9fa2 (diff)
downloadcpython-60f64330d10ecd4a3763dec38e3f50dbed742555.zip
cpython-60f64330d10ecd4a3763dec38e3f50dbed742555.tar.gz
cpython-60f64330d10ecd4a3763dec38e3f50dbed742555.tar.bz2
If the "build_lib" command built any C libraries, link with them all
when building extensions (uses build_lib's 'get_library_names()' method). Ensure that the relative structure of source filenames is preserved in the temporary build tree, eg. foo/bar.c compiles to build/temp.<plat>/foo/bar.o.
-rw-r--r--Lib/distutils/command/build_ext.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 2bbd89d..fd5cd7a 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -164,7 +164,15 @@ class build_ext (Command):
self.compiler.set_runtime_library_dirs (self.rpath)
if self.link_objects is not None:
self.compiler.set_link_objects (self.link_objects)
-
+
+ if self.distribution.libraries:
+ build_lib = self.find_peer ('build_lib')
+ self.libraries = build_lib.get_library_names () or []
+ self.library_dirs = [build_lib.build_clib]
+ else:
+ self.libraries = []
+ self.library_dirs = []
+
# Now the real loop over extensions
self.build_extensions (self.extensions)
@@ -237,6 +245,7 @@ class build_ext (Command):
include_dirs = build_info.get ('include_dirs')
objects = self.compiler.compile (sources,
output_dir=self.build_temp,
+ keep_dir=1,
macros=macros,
include_dirs=include_dirs,
debug=self.debug)
@@ -247,8 +256,8 @@ class build_ext (Command):
extra_objects = build_info.get ('extra_objects')
if extra_objects:
objects.extend (extra_objects)
- libraries = build_info.get ('libraries')
- library_dirs = build_info.get ('library_dirs')
+ libraries = self.libraries + build_info.get ('libraries')
+ library_dirs = self.library_dirs + build_info.get ('library_dirs')
extra_args = build_info.get ('extra_link_args') or []
if self.compiler.compiler_type == 'msvc':