From f41f0ec99c2b5e087b665415260c187c7d8ae631 Mon Sep 17 00:00:00 2001 From: davilla Date: Wed, 16 May 2012 02:39:32 -0400 Subject: [osx/ios] fixed, build libffi and use it with python26 to create _ctypes.so for ios, use it for osx too --- tools/darwin/depends/Makefile.in | 2 +- tools/darwin/depends/config.site_ios.in | 8 +++++ tools/darwin/depends/libffi/Makefile | 40 ++++++++++++++++++++++ tools/darwin/depends/python26/Makefile.ios | 4 ++- tools/darwin/depends/python26/Makefile.osx | 6 ++-- .../depends/python26/Python-2.6.5-xcompile.patch | 2 +- 6 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 tools/darwin/depends/libffi/Makefile (limited to 'tools') diff --git a/tools/darwin/depends/Makefile.in b/tools/darwin/depends/Makefile.in index 298251ead3..fa660855de 100644 --- a/tools/darwin/depends/Makefile.in +++ b/tools/darwin/depends/Makefile.in @@ -10,7 +10,7 @@ SUBDIRS := \ libvorbis libflac libmp3lame libmad fribidi libmpeg2 \ libass libcdio libsamplerate libcrystalhd libnfs \ libGLEW libsdl libsdl_mixer libsdl_image \ - libmicrohttpd libmodplug libbluray libyajl \ + libmicrohttpd libmodplug libbluray libyajl libffi \ libgpg-error libgcrypt afpfs-ng \ libplist libshairport libcec tinyxml \ samba python26 distribute distutilscross \ diff --git a/tools/darwin/depends/config.site_ios.in b/tools/darwin/depends/config.site_ios.in index e6e73c8c1c..de77a69a97 100644 --- a/tools/darwin/depends/config.site_ios.in +++ b/tools/darwin/depends/config.site_ios.in @@ -120,3 +120,11 @@ if test "${PACKAGE_NAME}" = "libjpeg-turbo" ; then export CCAS="${AS}" export CFLAGS="${CFLAGS} -fexceptions" fi + +# tweaks for libffi (ios must use llvm-gcc-4.2) +if test "${PACKAGE_NAME}" = "libffi" ; then + export CC="${platform_path}/usr/bin/llvm-gcc-4.2" + export CPP="${platform_path}/usr/bin/llvm-gcc-4.2 -E" + unset AS + unset CCAS +fi diff --git a/tools/darwin/depends/libffi/Makefile b/tools/darwin/depends/libffi/Makefile new file mode 100644 index 0000000000..9893e3859a --- /dev/null +++ b/tools/darwin/depends/libffi/Makefile @@ -0,0 +1,40 @@ +include ../Makefile.include + +# lib name, version +LIBNAME=libffi +VERSION=3.0.11 +SOURCE=$(LIBNAME)-$(VERSION) +ARCHIVE=$(SOURCE).tar.gz +BASE_URL=ftp://sourceware.org/pub/libffi + +# configuration settings +CONFIGURE=./configure --prefix=$(PREFIX) + +LIBDYLIB=$(SOURCE)/$(LIBNAME)/.libs/$(LIBNAME).dylib + +all: $(LIBDYLIB) .installed + +$(TARBALLS_LOCATION)/$(ARCHIVE): + $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) + +$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE) + rm -rf $(SOURCE) + $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + echo $(SOURCE) > .gitignore + cd $(SOURCE); $(CONFIGURE) + +$(LIBDYLIB): $(SOURCE) + make -j 1 -C $(SOURCE) + +.installed: + make -C $(SOURCE) install + mkdir -p $(PREFIX)/include/ffi + cp $(PREFIX)/lib/$(SOURCE)/include/* $(PREFIX)/include/ffi/ + touch $@ + +clean: + make -C $(SOURCE) clean + rm -f .installed + +distclean:: + rm -rf $(SOURCE) .installed diff --git a/tools/darwin/depends/python26/Makefile.ios b/tools/darwin/depends/python26/Makefile.ios index e337e7244f..2be1319710 100644 --- a/tools/darwin/depends/python26/Makefile.ios +++ b/tools/darwin/depends/python26/Makefile.ios @@ -12,7 +12,8 @@ ARCHIVE=$(SOURCE).tar.bz2 # configuration settings CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \ - --disable-toolbox-glue --disable-framework + --disable-toolbox-glue --disable-framework \ + --with-system-ffi CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \ CPP="gcc -E" \ @@ -42,6 +43,7 @@ $(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE) 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 diff --git a/tools/darwin/depends/python26/Makefile.osx b/tools/darwin/depends/python26/Makefile.osx index 113a8d8618..80cd24f360 100644 --- a/tools/darwin/depends/python26/Makefile.osx +++ b/tools/darwin/depends/python26/Makefile.osx @@ -8,8 +8,9 @@ ARCHIVE=$(SOURCE).tar.bz2 # configuration settings export OPT=$(CFLAGS) -CONFIGURE=./configure --prefix=$(PREFIX) \ - --enable-shared --disable-toolbox-glue --disable-framework --enable-unicode=ucs4 +CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \ + --disable-toolbox-glue --disable-framework --enable-unicode=ucs4 \ + --with-system-ffi CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \ CPP="gcc -E" \ @@ -35,6 +36,7 @@ $(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE) cd $(SOURCE); make -j $(MAKE_JOBS) cd $(SOURCE); make install cd $(SOURCE); make distclean + sed -ie "s#/usr/include/ffi#$(PREFIX)/include/ffi#" $(SOURCE)/setup.py cd $(SOURCE); $(CONFIGURE) # python2.6 has an issue detecting and using the same version of openssl in configure and setup.py # this forces python2.6 hashlib to be compatible with osx 10.4 boxes. diff --git a/tools/darwin/depends/python26/Python-2.6.5-xcompile.patch b/tools/darwin/depends/python26/Python-2.6.5-xcompile.patch index 51df2d347d..aa5fc8a725 100644 --- a/tools/darwin/depends/python26/Python-2.6.5-xcompile.patch +++ b/tools/darwin/depends/python26/Python-2.6.5-xcompile.patch @@ -214,7 +214,7 @@ diff -uN Python-2.6.2/setup.py Python-2.6.2POld/setup.py # This global variable is used to hold the list of modules to be disabled. -disabled_module_list = [] -+disabled_module_list = ['_ctypes', '_curses', '_curses_panel', '_cursesmodule', '_tkinter', 'syslogmodule', 'nismodule'] ++disabled_module_list = ['_curses', '_curses_panel', '_cursesmodule', '_tkinter', 'syslogmodule', 'nismodule'] def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if -- cgit v1.2.3