This commit is contained in:
Mathieu Virbel 2011-12-06 10:49:14 +01:00
parent 3dac74c37c
commit b40c385f98
11 changed files with 68 additions and 457 deletions

12
biglink
View file

@ -6,7 +6,7 @@ import subprocess
sofiles = [ ]
for dir in sys.argv[1:]:
for dir in sys.argv[2:]:
for fn in os.listdir(dir):
fn = os.path.join(dir, fn)
@ -39,12 +39,6 @@ while args:
unique_args.insert(0, a)
#args = os.environ["CC"].split() + \
# [ '-shared', "-O3", "-o", "libpymodules.so" ] + \
# unique_args
#subprocess.call(args)
print unique_args
unique_args = ' '.join([ x for x in unique_args if x.endswith('.so.o') ])
print unique_args
subprocess.Popen("ar -q kivy.a " + unique_args, shell=True).communicate()
print 'Biglink create %s library' % sys.argv[1]
subprocess.Popen(("ar -q %s" % sys.argv[1]) + unique_args, shell=True).communicate()

View file

@ -3,6 +3,7 @@
. environment.sh
try ./build_python.sh
try ./reduce_python.sh
try ./build_sdl.sh
try ./build_freetype.sh
try ./build_sdlttf.sh

View file

@ -16,7 +16,7 @@ fi
# lib not found, compile it
pushd .
cd freetype-$FT_VERSION
./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=$DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 AR=$DEVROOT/usr/bin/ar LDFLAGS="-isysroot $SDKROOT -miphoneos-version-min=$SDKVER" CFLAGS="-O0 -g -miphoneos-version-min=$SDKVER -isysroot $SDKROOT"
./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=$DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 AR=$DEVROOT/usr/bin/ar LDFLAGS="-isysroot $SDKROOT -miphoneos-version-min=$SDKVER" CFLAGS="-march=armv7 -mcpu=arm1176jzf -mcpu=cortex-a8 -O0 -g -miphoneos-version-min=$SDKVER -isysroot $SDKROOT"
make clean
make

View file

@ -22,10 +22,9 @@ fi
export LDSHARED="$KIVYIOSROOT/liblink"
cd kivy
export CFLAGS="$CFLAGS -march=armv7 -mcpu=arm1176jzf-s -mcpu=cortex-a8 -g -O0"
make ios
echo "Now create kivy.a archive"
# FIXME this part is build/cpu dependent :/
build_dir=build/lib.macosx-*/kivy
try $KIVYIOSROOT/biglink $build_dir $build_dir/graphics $build_dir/core/window $build_dir/core/text $build_dir/core/image
try mv kivy.a $BUILDROOT/lib
bd=build/lib.macosx-*/kivy
try $KIVYIOSROOT/biglink $BUILDROOT/lib/libkivy.a $bd $bd/graphics $bd/core/window $bd/core/text $bd/core/image

View file

