Skip to content

Instantly share code, notes, and snippets.

@kei10in
Created September 13, 2011 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kei10in/1213731 to your computer and use it in GitHub Desktop.
Save kei10in/1213731 to your computer and use it in GitHub Desktop.
The patch for building Python-3.2.2 on cygwin environment.
# HG changeset patch
# Date 1315917931 -32400
# Branch 3.2
# Node ID 8b950b66853c1f32c420e5fbc6e21ee88162ef96
# Parent 137e45f15c0bd262c9ad4c032d97425bc0589456
Fix cygwin build bug
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -721,9 +721,10 @@
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
elif sys.platform[:6] == "cygwin":
- template = "python%d.%d"
+ template = "python%d.%d%s"
pythonlib = (template %
- (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
+ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff,
+ sys.abiflags))
# don't extend ext.libraries, it may be shared with other
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -504,7 +504,7 @@
# This rule builds the Cygwin Python DLL and import library if configured
# for a shared core library; otherwise, this rule is a noop.
-$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
+$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
if test -n "$(DLLLIBRARY)"; then \
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
diff --git a/Modules/makesetup b/Modules/makesetup
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -91,7 +91,7 @@
else
ExtraLibDir='$(LIBPL)'
fi
- ExtraLibs="-L$ExtraLibDir -lpython\$(VERSION)";;
+ ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
esac
# Main loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment