GLUED: renamed packages to rules, cfg_dir_packages to cfg_dir_rules.

This commit is contained in:
Ricardo Martins
2014-02-02 09:53:29 +00:00
parent 6420cb1823
commit eaf0c7d347
354 changed files with 7 additions and 7 deletions

14
rules/python/common.bash Normal file
View File

@@ -0,0 +1,14 @@
version=\
(
"2.7.2"
)
url=\
(
"http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2"
)
md5=\
(
"ba7b2f11ffdbf195ee0d111b9455a5bd"
)

25
rules/python/cross.bash Normal file
View File

@@ -0,0 +1,25 @@
source $pkg_common
configure()
{
echo "Post unpack is in $(pwd)"
echo "Pre-configuring by building an host python ... $(pwd) "
cd ../Python-$version/
./configure
}
build()
{
cd ../Python-$version
$cmd_make python Parser/pgen
}
host_install()
{
cd ../Python-$version
mv python hostpython
mv Parser/pgen Parser/hostpgen
$cmd_make distclean
}

68
rules/python/default.bash Normal file
View File

@@ -0,0 +1,68 @@
# Following indication from: http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
source $pkg_common
requires=\
(
'python/cross'
'bzip2/default'
'zlib/default'
)
configure()
{
cd ../Python-$version
echo "Configure is in $(pwd)"
# We are patching the source as python needs python to compile python for our target:
patch -p1 < "${cfg_package_spec_dir}/patches/Python-${version}-xcompile.patch"
patch -p1 < "${cfg_package_spec_dir}/patches/001-Enable-zlib-bz2.patch"
export CC="$cfg_target_canonical-gcc"
export CXX="$cfg_target_canonical-g++"
export AR="$cfg_target_canonical-ar"
export RANLIB="$cfg_target_canonical-ranlib"
./configure \
--host="${cfg_target_canonical}" \
--build="${cfg_host_canonical}" \
--prefix="${cfg_dir_toolchain_sysroot}/usr"
}
build()
{
cd ../Python-$version
echo "Build is in $(pwd)"
$cmd_make \
HOSTPYTHON="../Python-$version/hostpython" \
HOSTPGEN="../Python-$version/Parser/hostpgen" \
BLDSHARED="$cmd_target_gcc -shared" \
CROSS_COMPILE="$cfg_target_canonical-" \
CROSS_COMPILE_TARGET="yes" \
HOSTARCH="${cfg_target_canonical}" \
BUILDARCH="${cfg_host_canonical}"
}
host_install()
{
cd ../Python-$version
echo "Target install is in $(pwd)"
$cmd_make install \
HOSTPYTHON=./hostpython \
BLDSHARED="$cmd_target_cc -shared" \
CROSS_COMPILE="$cfg_target_canonical-" \
CROSS_COMPILE_TARGET=yes
# prefix="${cfg_dir_toolchain_sysroot}/usr"
}
target_install()
{
$cmd_cp "${cfg_dir_toolchain_sysroot}/usr/lib/"python* "${cfg_dir_rootfs}/usr/lib"
$cmd_cp "${cfg_dir_toolchain_sysroot}/usr/bin/"python* "${cfg_dir_rootfs}/usr/bin"
# Python needs the include files because it parse it for knowing some data...
$cmd_mkdir "${cfg_dir_rootfs}/usr/include/"
$cmd_cp "${cfg_dir_toolchain_sysroot}/usr/include/"python* "${cfg_dir_rootfs}/usr/include/"
}

View File

@@ -0,0 +1,14 @@
--- Python-2.7.2_host/Modules/Setup.dist 2011-06-11 17:46:26.000000000 +0200
+++ Python-2.7.2_target/Modules/Setup.dist 2013-05-21 17:52:37.161862158 +0200
@@ -460,7 +460,10 @@
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+
+# Enabling the libbz2 in python:
+bz2 bz2module.c -I$(prefix)/include -L$(exec_prefix)/lib -lbz2
# Interface to the Expat XML parser
#

View File

