summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-10 09:37:12 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-10 09:37:12 (GMT)
commitdbec780a0b35c3cc78b224bcb69295d863c57503 (patch)
tree4cca36cc8e44db32c69f3a95cea79a8ab5dc0f29
parent19f8edc39d344b12f8b60c3c23bdfb8e523593b7 (diff)
downloadcpython-dbec780a0b35c3cc78b224bcb69295d863c57503.zip
cpython-dbec780a0b35c3cc78b224bcb69295d863c57503.tar.gz
cpython-dbec780a0b35c3cc78b224bcb69295d863c57503.tar.bz2
Issue #9437: Fix building C extensions with non-default LDFLAGS.
-rw-r--r--Lib/distutils/sysconfig.py5
-rw-r--r--Lib/sysconfig.py5
-rw-r--r--Makefile.pre.in16
-rw-r--r--Misc/NEWS2
4 files changed, 20 insertions, 8 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 48f3fe4..8847e31 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -359,6 +359,11 @@ def parse_makefile(fn, g=None):
fp.close()
+ # strip spurious spaces
+ for k, v in done.items():
+ if isinstance(v, str):
+ done[k] = v.strip()
+
# save the results in the global dictionary
g.update(done)
return g
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 730718a..19847c9 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -296,6 +296,11 @@ def _parse_makefile(filename, vars=None):
# bogus variable reference; just drop it since we can't deal
variables.remove(name)
+ # strip spurious spaces
+ for k, v in done.items():
+ if isinstance(v, str):
+ done[k] = v.strip()
+
# save the results in the global dictionary
vars.update(done)
return vars
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 8e8727d..ba66c1a 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -112,8 +112,8 @@ LIBP= $(LIBDIR)/python$(VERSION)
# Symbols used for using shared libraries
SO= @SO@
-LDSHARED= @LDSHARED@
-BLDSHARED= @BLDSHARED@
+LDSHARED= @LDSHARED@ $(PY_LDFLAGS)
+BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS)
LDCXXSHARED= @LDCXXSHARED@
DESTSHARED= $(BINLIBDEST)/lib-dynload
@@ -429,8 +429,8 @@ platform: $(BUILDPYTHON)
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(PY_LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(PY_LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -447,10 +447,10 @@ $(LIBRARY): $(LIBRARY_OBJS)
libpython$(VERSION).so: $(LIBRARY_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \
- $(BLDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
$(LN) -f $(INSTSONAME) $@; \
else \
- $(BLDSHARED) $(PY_LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
fi
libpython$(VERSION).dylib: $(LIBRARY_OBJS)
@@ -458,7 +458,7 @@ libpython$(VERSION).dylib: $(LIBRARY_OBJS)
libpython$(VERSION).sl: $(LIBRARY_OBJS)
- $(LDSHARED) $(PY_LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
+ $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
# Copy up the gdb python hooks into a position where they can be automatically
# loaded by gdb during Lib/test/test_gdb.py
@@ -504,7 +504,7 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
# for a shared core library; otherwise, this rule is a noop.
$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
if test -n "$(DLLLIBRARY)"; then \
- $(LDSHARED) $(PY_LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
+ $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
else true; \
fi
diff --git a/Misc/NEWS b/Misc/NEWS
index e90cb37..070710c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -95,6 +95,8 @@ Core and Builtins
Library
-------
+- Issue #9437: Fix building C extensions with non-default LDFLAGS.
+
- Issue #4661: email can now parse bytes input and generate either converted
7bit output or bytes output. Email version bumped to 5.1.0.