aboutsummaryrefslogtreecommitdiff
path: root/tools/darwin/depends/python26/Makefile.ios
blob: e337e7244fc2fd274c623756af64c66de907af38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#  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

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
	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
	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