@ -2,168 +2,65 @@
. ./environment.sh
set -o errexit
set -x
echo "Starting =========="
# credit to:
# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
# http://latenitesoft.blogspot.com/2008/10/iphone-programming-tips-building-unix.html
export IOS_VERSION="5.0"
PATH_SIMU=${PWD}/python_files/Python-2.7.1-IOS${IOS_VERSION}-simulator
PATH_DEV=${PWD}/python_files/Python-2.7.1-IOS${IOS_VERSION}-device
PATH_ALL=${PWD}/python_files/Python-2.7.1-IOS${IOS_VERSION}
# download python and patch if they aren't there
if [[ ! -a Python-2.7.1.tar.bz2 ]]; then
curl http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tar.bz2 > python_files/Python-2.7.1.tar.bz2
if [[ ! -a $CACHEROOT/Python-$PYTHON_VERSION.tar.bz2 ]]; then
curl http://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2 > $CACHEROOT/Python-$PYTHON_VERSION.tar.bz2
fi
# get rid of old build
rm -rf Python-2.7.1
rm -rf $PATH_SIMU
rm -rf $PATH_DEV
rm -rf $PATH_ALL
if [[ -a libpython2.7-iOS5.a ]]; then
rm -fr libpython2.7-iOS5.a
fi
tar -xjf python_files/Python-2.7.1.tar.bz2
pushd ./Python-2.7.1
rm -rf Python-$PYTHON_VERSION
tar -xjf $CACHEROOT/Python-$PYTHON_VERSION.tar.bz2
pushd ./Python-$PYTHON_VERSION
# Patch Python for temporary reduce PY_SSIZE_T_MAX otherzise, splitting string doesnet work
patch -p1 < ../python_files/Python-2.7.1-ssize-t-max.patch
patch -p1 < ../python_files/Python-2.7.1-dynload.patch
try patch -p1 < ../python_files/Python-$PYTHON_VERSION-ssize-t-max.patch
try patch -p1 < ../python_files/Python-$PYTHON_VERSION-dynload.patch
echo "Building for native machine ============================================"
# Compile some stuff statically; Modules/Setup taken from pgs4a-kivy
# Copy our setup for modules
cp ../python_files/ModulesSetup Modules/Setup.local
#CC=clang ./configure
./configure CC="clang -Qunused-arguments -fcolor-diagnostics"
echo "Building for native machine ============================================"
./configure CC="$CCACHE clang -Qunused-arguments -fcolor-diagnostics"
make python.exe Parser/pgen
#make python Parser/pgen
mv python.exe hostpython
#mv python hostpython
mv Parser/pgen Parser/hostpgen
make distclean
# patch python to cross-compile
patch -p1 < ../python_files/Python-2.7.1-xcompile.patch
# avoid iphone builddd
if [ "X" == "C" ]; then
echo "Building for iPhone Simulator ==========================================="
export MACOSX_DEPLOYMENT_TARGET=10.6
# set up environment variables for simulator compilation
export DEVROOT="/Developer/Platforms/iPhoneSimulator.platform/Developer"
export SDKROOT="$DEVROOT/SDKs/iPhoneSimulator${IOS_VERSION}.sdk"
if [ ! -d "$DEVROOT" ]; then
echo "DEVROOT doesn't exist. DEVROOT=$DEVROOT"
exit 1
fi
if [ ! -d "$SDKROOT" ]; then
echo "SDKROOT doesn't exist. SDKROOT=$SDKROOT"
exit 1
fi
export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin11/4.2.1/include/ -I$SDKROOT/usr/include/"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export LDFLAGS="-isysroot $SDKROOT"
export CPP="/usr/bin/cpp $CPPFLAGS"
# Compile some stuff statically; Modules/Setup taken from pgs4a-kivy
cp ../python_files/ModulesSetup Modules/Setup.local
./configure CC="$DEVROOT/usr/bin/i686-apple-darwin11-llvm-gcc-4.2 -m32" \
LD="$DEVROOT/usr/bin/ld" --disable-toolbox-glue --host=i386-apple-darwin --prefix=/python
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
CROSS_COMPILE_TARGET=yes
make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="$PWD/_install-simulator"
pushd _install-simulator/lib
mv libpython2.7.a libpython2.7-i386.a
popd
pushd _install-simulator
mkdir $PATH_SIMU
cp -R . $PATH_SIMU
popd
make distclean
fi
export MACOSX_DEPLOYMENT_TARGET=
echo "Building for iOS ======================================================="
# patch python to cross-compile
patch -p1 < ../python_files/Python-$PYTHON_VERSION-xcompile.patch
# set up environment variables for cross compilation
export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"
export SDKROOT="$DEVROOT/SDKs/iPhoneOS${IOS_VERSION}.sdk"
if [ ! -d "$DEVROOT" ]; then
echo "DEVROOT doesn't exist. DEVROOT=$DEVROOT"
exit 1
fi
if [ ! -d "$SDKROOT" ]; then
echo "SDKROOT doesn't exist. SDKROOT=$SDKROOT"
exit 1
fi
export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin11/4.2.1/include/ -I$SDKROOT/usr/include/"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export LDFLAGS="-isysroot $SDKROOT -Lextralibs/"
export CPP="/usr/bin/cpp $CPPFLAGS"
export CFLAGS = "$CFLAGS -march=armv7 -mcpu=arm1176jzf-s -mcpu=cortex-a8"
export LDFLAGS = "$LDFLAGS -march=armv7 -mcpu=arm1176jzf-s -mcpu=cortex-a8"
export CPP="$CCACHE /usr/bin/cpp $CPPFLAGS"
export CFLAGS="$CFLAGS -march=armv7 -mcpu=arm1176jzf-s -mcpu=cortex-a8"
export LDFLAGS="$LDFLAGS -march=armv7 -mcpu=arm1176jzf-s -mcpu=cortex-a8"
export MACOSX_DEPLOYMENT_TARGET=
# make a link to a differently named library for who knows what reason
mkdir extralibs||echo "foo"
ln -s "$SDKROOT/usr/lib/libgcc_s.1.dylib" extralibs/libgcc_s.10.4.dylib || echo "sdf"
#ln -s "$SDKROOT/usr/lib/libgcc_s.1.dylib" extralibs/libgcc_s.10.6.dylib || echo "sdf"
# Compile some stuff statically; Modules/Setup taken from pgs4a-kivy
cp ../python_files/ModulesSetup Modules/Setup.local
try ./configure CC="$CCACHE $DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2" \
LD="$DEVROOT/usr/bin/ld" \
--disable-toolbox-glue \
--host=armv7-apple-darwin \
--prefix=/python \
--without-doc-strings
# Put arm compiler in path, then ccache can use it
OLDPATH=$PATH
export PATH=$PATH:$DEVROOT/usr/bin
# XXX Should prolly use armv7 as well?
./configure CC="arm-apple-darwin10-llvm-gcc-4.2" \
LD="$DEVROOT/usr/bin/ld" --disable-toolbox-glue --host=armv7-apple-darwin --prefix=/python
# --without-doc-strings
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
try make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
CROSS_COMPILE_TARGET=yes
make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="$PWD/_install"
try make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="$BUILDROOT/python"
# Restore old path
export PATH=$OLDPATH
pushd _install/lib
mv libpython2.7.a libpython2.7-arm.a
#lipo -create -output libpython2.7.a ../../libpython2.7-i386.a libpython2.7-arm.a
popd
pushd _install
mkdir $PATH_DEV
cp -R . $PATH_DEV
mkdir $PATH_ALL
cp -R . $PATH_ALL
#lipo $PATH_DEV/lib/libpython2.7-arm.a $PATH_SIMU/lib/libpython2.7-i386.a -create -output $PATH_ALL/lib/libpython2.7-iOS5.a
#find python2.7 | grep -E '*\.(py|pyc|so\.o|so\.a|so\.libs)$' | xargs rm
#find python2.7 | grep -E '*test*' | xargs rm -rdf
cp $PATH_DEV/lib/libpython2.7-arm.a $BUILDROOT/lib/
try mv -f $BUILDROOT/python/lib/libpython2.7.a $BUILDROOT/lib/

