# credits to: # http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html # http://github.com/cobbal/python-for-iphone include ../Makefile.include # lib name, version LIBNAME=Python VERSION=2.6.5 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.bz2 # configuration settings CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \ --disable-toolbox-glue --disable-framework \ --with-system-ffi CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \ CPP="gcc -E" \ CC="gcc" \ CXX="g++" \ LD="ld" \ ./configure --prefix=$(TOOLCHAIN) --enable-shared --disable-toolbox-glue --disable-framework LIBDYLIB=$(SOURCE)/libpython2.6.dylib all: $(LIBDYLIB) .installed $(TARBALLS_LOCATION)/$(ARCHIVE): $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) $(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE) rm -rf $(SOURCE) $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) echo $(SOURCE) > .gitignore # http://bugs.python.org/issue6869 cd $(SOURCE); patch -p1 < ../Python-2.6-ctypes.patch # http://bugs.python.org/issue1602133 cd $(SOURCE); patch -p1 < ../python-osx-environ-fix.patch cd $(SOURCE); $(CONFIGURE_NATIVE) cd $(SOURCE); make python.exe Parser/pgen cd $(SOURCE); mv python.exe hostpython cd $(SOURCE); mv Parser/pgen Parser/hostpgen cd $(SOURCE); mv libpython2.6.a hostlibpython2.6.a cd $(SOURCE); make install HOSTPYTHON=./hostpython cd $(SOURCE); make distclean cd $(SOURCE); patch -p1 <../Python-2.6.5-xcompile.patch sed -ie "s#/usr/include/ffi#$(PREFIX)/include/ffi#" $(SOURCE)/setup.py cd $(SOURCE); $(CONFIGURE) cd $(SOURCE); make -j $(MAKE_JOBS) HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen CROSS_COMPILE_TARGET=yes .installed: cd $(SOURCE); make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes find $(PREFIX)/lib/python2.6 -type f -name *.pyc -exec rm -f {} \; find $(PREFIX)/lib/python2.6 -type f -name *.pyo -exec rm -f {} \; touch $@ clean: rm -rf $(SOURCE) .installed distclean:: rm -rf $(SOURCE) .installed