aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavilla <davilla@4pi.com>2011-10-07 20:32:42 -0400
committerdavilla <davilla@4pi.com>2011-10-07 20:38:29 -0400
commitfd7bea10a58fd1b81b1715e6f83f5e8bea540b32 (patch)
tree97dd5226f62694a295deda37a1918b54e8d85bdd
parent62798c735e186fe334a387d3a9871e5563ddef98 (diff)
[osx/ios] fixed build of script.module.pil, this also add the ability to cross-build any python module
-rw-r--r--lib/addons/script.module.pil/Imaging-1.1.7-crosscompiling-0.1.patch34
-rw-r--r--lib/addons/script.module.pil/Imaging-1.1.7-setuptools-0.1.patch12
-rw-r--r--lib/addons/script.module.pil/Makefile.in17
-rw-r--r--tools/darwin/depends/Makefile.in3
-rw-r--r--tools/darwin/depends/distribute/Makefile32
-rw-r--r--tools/darwin/depends/distutilscross/Makefile32
-rw-r--r--tools/darwin/depends/python26/Makefile.ios5
-rw-r--r--tools/darwin/depends/python26/Makefile.osx13
8 files changed, 141 insertions, 7 deletions
diff --git a/lib/addons/script.module.pil/Imaging-1.1.7-crosscompiling-0.1.patch b/lib/addons/script.module.pil/Imaging-1.1.7-crosscompiling-0.1.patch
new file mode 100644
index 0000000000..ccd7afde48
--- /dev/null
+++ b/lib/addons/script.module.pil/Imaging-1.1.7-crosscompiling-0.1.patch
@@ -0,0 +1,34 @@
+diff -Naur Imaging-1.1.7/setup.py Imaging-1.1.7.patch/setup.py
+--- Imaging-1.1.7/setup.py 2011-04-17 09:31:07.000000000 +0200
++++ Imaging-1.1.7.patch/setup.py 2011-04-17 09:54:20.880047886 +0200
+@@ -147,7 +147,6 @@
+ add_directory(library_dirs, "/opt/local/lib")
+ add_directory(include_dirs, "/opt/local/include")
+
+- add_directory(library_dirs, "/usr/local/lib")
+ # FIXME: check /opt/stuff directories here?
+
+ prefix = sysconfig.get_config_var("prefix")
+@@ -199,22 +198,6 @@
+ add_directory(include_dirs, include_root)
+
+ #
+- # add standard directories
+-
+- # look for tcl specific subdirectory (e.g debian)
+- if _tkinter:
+- tcl_dir = "/usr/include/tcl" + TCL_VERSION
+- if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
+- add_directory(include_dirs, tcl_dir)
+-
+- # standard locations
+- add_directory(library_dirs, "/usr/local/lib")
+- add_directory(include_dirs, "/usr/local/include")
+-
+- add_directory(library_dirs, "/usr/lib")
+- add_directory(include_dirs, "/usr/include")
+-
+- #
+ # insert new dirs *before* default libs, to avoid conflicts
+ # between Python PYD stub libs and real libraries
+
diff --git a/lib/addons/script.module.pil/Imaging-1.1.7-setuptools-0.1.patch b/lib/addons/script.module.pil/Imaging-1.1.7-setuptools-0.1.patch
new file mode 100644
index 0000000000..a59ea79c5b
--- /dev/null
+++ b/lib/addons/script.module.pil/Imaging-1.1.7-setuptools-0.1.patch
@@ -0,0 +1,12 @@
+diff -Naur Imaging-1.1.7/setup.py Imaging-1.1.7.patch/setup.py
+--- Imaging-1.1.7/setup.py 2009-11-15 17:06:10.000000000 +0100
++++ Imaging-1.1.7.patch/setup.py 2011-04-17 09:31:07.545708559 +0200
+@@ -83,7 +83,7 @@
+ # --------------------------------------------------------------------
+
+ from distutils import sysconfig
+-from distutils.core import Extension, setup
++from setuptools import Extension, setup
+ from distutils.command.build_ext import build_ext
+
+ try:
diff --git a/lib/addons/script.module.pil/Makefile.in b/lib/addons/script.module.pil/Makefile.in
index bc8696ce06..4fb5db97c3 100644
--- a/lib/addons/script.module.pil/Makefile.in
+++ b/lib/addons/script.module.pil/Makefile.in
@@ -11,8 +11,13 @@ ARCHIVE_TOOL=tar
ARCHIVE_TOOL_FLAGS=xf
ifeq ($(OSTYPE),Darwin)
-include ../../../tools/darwin/depends/config.site.mk
-PYTHON=$(prefix_path)/bin/python
+include @abs_top_srcdir@/tools/darwin/depends/Makefile.include
+include @abs_top_srcdir@/tools/darwin/depends/config.site.mk
+export TARBALLS_LOCATION=.
+export PYTHONXCPREFIX=$(PREFIX)
+export LDFLAGS+=-L$(PREFIX)/lib
+PYTHON=$(TOOLCHAIN)/bin/python
+PYTHONCROSS=--cross-compile
else
PYTHON=@PYTHON@
endif
@@ -32,10 +37,16 @@ $(ARCHIVE):
$(SOURCE): $(ARCHIVE)
-rm -rf $(SOURCE)
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(ARCHIVE)
+ if test "$(OSTYPE)" = "Darwin"; then \
+ cd $(SOURCE); \
+ patch -p1 < ../Imaging-1.1.7-crosscompiling-0.1.patch; \
+ patch -p1 < ../Imaging-1.1.7-setuptools-0.1.patch; \
+ sed -ie "s|"darwin"|"darwinNot"|g" "setup.py"; \
+ fi
$(DESTDIR): $(SOURCE)
-rm -rf $(DESTDIR)
- pushd $(SOURCE) && $(PYTHON) setup.py build --build-lib $(DESTDIR); popd
+ pushd $(SOURCE) && $(PYTHON) setup.py build $(PYTHONCROSS) --build-lib $(DESTDIR); popd
else
$(DESTDIR):
@true
diff --git a/tools/darwin/depends/Makefile.in b/tools/darwin/depends/Makefile.in
index cb2d6db14a..9109db72c0 100644
--- a/tools/darwin/depends/Makefile.in
+++ b/tools/darwin/depends/Makefile.in
@@ -13,7 +13,8 @@ SUBDIRS := \
libmicrohttpd libmodplug libbluray libyajl \
libgpg-error libgcrypt afpfs-ng \
libplist libshairport \
- samba python26 mysqlclient boost \
+ samba python26 distribute distutilscross \
+ mysqlclient boost \
ifeq ($(DARWIN), ios)
EXCLUDED = libcrystalhd libGLEW libsdl libsdl_mixer libsdl_image
diff --git a/tools/darwin/depends/distribute/Makefile b/tools/darwin/depends/distribute/Makefile
new file mode 100644
index 0000000000..7b1b5954db
--- /dev/null
+++ b/tools/darwin/depends/distribute/Makefile
@@ -0,0 +1,32 @@
+include ../Makefile.include
+
+# lib name, version
+APPNAME=distribute
+VERSION=0.6.21
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PATH:=$(TOOLCHAIN)/bin:$(PATH)
+
+APP=$(SOURCE)/bin/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
+
+all: $(APPBIN)
+
+$(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
+
+$(APPBIN): $(SOURCE)
+ cd $(SOURCE); $(TOOLCHAIN)/bin/python setup.py install --prefix=$(TOOLCHAIN)
+
+clean:
+ rm -rf $(SOURCE)
+
+distclean::
+ rm -rf $(SOURCE)
diff --git a/tools/darwin/depends/distutilscross/Makefile b/tools/darwin/depends/distutilscross/Makefile
new file mode 100644
index 0000000000..63527081ee
--- /dev/null
+++ b/tools/darwin/depends/distutilscross/Makefile
@@ -0,0 +1,32 @@
+include ../Makefile.include
+
+# lib name, version
+APPNAME=distutilscross
+VERSION=0.1
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export PATH:=$(TOOLCHAIN)/bin:$(PATH)
+
+APP=$(SOURCE)/bin/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
+
+all: $(APPBIN)
+
+$(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
+
+$(APPBIN): $(SOURCE)
+ cd $(SOURCE); $(TOOLCHAIN)/bin/python setup.py install --prefix=$(TOOLCHAIN)
+
+clean:
+ rm -rf $(SOURCE)
+
+distclean::
+ rm -rf $(SOURCE)
diff --git a/tools/darwin/depends/python26/Makefile.ios b/tools/darwin/depends/python26/Makefile.ios
index 01d1323c1a..b07b41367c 100644
--- a/tools/darwin/depends/python26/Makefile.ios
+++ b/tools/darwin/depends/python26/Makefile.ios
@@ -12,14 +12,14 @@ ARCHIVE=$(SOURCE).tar.bz2
# configuration settings
CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \
- --disable-toolbox-glue
+ --disable-toolbox-glue --disable-framework
CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \
CPP="/usr/bin/cpp" \
CC="gcc-4.2" \
CXX="g++-4.2" \
LD="ld" \
- ./configure
+ ./configure --prefix=$(TOOLCHAIN) --enable-shared --disable-toolbox-glue --disable-framework
LIBDYLIB=$(SOURCE)/libpython2.6.dylib
@@ -39,6 +39,7 @@ $(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
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
cd $(SOURCE); $(CONFIGURE)
diff --git a/tools/darwin/depends/python26/Makefile.osx b/tools/darwin/depends/python26/Makefile.osx
index 51c115d7bf..f923940653 100644
--- a/tools/darwin/depends/python26/Makefile.osx
+++ b/tools/darwin/depends/python26/Makefile.osx
@@ -9,7 +9,14 @@ ARCHIVE=$(SOURCE).tar.bz2
# configuration settings
export OPT=$(CFLAGS)
CONFIGURE=./configure --prefix=$(PREFIX) \
- --enable-shared --disable-toolbox-glue --enable-unicode=ucs4
+ --enable-shared --disable-toolbox-glue --disable-framework --enable-unicode=ucs4
+
+CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \
+ CPP="/usr/bin/cpp" \
+ CC="gcc-4.2" \
+ CXX="g++-4.2" \
+ LD="ld" \
+ ./configure --prefix=$(TOOLCHAIN) --enable-shared --disable-toolbox-glue --disable-framework
LIBDYLIB=$(SOURCE)/libpython2.6.dylib
@@ -24,6 +31,10 @@ $(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
# http://bugs.python.org/issue6869
cd $(SOURCE); patch -p1 < ../Python-2.6-ctypes.patch
+ cd $(SOURCE); $(CONFIGURE_NATIVE)
+ cd $(SOURCE); make -j $(MAKE_JOBS)
+ cd $(SOURCE); make install
+ cd $(SOURCE); make distclean
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.