View file

@ -19,7 +19,7 @@ rm libSDL_ttf.la
./configure --prefix=/usr/local/iphone --host=arm-apple-darwin \
--enable-static=yes --enable-shared=no \
--without-x \
CC=$DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 AR=$DEVROOT/usr/bin/ar LDFLAGS="-isysroot $SDKROOT -miphoneos-version-min=$SDKVER" CFLAGS="-O0 -g -miphoneos-version-min=$SDKVER -isysroot $SDKROOT"
CC=$DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 AR=$DEVROOT/usr/bin/ar LDFLAGS="-isysroot $SDKROOT -miphoneos-version-min=$SDKVER" CFLAGS="-march=armv7 -mcpu=arm1176jzf -mcpu=cortex-a8 -O0 -g -miphoneos-version-min=$SDKVER -isysroot $SDKROOT"
make clean
make libSDL_ttf.la

View file

@ -9,17 +9,28 @@ SDKVER=5.0
DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk
# version of packages
PYTHON_VERSION=2.7.1
# where the build will be located
ROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export BUILDROOT="$ROOT/build"
export CACHEROOT="$ROOT/.cache"
# for external project
export KIVYIOSROOT="$ROOT"
# some tools
CCACHE=$(which ccache)
# create build directory if not found
set -x
if [ ! -d $BUILDROOT ]; then
try mkdir $BUILDROOT
try mkdir $BUILDROOT/include
try mkdir $BUILDROOT/lib
try mkdir -p $BUILDROOT
try mkdir -p $BUILDROOT/include
try mkdir -p $BUILDROOT/lib
fi
if [ ! -d $CACHEROOT ]; then
try mkdir -p $CACHEROOT
fi

