2013-09-26 17:14:40 +02:00

25 lines
1017 B
Plaintext

$NetBSD: patch-ab,v 1.2 2012/04/13 18:47:31 adam Exp $
--- Lib/distutils/command/build_ext.py.orig 2010-04-01 18:17:09.000000000 +0000
+++ Lib/distutils/command/build_ext.py
@@ -513,8 +513,19 @@ class build_ext (Command):
# that go into the mix.
if ext.extra_objects:
objects.extend(ext.extra_objects)
+
+ # Two possible sources for extra linker arguments:
+ # - 'extra_link_args' in Extension object
+ # - LDFLAGS environment variable
+ # The environment variable should take precedence, and
+ # any sensible compiler will give precedence to later
+ # command line args. Hence we combine them in order:
extra_args = ext.extra_link_args or []
+ if os.environ.has_key('LDFLAGS'):
+ extra_args = list(extra_args)
+ extra_args.extend(string.split(os.environ['LDFLAGS']))
+
# Detect target language, if not provided
language = ext.language or self.compiler.detect_language(sources)