@@ -104,6 +104,8 @@ let
104104 # only works for GCC and Apple Clang. This makes distutils to call C++
105105 # compiler when needed.
106106 ./python-2.7-distutils-C++.patch
107+ ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [
108+ ./cross-compile.patch
107109 ];
108110
109111 preConfigure = ''
@@ -176,10 +178,14 @@ let
176178 LIBRARY_PATH = makeLibraryPath paths;
177179 };
178180
181+ # Python 2.7 needs this
182+ crossCompileEnv = stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform)
183+ { _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config; };
184+
179185 # Build the basic Python interpreter without modules that have
180186 # external dependencies.
181187
182−in stdenv.mkDerivation {
188+in stdenv.mkDerivation ({
183189 name = "python-${version}";
184190 pythonVersion = majorVersion;
185191
@@ -278,4 +284,4 @@ in stdenv.mkDerivation {
278284 # in case both 2 and 3 are installed.
279285 priority = -100;
280286 };
281− }
287+ } // crossCompileEnv)