Skip to content

Instantly share code, notes, and snippets.

@kei10in
Created April 28, 2012 07:35
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/2516885 to your computer and use it in GitHub Desktop.
Save kei10in/2516885 to your computer and use it in GitHub Desktop.
The patch for building Python 3.2.3 on cygwin environment
diff -r 3d0686d90f55 -r b6893ce617f7 Include/py_curses.h
--- a/Include/py_curses.h Tue Apr 10 19:30:22 2012 +0200
+++ b/Include/py_curses.h Sat Apr 28 16:18:32 2012 +0900
@@ -17,6 +17,13 @@
#define NCURSES_OPAQUE 0
#endif /* __APPLE__ */
+#ifdef __CYGWIN__
+/* the following define is necessary for Cygwin; without it, the
+ Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+ can't get at the WINDOW flags field. */
+#define NCURSES_INTERNALS
+#endif /* __CYGWIN__ */
+
#ifdef __FreeBSD__
/*
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
diff -r 3d0686d90f55 -r b6893ce617f7 Lib/distutils/command/build_ext.py
--- a/Lib/distutils/command/build_ext.py Tue Apr 10 19:30:22 2012 +0200
+++ b/Lib/distutils/command/build_ext.py Sat Apr 28 16:18:32 2012 +0900
@@ -720,9 +720,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 -r 3d0686d90f55 -r b6893ce617f7 Lib/distutils/unixccompiler.py
--- a/Lib/distutils/unixccompiler.py Tue Apr 10 19:30:22 2012 +0200
+++ b/Lib/distutils/unixccompiler.py Sat Apr 28 16:18:32 2012 +0900
@@ -280,7 +280,9 @@
# the configuration data stored in the Python installation, so
# we use this hack.
compiler = os.path.basename(sysconfig.get_config_var("CC"))
- if sys.platform[:6] == "darwin":
+ if sys.platform[:6] == "cygwin":
+ return "-Wl,-R" + dir
+ elif sys.platform[:6] == "darwin":
# MacOSX's linker doesn't understand the -R flag at all
return "-L" + dir
elif sys.platform[:5] == "hp-ux":
diff -r 3d0686d90f55 -r b6893ce617f7 Makefile.pre.in
--- a/Makefile.pre.in Tue Apr 10 19:30:22 2012 +0200
+++ b/Makefile.pre.in Sat Apr 28 16:18:32 2012 +0900
@@ -506,7 +506,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 -r 3d0686d90f55 -r b6893ce617f7 Modules/makesetup
--- a/Modules/makesetup Tue Apr 10 19:30:22 2012 +0200
+++ b/Modules/makesetup Sat Apr 28 16:18:32 2012 +0900
@@ -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