10
liblink
View file

@ -53,7 +53,9 @@ while i < len(sys.argv):
print "Unknown option: ", opt
sys.exit(1)
print 'append', opt, 'to output'
if not opt.endswith('.o'):
continue
objects.append(opt)
@ -64,8 +66,10 @@ f = file(output + ".libs", "w")
f.write(" ".join(libs))
f.close()
print 'objects are', objects
subprocess.call([ "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2", "-r", "-o", output + ".o" ] + objects)
print 'Liblink redirect linking with', objects
subprocess.call([
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2",
"-r", "-arch=armv7", "-o", output + ".o" ] + objects)

View file

@ -34,6 +34,10 @@ cStringIO cStringIO.c
cPickle cPickle.c
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
xxsubtype xxsubtype.c
# added in case of
unicodedata unicodedata.c # static Unicode character database
# Theses modules are used by Kivy inside other module
# json in Settings, _io by zipfile...
_json _json.c
_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c
_heapq _heapqmodule.c

View file

@ -1,301 +0,0 @@
diff -uN Python-2.6.2/configure Python-2.6.2POld/configure
--- Python-2.6.2/configure 2009-03-31 03:56:14.000000000 +1000
@@ -24326,14 +24326,14 @@
{ echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6; }
-if test "$cross_compiling" = yes; then
- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
+#if test "$cross_compiling" = yes; then
+# { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+#See \`config.log' for more details." >&5
+#echo "$as_me: error: cannot run test program while cross compiling
+#See \`config.log' for more details." >&2;}
+# { (exit 1); exit 1; }; }
+#else
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -24411,7 +24411,7 @@
echo "${ECHO_T}no" >&6; }
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+#fi
diff -uN Python-2.6.2/configure.in Python-2.6.2POld/configure.in
--- Python-2.6.2/configure.in 2009-03-31 03:56:14.000000000 +1000
+++ Python-2.6.2POld/configure.in 2009-08-17 12:19:15.000000000 +1000
@@ -3656,48 +3656,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
diff -uN Python-2.6.2/Makefile.pre.in Python-2.6.2POld/Makefile.pre.in
--- Python-2.6.2/Makefile.pre.in 2009-02-24 21:07:44.000000000 +1000
+++ Python-2.6.2POld/Makefile.pre.in 2009-08-17 12:19:15.000000000 +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)' 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
@@ -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) \
diff -uN Python-2.6.2/setup.py Python-2.6.2POld/setup.py
--- Python-2.6.2/setup.py 2009-04-01 04:20:48.000000000 +1000
+++ Python-2.6.2POld/setup.py 2009-08-17 12:19:15.000000000 +1000
@@ -17,7 +17,7 @@
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ['_ctypes']
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -267,33 +267,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" '
@@ -665,7 +672,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'],
@@ -685,7 +692,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']) )

View file

@ -16,5 +16,7 @@ PATH_ALL=${PWD}/python_files/Python-2.7.1-IOS${IOS_VERSION}
pushd $PATH_DEV/lib/python2.7
find . -iname '*.pyc' | xargs rm
find . -iname '*.py' | xargs rm
rm -rd *test*
rm -rd lib-* wsgiref bsddb curses idlelib hotshot
find . -iname 'test_*' | xargs rm -rf
rm -rf *test* config lib* wsgiref bsddb curses idlelib hotshot || true
popd
rm -rf pkgconfig || true