blob: 35a38232960fad8f81f911f579cd4a5db93d64c2 [file] [log] [blame]
diff -Naur Python-2.7.9-orig/configure.ac Python-2.7.9/configure.ac
--- Python-2.7.9-orig/configure.ac 2014-12-11 13:50:44.553800000 +0300
+++ Python-2.7.9/configure.ac 2014-12-11 13:50:47.829800000 +0300
@@ -561,6 +561,65 @@
AC_MSG_RESULT([$DELIM])
AC_SUBST(DELIM)
+# On 'semi-native' build systems (MSYS*/Cygwin targeting MinGW-w64)
+# _sysconfigdata.py will contain paths that are correct only in the
+# build environment. This means external modules will fail to build
+# without setting up the same env and also that the build of Python
+# itself will fail as the paths are not correct for the host tools.
+#
+# Also, getpath.c uses GetModuleFileNameW (replacing \ with /) and
+# compares that with the define VPATH (passed in via command-line)
+# to determine whether it's the build- or the installed-Python.
+#
+# To work around these issues a set of _b2h variables are created:
+# VPATH_b2h, prefix_b2h, srcdir_b2h, abs_srcdir_b2h
+# and abs_builddir_b2h
+# .. where b2h stands for build to host. sysconfig.py replaces path
+# prefixes matching the non-b2h versions with the b2h equivalents.
+#
+# (note this assumes the host compilers are native and *not* cross
+# - in the 'semi-native' scenario only that is.)
+
+AC_DEFUN([ABS_PATH_HOST],
+[$1=$(cd $$2 && pwd)
+ case $build_os in
+ mingw*)
+ case $host_os in
+ mingw*) $1=$(cd $$2 && pwd -W) ;;
+ *) ;;
+ esac
+ ;;
+ cygwin*)
+ case $host_os in
+ mingw*) $1=$(cygpath -w -m $$2) ;;
+ *) ;;
+ esac
+ ;;
+ esac
+AC_SUBST([$1])
+])
+
+AC_MSG_CHECKING(absolute host location of VPATH)
+ABS_PATH_HOST([VPATH_b2h],[srcdir])
+AC_MSG_RESULT([$VPATH_b2h])
+
+AC_MSG_CHECKING(absolute host location of prefix)
+ABS_PATH_HOST([prefix_b2h],[prefix])
+AC_MSG_RESULT([$prefix_b2h])
+
+AC_MSG_CHECKING(absolute host location of srcdir)
+ABS_PATH_HOST([srcdir_b2h],[srcdir])
+AC_MSG_RESULT([$srcdir_b2h])
+
+AC_MSG_CHECKING(absolute host location of abs_srcdir)
+ABS_PATH_HOST([abs_srcdir_b2h],[srcdir])
+AC_MSG_RESULT([$abs_srcdir_b2h])
+
+my_builddir=.
+AC_MSG_CHECKING(Absolute host location of abs_builddir)
+ABS_PATH_HOST([abs_builddir_b2h],[my_builddir])
+AC_MSG_RESULT([$abs_builddir_b2h])
+
AC_MSG_CHECKING([for init system calls])
AC_SUBST(INITSYS)
case $host in
diff -Naur Python-2.7.9-orig/Lib/sysconfig.py Python-2.7.9/Lib/sysconfig.py
--- Python-2.7.9-orig/Lib/sysconfig.py 2014-12-11 13:50:22.963400000 +0300
+++ Python-2.7.9/Lib/sysconfig.py 2014-12-11 13:50:49.561400000 +0300
@@ -273,6 +273,14 @@
if isinstance(v, str):
done[k] = v.strip()
+ # any keys that have one with the same name suffixed with _b2h
+ # need to be replaced with the value of the _b2h key.
+ # This converts from MSYS*/Cygwin paths to Windows paths.
+ for k, v in done.items():
+ if isinstance(k, str):
+ if k.endswith("_b2h"):
+ done[k[:-4]]=v
+
# save the results in the global dictionary
vars.update(done)
return vars
diff -Naur Python-2.7.9-orig/Makefile.pre.in Python-2.7.9/Makefile.pre.in
--- Python-2.7.9-orig/Makefile.pre.in 2014-12-11 13:50:46.113800000 +0300
+++ Python-2.7.9/Makefile.pre.in 2014-12-11 13:50:49.561400000 +0300
@@ -101,6 +101,13 @@
# Install prefix for data files
datarootdir= @datarootdir@
+# Locations needed for semi-native fixup of sysconfig.
+srcdir_b2h= @srcdir_b2h@
+VPATH_b2h= @VPATH_b2h@
+abs_srcdir_b2h= @abs_srcdir_b2h@
+abs_builddir_b2h= @abs_builddir_b2h@
+prefix_b2h= @prefix_b2h@
+
# Expanded directories
BINDIR= @bindir@
LIBDIR= @libdir@
@@ -598,7 +605,7 @@
-DPREFIX='"$(prefix)"' \
-DEXEC_PREFIX='"$(exec_prefix)"' \
-DVERSION='"$(VERSION)"' \
- -DVPATH='"$(VPATH)"' \
+ -DVPATH='"$(VPATH_b2h)"' \
-o $@ $(srcdir)/Modules/getpath.c
# default sys.path calculations for windows platforms