python: forward port cross-compiling work to our 3.6 version
This doesn't enable python3.6 for any packages, just makes the
interpreter work correctly & cross-compile properly.
BUG=chromium:884766, chromium:982409
TEST=SDK & CQ still pass
TEST=`emerge-$BOARD python:3.6` works (for betty & elm)
TEST=building python packages (including C modules e.g. numpy) works for 3.6 on elm
Change-Id: I2fdc75419e51fc8049583985654e16fe56790ddf
Reviewed-on: https://chromium-review.googlesource.com/1697461
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/dev-lang/python/files/python-3.6.5-cross-python-config.patch b/dev-lang/python/files/python-3.6.5-cross-python-config.patch
new file mode 100644
index 0000000..0b6f3d0
--- /dev/null
+++ b/dev-lang/python/files/python-3.6.5-cross-python-config.patch
@@ -0,0 +1,27 @@
+we already patch the python modules behind the python-config scripts,
+but the shell python-config script is completely unrelated.
+
+we throw away the -L$libdir path because $libdir is in the toolchain's
+search path already, so we don't need the redundancy.
+
+--- a/Misc/python-config.sh.in
++++ b/Misc/python-config.sh.in
+@@ -25,6 +25,9 @@ installed_prefix ()
+ }
+
+ prefix_real=$(installed_prefix "$0")
++if [ "${prefix_real}" = "/usr" ]; then
++ prefix_real="${SYSROOT}/usr"
++fi
+
+ # Use sed to fix paths from their built-to locations to their installed-to
+ # locations. Keep prefix & exec_prefix using their original values in case
+@@ -92,7 +95,7 @@ do
+ if [ -z "$PYTHONFRAMEWORK" ] ; then
+ LINKFORSHAREDUSED=$LINKFORSHARED
+ fi
+- echo "-L$libdir $LIBS $LINKFORSHAREDUSED"
++ echo "$LIBS $LINKFORSHAREDUSED"
+ ;;
+ --extension-suffix)
+ echo "$SO"