@@ -0,0 +1,323 @@
diff -uN Python-2.6.6Orig/configure Python-2.6.6/configure
--- Python-2.6.6Orig/configure 2010-05-25 12:27:03.000000000 +1000
+++ Python-2.6.6/configure 2010-09-10 18:25:15.924146785 +1000
@@ -12760,12 +12760,12 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5
$as_echo_n "checking for %zd printf() format support... " >&6; }
-if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
-else
+#if test "$cross_compiling" = yes; then :
+# { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+#as_fn_error "cannot run test program while cross compiling
+#See \`config.log' for more details." "$LINENO" 5; }
+#else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
@@ -12815,7 +12815,7 @@
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+#fi
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "
diff -uN Python-2.6.6Orig/configure.in Python-2.6.6/configure.in
--- Python-2.6.6Orig/configure.in 2010-05-25 12:27:03.000000000 +1000
+++ Python-2.6.6/configure.in 2010-09-10 18:25:15.934134297 +1000
@@ -3860,48 +3860,48 @@
AC_MSG_RESULT(no)
fi
-AC_MSG_CHECKING(for %zd printf() format support)
-AC_TRY_RUN([#include <stdio.h>
-#include <stddef.h>
-#include <string.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_SSIZE_T
-typedef ssize_t Py_ssize_t;
-#elif SIZEOF_VOID_P == SIZEOF_LONG
-typedef long Py_ssize_t;
-#else
-typedef int Py_ssize_t;
-#endif
-
-int main()
-{
- char buffer[256];
-
- if(sprintf(buffer, "%zd", (size_t)123) < 0)
- return 1;
-
- if (strcmp(buffer, "123"))
- return 1;
-
- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
- return 1;
-
- if (strcmp(buffer, "-123"))
- return 1;
-
- return 0;
-}],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
- AC_MSG_RESULT(no))
+#AC_MSG_CHECKING(for %zd printf() format support)
+#AC_TRY_RUN([#include <stdio.h>
+##include <stddef.h>
+##include <string.h>
+
+##ifdef HAVE_SYS_TYPES_H
+##include <sys/types.h>
+##endif
+
+##ifdef HAVE_SSIZE_T
+#typedef ssize_t Py_ssize_t;
+##elif SIZEOF_VOID_P == SIZEOF_LONG
+#typedef long Py_ssize_t;
+##else
+#typedef int Py_ssize_t;
+##endif
+#
+#int main()
+#{
+# char buffer[256];
+#
+# if(sprintf(buffer, "%zd", (size_t)123) < 0)
+# return 1;#
+#
+# if (strcmp(buffer, "123"))
+# return 1;
+#
+# if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
+# return 1;
+#
+# if (strcmp(buffer, "-123"))
+# return 1;
+#
+# return 0;
+#}],
+#[AC_MSG_RESULT(yes)
+# AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+# AC_MSG_RESULT(no))
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,int,
- Define to `int' if <sys/socket.h> does not define.),[
+ Define to 'int' if <sys/socket.h> does not define.),[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
Common subdirectories: Python-2.6.6Orig/Demo and Python-2.6.6/Demo
Common subdirectories: Python-2.6.6Orig/Doc and Python-2.6.6/Doc
Common subdirectories: Python-2.6.6Orig/Grammar and Python-2.6.6/Grammar
Binary files Python-2.6.6Orig/hostpython and Python-2.6.6/hostpython differ
Common subdirectories: Python-2.6.6Orig/Include and Python-2.6.6/Include
Common subdirectories: Python-2.6.6Orig/Lib and Python-2.6.6/Lib
Common subdirectories: Python-2.6.6Orig/Mac and Python-2.6.6/Mac
diff -uN Python-2.6.6Orig/Makefile.pre.in Python-2.6.6/Makefile.pre.in
--- Python-2.6.6Orig/Makefile.pre.in 2010-08-02 08:05:31.000000000 +1000
+++ Python-2.6.6/Makefile.pre.in 2010-09-10 18:25:15.934134297 +1000
@@ -175,6 +175,7 @@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
+HOSTPYTHON= ./$(BUILDPYTHON)
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
@@ -206,6 +207,8 @@
# Parser
PGEN= Parser/pgen$(EXE)
+HOSTPGEN= $(PGEN)
+
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -394,8 +397,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -517,7 +520,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
@@ -886,24 +889,24 @@
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
@@ -1001,7 +1004,8 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall:
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
Common subdirectories: Python-2.6.6Orig/Misc and Python-2.6.6/Misc
Common subdirectories: Python-2.6.6Orig/Modules and Python-2.6.6/Modules
Common subdirectories: Python-2.6.6Orig/Objects and Python-2.6.6/Objects
Common subdirectories: Python-2.6.6Orig/Parser and Python-2.6.6/Parser
Common subdirectories: Python-2.6.6Orig/PC and Python-2.6.6/PC
Common subdirectories: Python-2.6.6Orig/PCbuild and Python-2.6.6/PCbuild
Common subdirectories: Python-2.6.6Orig/Python and Python-2.6.6/Python
Common subdirectories: Python-2.6.6Orig/RISCOS and Python-2.6.6/RISCOS
diff -uN Python-2.6.6Orig/setup.py Python-2.6.6/setup.py
--- Python-2.6.6Orig/setup.py 2010-07-17 22:31:09.000000000 +1000
+++ Python-2.6.6/setup.py 2010-09-10 18:28:32.104148297 +1000
@@ -313,33 +313,40 @@
self.announce('WARNING: skipping import check for Cygwin-based "%s"'
% ext.name)
return
+ if os.environ.get('CROSS_COMPILE_TARGET') == 'yes':
+ return
+
ext_filename = os.path.join(
self.build_lib,
self.get_ext_filename(self.get_ext_fullname(ext.name)))
try:
imp.load_dynamic(ext.name, ext_filename)
except ImportError, why:
- self.failed.append(ext.name)
- self.announce('*** WARNING: renaming "%s" since importing it'
- ' failed: %s' % (ext.name, why), level=3)
- assert not self.inplace
- basename, tail = os.path.splitext(ext_filename)
- newname = basename + "_failed" + tail
- if os.path.exists(newname):
- os.remove(newname)
- os.rename(ext_filename, newname)
-
- # XXX -- This relies on a Vile HACK in
- # distutils.command.build_ext.build_extension(). The
- # _built_objects attribute is stored there strictly for
- # use here.
- # If there is a failure, _built_objects may not be there,
- # so catch the AttributeError and move on.
- try:
- for filename in self._built_objects:
- os.remove(filename)
- except AttributeError:
- self.announce('unable to remove files (ignored)')
+ if os.environ.get('CROSS_COMPILE_TARGET') != "yes":
+ self.announce('*** WARNING: renaming "%s" since importing it'
+ ' failed: %s' % (ext.name, why), level=3)
+ assert not self.inplace
+ basename, tail = os.path.splitext(ext_filename)
+ newname = basename + "_failed" + tail
+ if os.path.exists(newname):
+ os.remove(newname)
+ os.rename(ext_filename, newname)
+
+ # XXX -- This relies on a Vile HACK in
+ # distutils.command.build_ext.build_extension(). The
+ # _built_objects attribute is stored there strictly for
+ # use here.
+ # If there is a failure, _built_objects may not be there,
+ # so catch the AttributeError and move on.
+ try:
+ for filename in self._built_objects:
+ os.remove(filename)
+ except AttributeError:
+ self.announce('unable to remove files (ignored)')
+ else:
+ self.announce('WARNING: "%s" failed importing, but we leave it '
+ 'because we are cross-compiling' %
+ ext.name)
except:
exc_type, why, tb = sys.exc_info()
self.announce('*** WARNING: importing extension "%s" '
@@ -742,7 +749,7 @@
if (ssl_incs is not None and
ssl_libs is not None and
- openssl_ver >= 0x00907000):
+ openssl_ver >= 0x00907000 and False):
# The _hashlib module wraps optimized implementations
# of hash functions from the OpenSSL library.
exts.append( Extension('_hashlib', ['_hashopenssl.c'],
@@ -762,7 +769,7 @@
depends = ['md5.h']) )
missing.append('_hashlib')
- if (openssl_ver < 0x00908000):
+ if (True or openssl_ver < 0x00908000):
# OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
exts.append( Extension('_sha256', ['sha256module.c']) )
exts.append( Extension('_sha512', ['sha512module.c']) )
@@ -1823,7 +1830,7 @@
ffi_configfile):
from distutils.dir_util import mkpath
mkpath(ffi_builddir)
- config_args = []
+ config_args = sysconfig.get_config_var("CONFIG_ARGS").split(" ")
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
--- Python-2.6.6.orig//Lib/plat-linux3/regen 1970-01-01 01:00:00.000000000 +0100
+++ Python-2.6.6/Lib/plat-linux3/regen 2001-08-09 14:48:17.000000000 +0200
@@ -0,0 +1,8 @@
+#! /bin/sh
+case `uname` in
+Linux*) ;;
+*) echo Probably not on a Linux system 1>&2
+ exit 1;;
+esac
+set -v
+h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h

View File

@@ -0,0 +1,205 @@
diff -urN Python-2.7.2/configure ltib/rpm/BUILD/Python-2.7.2/configure
--- Python-2.7.2/configure 2011-06-11 11:46:28.000000000 -0400
+++ ltib/rpm/BUILD/Python-2.7.2/configure 2011-11-14 12:10:41.011373524 -0500
@@ -13673,7 +13673,7 @@
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- ac_cv_have_long_long_format=no
+ ac_cv_have_long_long_format="cross -- assuming yes"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -13725,7 +13725,7 @@
$as_echo "$ac_cv_have_long_long_format" >&6; }
fi
-if test "$ac_cv_have_long_long_format" = yes
+if test "$ac_cv_have_long_long_format" != no
then
$as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h
diff -urN Python-2.7.2/Makefile.pre.in ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in
--- Python-2.7.2/Makefile.pre.in 2011-06-11 11:46:26.000000000 -0400
+++ ltib/rpm/BUILD/Python-2.7.2/Makefile.pre.in 2011-11-14 12:10:41.013373444 -0500
@@ -182,6 +182,7 @@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
+HOSTPYTHON= ./$(BUILDPYTHON)
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
@@ -215,6 +216,8 @@
# Parser
PGEN= Parser/pgen$(EXE)
+HOSTPGEN= $(PGEN)
+
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -407,8 +410,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -542,7 +545,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-touch Parser/pgen.stamp
$(PGEN): $(PGENOBJS)
@@ -925,26 +928,26 @@
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
@@ -1049,7 +1052,9 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+ --skip-build \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
diff -urN Python-2.7.2/setup.py ltib/rpm/BUILD/Python-2.7.2/setup.py
--- Python-2.7.2/setup.py 2011-06-11 11:46:28.000000000 -0400
+++ ltib/rpm/BUILD/Python-2.7.2/setup.py 2011-11-14 12:13:02.175758583 -0500
@@ -145,6 +145,7 @@
def __init__(self, dist):
build_ext.__init__(self, dist)
self.failed = []
+ self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes'
def build_extensions(self):
@@ -278,6 +279,14 @@
(ext.name, sys.exc_info()[1]))
self.failed.append(ext.name)
return
+
+ # Import check will not work when cross-compiling.
+ if os.environ.has_key('PYTHONXCPREFIX'):
+ self.announce(
+ 'WARNING: skipping import check for cross-compiled: "%s"' %
+ ext.name)
+ return
+
# Workaround for Mac OS X: The Carbon-based modules cannot be
# reliably imported into a command-line Python
if 'Carbon' in ext.extra_link_args:
@@ -369,9 +378,10 @@
def detect_modules(self):
# Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
- self.add_multiarch_paths()
+ if not self.cross_compile:
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -408,7 +418,8 @@
add_dir_to_list(dir_list, directory)
if os.path.normpath(sys.prefix) != '/usr' \
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
+ and not self.cross_compile:
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
# building a framework with different architectures than
@@ -426,11 +437,14 @@
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
- lib_dirs = self.compiler.library_dirs + [
- '/lib64', '/usr/lib64',
- '/lib', '/usr/lib',
- ]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ lib_dirs = self.compiler.library_dirs
+ inc_dirs = self.compiler.include_dirs
+ if not self.cross_compile:
+ lib_dirs += [
+ '/lib64', '/usr/lib64',
+ '/lib', '/usr/lib',
+ ]
+ inc_dirs += ['/usr/include']
exts = []
missing = []
@@ -1864,8 +1878,15 @@
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
+ if self.cross_compile:
+ cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \
+ % (ffi_builddir, ffi_srcdir,
+ os.environ.get('HOSTARCH'),
+ os.environ.get('BUILDARCH'),
+ " ".join(config_args))
+ else:
+ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
+ % (ffi_builddir, ffi_srcdir, " ".join(config_args))
res = os.system(cmd)
if res or not os.path.exists(ffi_configfile):
--- Python-2.6.6.orig//Lib/plat-linux3/regen 1970-01-01 01:00:00.000000000 +0100
+++ Python-2.6.6/Lib/plat-linux3/regen 2001-08-09 14:48:17.000000000 +0200
@@ -0,0 +1,8 @@
+#! /bin/sh
+case `uname` in
+Linux*) ;;
+*) echo Probably not on a Linux system 1>&2
+ exit 1;;
+esac
+set -v
+h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h

View File

@@ -0,0 +1,264 @@
diff -ur Python-2.7.3.orig/configure Python-2.7.3-Source/configure
--- Python-2.7.3.orig/configure 2012-04-09 19:07:36.000000000 -0400
+++ Python-2.7.3-Source/configure 2012-10-23 14:10:45.305220393 -0400
@@ -13697,7 +13697,7 @@
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- ac_cv_have_long_long_format=no
+ ac_cv_have_long_long_format="cross -- assuming yes"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -13749,7 +13749,7 @@
$as_echo "$ac_cv_have_long_long_format" >&6; }
fi
-if test "$ac_cv_have_long_long_format" = yes
+if test "$ac_cv_have_long_long_format" != no
then
$as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h
diff -ur Python-2.7.3.orig/Makefile.pre.in Python-2.7.3-Source/Makefile.pre.in
--- Python-2.7.3.orig/Makefile.pre.in 2012-04-09 19:07:33.000000000 -0400
+++ Python-2.7.3-Source/Makefile.pre.in 2012-10-23 14:10:45.305220393 -0400
@@ -182,6 +182,7 @@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
+HOSTPYTHON= ./$(BUILDPYTHON)
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
@@ -215,6 +216,8 @@
# Parser
PGEN= Parser/pgen$(EXE)
+HOSTPGEN= $(PGEN)
+
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -408,8 +411,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -543,7 +546,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-touch Parser/pgen.stamp
$(PGEN): $(PGENOBJS)
@@ -938,26 +941,26 @@
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ ./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ ./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ ./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ ./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ ./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
@@ -1062,7 +1065,9 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+ --skip-build \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
diff -ur Python-2.7.3.orig/setup.py Python-2.7.3-Source/setup.py
--- Python-2.7.3.orig/setup.py 2012-04-09 19:07:36.000000000 -0400
+++ Python-2.7.3-Source/setup.py 2012-10-23 14:10:56.085220237 -0400
@@ -145,6 +145,7 @@
def __init__(self, dist):
build_ext.__init__(self, dist)
self.failed = []
+ self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes'
def build_extensions(self):
@@ -278,6 +279,14 @@
(ext.name, sys.exc_info()[1]))
self.failed.append(ext.name)
return
+
+ # Import check will not work when cross-compiling.
+ if os.environ.has_key('PYTHONXCPREFIX'):
+ self.announce(
+ 'WARNING: skipping import check for cross-compiled: "%s"' %
+ ext.name)
+ return
+
# Workaround for Mac OS X: The Carbon-based modules cannot be
# reliably imported into a command-line Python
if 'Carbon' in ext.extra_link_args:
@@ -369,9 +378,10 @@
def detect_modules(self):
# Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
- self.add_multiarch_paths()
+ if not self.cross_compile:
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -408,7 +418,8 @@
add_dir_to_list(dir_list, directory)
if os.path.normpath(sys.prefix) != '/usr' \
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
+ and not self.cross_compile:
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
# building a framework with different architectures than
@@ -426,11 +437,23 @@
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
- lib_dirs = self.compiler.library_dirs + [
- '/lib64', '/usr/lib64',
- '/lib', '/usr/lib',
- ]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ lib_dirs = self.compiler.library_dirs
+ inc_dirs = self.compiler.include_dirs
+ if not self.cross_compile:
+ lib_dirs += [
+ '/lib64', '/usr/lib64',
+ '/lib', '/usr/lib',
+ ]
+ inc_dirs += ['/usr/include']
+ else:
+ # The common install prefix of 3rd party libraries used during
+ # cross compilation
+ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
+ if mydir:
+ inc_dirs += [mydir + '/include' ]
+ inc_dirs += [mydir + '/lib/libffi-3.0.10/include']
+ lib_dirs += [mydir + '/lib' ]
+
exts = []
missing = []
@@ -1004,13 +1027,24 @@
# We hunt for #define SQLITE_VERSION "n.n.n"
# We need to find >= sqlite version 3.0.8
sqlite_incdir = sqlite_libdir = None
- sqlite_inc_paths = [ '/usr/include',
- '/usr/include/sqlite',
- '/usr/include/sqlite3',
- '/usr/local/include',
- '/usr/local/include/sqlite',
- '/usr/local/include/sqlite3',
- ]
+
+ if not self.cross_compile:
+ sqlite_inc_paths = [ '/usr/include',
+ '/usr/include/sqlite',
+ '/usr/include/sqlite3',
+ '/usr/local/include',
+ '/usr/local/include/sqlite',
+ '/usr/local/include/sqlite3',
+ ]
+ else:
+ # The common install prefix of 3rd party headers used during
+ # cross compilation
+ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
+ if mydir:
+ sqlite_inc_paths = [mydir + '/include' ]
+ else:
+ sqlite_inc_paths = []
+
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = ".".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER])
@@ -1050,12 +1084,22 @@
print "sqlite: %s had no SQLITE_VERSION"%(f,)
if sqlite_incdir:
- sqlite_dirs_to_check = [
- os.path.join(sqlite_incdir, '..', 'lib64'),
- os.path.join(sqlite_incdir, '..', 'lib'),
- os.path.join(sqlite_incdir, '..', '..', 'lib64'),
- os.path.join(sqlite_incdir, '..', '..', 'lib'),
- ]
+ if not self.cross_compile:
+ sqlite_dirs_to_check = [
+ os.path.join(sqlite_incdir, '..', 'lib64'),
+ os.path.join(sqlite_incdir, '..', 'lib'),
+ os.path.join(sqlite_incdir, '..', '..', 'lib64'),
+ os.path.join(sqlite_incdir, '..', '..', 'lib'),
+ ]
+ else:
+ # The common install prefix of 3rd party headers used during
+ # cross compilation
+ mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
+ if mydir:
+ sqlite_dirs_to_check = [mydir + '/lib' ]
+ else:
+ sqlite_dirs_to_check = []
+
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
if sqlite_libfile:
@@ -1864,8 +1908,15 @@
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
+ if self.cross_compile:
+ cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \
+ % (ffi_builddir, ffi_srcdir,
+ os.environ.get('HOSTARCH'),
+ os.environ.get('BUILDARCH'),
+ " ".join(config_args))
+ else:
+ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
+ % (ffi_builddir, ffi_srcdir, " ".join(config_args))
res = os.system(cmd)
if res or not os.path.exists(ffi_configfile):

View File

@@ -0,0 +1,128 @@
diff -ruN Python-3.2.2-old//configure Python-3.2.2/configure
--- Python-3.2.2-old//configure 2011-09-04 02:16:50.000000000 +1000
+++ Python-3.2.2/configure 2011-10-30 19:19:13.852835272 +1000
@@ -12160,7 +12160,7 @@
if ${ac_cv_broken_sem_getvalue+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
+ if test "$cross_compiling" = no; then :
ac_cv_broken_sem_getvalue=yes
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -13625,7 +13625,7 @@
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- ac_cv_have_long_long_format=no
+ ac_cv_have_long_long_format="yes"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff -ruN Python-3.2.2-old//Makefile.pre.in Python-3.2.2/Makefile.pre.in
--- Python-3.2.2-old//Makefile.pre.in 2011-09-04 02:16:45.000000000 +1000
+++ Python-3.2.2/Makefile.pre.in 2011-10-30 19:25:23.480851641 +1000
@@ -435,8 +435,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -587,7 +587,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-touch Parser/pgen.stamp
$(PGEN): $(PGENOBJS)
@@ -1102,7 +1102,8 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
+ $(RUNSHARED) ./$(HOSTPYTHON) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
diff -ruN Python-3.1.3Orig/setup.py Python-3.1.3/setup.py
--- Python-3.1.3Orig/setup.py 2010-11-26 21:56:26.000000000 +1000
+++ Python-3.1.3/setup.py 2011-01-03 23:08:51.489831251 +1000
@@ -292,6 +292,8 @@
self.announce('WARNING: skipping import check for Cygwin-based "%s"'
% ext.name)
return
+ if os.environ.get('CROSS_COMPILE_TARGET') == 'yes':
+ return
ext_filename = os.path.join(
self.build_lib,
self.get_ext_filename(self.get_ext_fullname(ext.name)))
@@ -304,27 +306,31 @@
try:
imp.load_dynamic(ext.name, ext_filename)
except ImportError as why:
- self.failed.append(ext.name)
- self.announce('*** WARNING: renaming "%s" since importing it'
- ' failed: %s' % (ext.name, why), level=3)
- assert not self.inplace
- basename, tail = os.path.splitext(ext_filename)
- newname = basename + "_failed" + tail
- if os.path.exists(newname):
- os.remove(newname)
- os.rename(ext_filename, newname)
-
- # XXX -- This relies on a Vile HACK in
- # distutils.command.build_ext.build_extension(). The
- # _built_objects attribute is stored there strictly for
- # use here.
- # If there is a failure, _built_objects may not be there,
- # so catch the AttributeError and move on.
- try:
- for filename in self._built_objects:
- os.remove(filename)
- except AttributeError:
- self.announce('unable to remove files (ignored)')
+ if os.environ.get('CROSS_COMPILE_TARGET') != "yes":
+ self.announce('*** WARNING: renaming "%s" since importing it'
+ ' failed: %s' % (ext.name, why), level=3)
+ assert not self.inplace
+ basename, tail = os.path.splitext(ext_filename)
+ newname = basename + "_failed" + tail
+ if os.path.exists(newname):
+ os.remove(newname)
+ os.rename(ext_filename, newname)
+
+ # XXX -- This relies on a Vile HACK in
+ # distutils.command.build_ext.build_extension(). The
+ # _built_objects attribute is stored there strictly for
+ # use here.
+ # If there is a failure, _built_objects may not be there,
+ # so catch the AttributeError and move on.
+ try:
+ for filename in self._built_objects:
+ os.remove(filename)
+ except AttributeError:
+ self.announce('unable to remove files (ignored)')
+ else:
+ self.announce('WARNING: "%s" failed importing, but we leave it '
+ 'because we are cross-compiling' %
+ ext.name)
except:
exc_type, why, tb = sys.exc_info()
self.announce('*** WARNING: importing extension "%s" '
@@ -1603,7 +1609,7 @@
ffi_configfile):
from distutils.dir_util import mkpath
mkpath(ffi_builddir)
- config_args = []
+ config_args = sysconfig.get_config_var("CONFIG_ARGS").split(" ")
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.