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