Blob Blame History Raw
--- Python-3.5.1/configure.ac.orig	2015-12-07 01:39:11.000000000 +0000
+++ Python-3.5.1/configure.ac	2016-04-23 12:49:17.142936229 +0000
@@ -58,6 +58,15 @@
 
 if test "$cross_compiling" = yes; then
     AC_MSG_CHECKING([for python interpreter for cross build])
+    AC_MSG_CHECKING(python for build)
+    PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD:-${PWD}/hostpython}"
+    AC_MSG_RESULT($PYTHON_FOR_BUILD)
+    AC_MSG_CHECKING(pgen for build)
+    PGEN_FOR_BUILD="${PGEN_FOR_BUILD:-Parser/hostpgen}"
+    AC_MSG_RESULT($PGEN_FOR_BUILD)
+    AC_MSG_CHECKING(_freeze_importlib for build)
+    _FIP_FOR_BUILD="${_FIP_FOR_BUILD:-Programs/host_freeze_importlib}"
+    AC_MSG_RESULT($_FIP_FOR_BUILD)
     if test -z "$PYTHON_FOR_BUILD"; then
         for interp in python$PACKAGE_VERSION python3 python; do
 	    which $interp >/dev/null 2>&1 || continue
@@ -75,9 +84,16 @@
 elif test "$cross_compiling" = maybe; then
     AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
 else
-    PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
+   PYTHON_FOR_BUILD='$(BUILDPYTHON)'
+   PGEN_FOR_BUILD='$(PGEN)'
+   _FIP_FOR_BUILD='$(_FIP)'
 fi
 AC_SUBST(PYTHON_FOR_BUILD)
+AC_SUBST(PGEN_FOR_BUILD)
+AC_SUBST(_FIP_FOR_BUILD)
+AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python])
+AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen])
+AC_ARG_VAR(_FIP_FOR_BUILD,[build system Python _freeze_importlib])
 
 dnl Ensure that if prefix is specified, it does not end in a slash. If
 dnl it does, we get path names containing '//' which is both ugly and
@@ -373,6 +389,9 @@
 	*-*-cygwin*)
 		ac_sys_system=Cygwin
 		;;
+	*-*-midipix*)
+		ac_sys_system=Midipix
+		;;
 	*)
 		# for now, limit cross builds to known configurations
 		MACHDEP="unknown"
@@ -399,6 +418,7 @@
 	cygwin*) MACHDEP="cygwin";;
 	darwin*) MACHDEP="darwin";;
 	irix646) MACHDEP="irix6";;
+	midipix*) MACHDEP="midipix";;
 	'')	MACHDEP="unknown";;
     esac
 fi
@@ -406,6 +426,9 @@
 AC_SUBST(_PYTHON_HOST_PLATFORM)
 if test "$cross_compiling" = yes; then
 	case "$host" in
+	*-*-midipix*)
+		_host_cpu=
+		;;
 	*-*-linux*)
 		case "$host_cpu" in
 		arm*)
--- Python-3.5.1/Makefile.pre.in.orig	2015-12-07 01:39:09.000000000 +0000
+++ Python-3.5.1/Makefile.pre.in	2016-04-23 12:09:05.162989761 +0000
@@ -276,6 +276,9 @@
 ##########################################################################
 # Parser
 PGEN=		Parser/pgen$(EXE)
+PGEN_FOR_BUILD=	@PGEN_FOR_BUILD@
+_FIP=		Programs/_freeze_importlib$(EXE)
+_FIP_FOR_BUILD=	@_FIP_FOR_BUILD@
 
 PSRCS=		\
 		Parser/acceler.c \
@@ -597,6 +600,7 @@
 	esac; \
 	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+		_PYTHON_HOST_PLATFORM='$(_PYTHON_HOST_PLATFORM)' \
 		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
 
 # Build static library
@@ -708,15 +712,15 @@
 
 Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
 
-Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
+$(_FIP): Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
 	$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
 
-Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
-	./Programs/_freeze_importlib \
+Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py $(_FIP_FOR_BUILD)
+	./$(_FIP_FOR_BUILD) \
 		$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
 
-Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
-	./Programs/_freeze_importlib \
+Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py $(_FIP_FOR_BUILD)
+	./$(_FIP_FOR_BUILD) \
 		$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
 
 
@@ -777,9 +781,9 @@
 
 $(IO_OBJS): $(IO_H)
 
-$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN)
+$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN_FOR_BUILD)
 		@$(MKDIR_P) Include
-		$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+		$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
 $(GRAMMAR_C): $(GRAMMAR_H)
 		touch $(GRAMMAR_C)
 
@@ -1415,6 +1419,7 @@
 # Install the dynamically loadable modules
 # This goes into $(exec_prefix)
 sharedinstall: sharedmods
+	_PYTHON_HOST_PLATFORM='$(_PYTHON_HOST_PLATFORM)' \
 	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
 	   	--prefix=$(prefix) \
 		--install-scripts=$(BINDIR) \
--- Python-3.5.1/Modules/socketmodule.c.orig	2015-12-07 01:39:10.000000000 +0000
+++ Python-3.5.1/Modules/socketmodule.c	2016-04-23 12:30:40.854961004 +0000
@@ -1313,7 +1313,7 @@
     }
 #endif
 
-#ifdef AF_CAN
+#if defined(HAVE_LINUX_CAN_H) && defined(AF_CAN)
     case AF_CAN:
     {
         struct sockaddr_can *a = (struct sockaddr_can *)addr;
@@ -1810,7 +1810,7 @@
     }
 #endif
 
-#if defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
+#if defined(HAVE_LINUX_CAN_H) && defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
     case AF_CAN:
         switch (s->sock_proto) {
         case CAN_RAW:
@@ -2017,7 +2017,7 @@
     }
 #endif
 
-#ifdef AF_CAN
+#if defined(HAVE_LINUX_CAN_H) && defined(AF_CAN)
     case AF_CAN:
     {
         *len_ret = sizeof (struct sockaddr_can);
@@ -6298,7 +6298,7 @@
     PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF");
 #endif
 
-#ifdef AF_CAN
+#if defined(HAVE_LINUX_CAN_H) && defined(AF_CAN)
     /* Controller Area Network */
     PyModule_AddIntMacro(m, AF_CAN);
 #endif
--- Python-3.5.1/setup.py.orig	2015-12-07 01:39:11.000000000 +0000
+++ Python-3.5.1/setup.py	2016-04-23 15:59:20.902683131 +0000
@@ -1294,7 +1294,13 @@
         panel_library = 'panel'
         if curses_library == 'ncursesw':
             curses_defines.append(('HAVE_NCURSESW', '1'))
-            curses_includes.append('/usr/include/ncursesw')
+            cflags = sysconfig.get_config_var('CFLAGS')
+            m = re.search(r'-isysroot\s+(\S+)', cflags)
+            if m is None:
+                sysroot = '/usr'
+            else:
+                sysroot = m.group(1)
+            curses_includes.append(sysroot + '/include/ncursesw')
             # Bug 1464056: If _curses.so links with ncursesw,
             # _curses_panel.so must link with panelw.
             panel_library = 'panelw'