blob: ad4d715b86df1c12b0c02f57d482826cbd6170f4 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
include ../../Makefile.include
DEPS= ../../Makefile.include Makefile crosscompile.patch android.patch no-export-path.patch android-nl_langinfo.patch \
setup.patch fix-datetime.patch fix-ffi.patch android-binmodule.patch no-abort.patch urllib.patch modules.setup make-fork-optional.patch
# lib name, version
LIBNAME=Python
VERSION=2.7.14
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.xz
ifeq ($(OS),osx)
HOSTPLATFORM=_PYTHON_HOST_PLATFORM="darwin"
endif
ifeq ($(OS),ios)
HOSTPLATFORM=_PYTHON_HOST_PLATFORM="darwin"
LINK_ICONV=-framework CoreFoundation -liconv
endif
# configuration settings
CONFIGURE=OPT="$(CFLAGS)" \
LIBS=-lm \
./configure --prefix=$(PREFIX) --host=$(HOST) \
--disable-toolbox-glue --disable-framework --with-system-expat --with-system-ffi --without-pymalloc --enable-ipv6
LIBDYLIB=$(PLATFORM)/libpython2.7.a
all: .installed-$(PLATFORM)
$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
echo $(NATIVEPREFIX)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); patch -p1 < ../crosscompile.patch
cd $(PLATFORM); patch -p0 < ../setup.patch
cd $(PLATFORM); patch -p0 < ../fix-datetime.patch
cd $(PLATFORM); patch -p0 < ../android.patch
cd $(PLATFORM); patch -p0 < ../no-export-path.patch
cd $(PLATFORM); patch -p0 < ../fix-ffi.patch
cd $(PLATFORM); patch -p0 < ../android-binmodule.patch
cd $(PLATFORM); patch -p1 < ../no-abort.patch
cd $(PLATFORM); patch -p1 < ../android-nl_langinfo.patch
ifeq ($(OS),ios)
cd $(PLATFORM); patch -p0 < ../make-fork-optional.patch
cd $(PLATFORM); patch -p0 < ../urllib.patch
cd $(PLATFORM); sed -ie 's|MACHDEP="unknown"|MACHDEP="darwin"|' configure.ac
endif
cp modules.setup $(PLATFORM)/Modules/Setup.dist
#Add -liconv as needed, and add the _scproxy module for darwin
# disable locale altogether for Android
ifeq ($(OS),android)
cd $(PLATFORM); sed -ie 's|_locale _localemodule.c -lintl|#_locale _localemodule.c -lintl|' Modules/Setup.dist
else
cd $(PLATFORM); sed -ie 's|_locale _localemodule.c -lintl|_locale _localemodule.c -lintl $(LINK_ICONV) |' Modules/Setup.dist
endif
ifeq ($(OS),osx)
cd $(PLATFORM); sed -ie 's|MACHDEP="unknown"|MACHDEP="darwin"|' configure.ac
echo "_scproxy \$$(srcdir)/Mac/Modules/_scproxy.c -framework SystemConfiguration -framework CoreFoundation" >> $(PLATFORM)/Modules/Setup.dist
endif
ifeq ($(OS),android)
cd $(PLATFORM); sed -ie 's|-framework CoreFoundation||' configure.ac
endif
cd $(PLATFORM); $(AUTORECONF)
cd $(PLATFORM); $(CONFIGURE)
$(LIBDYLIB): $(PLATFORM)
$(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python NATIVE_PGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes libpython2.7.a
touch $@
.installed-$(PLATFORM): $(LIBDYLIB)
$(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python NATIVE_PGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes install
find $(PREFIX)/lib/python2.7 -type f -name "*.py" -delete
find $(PREFIX)/lib/python2.7 -type f -name "*.pyc" -delete
touch $(LIBDYLIB)
touch $@
clean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)
distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
|