Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit 3c4aede

Browse files
committed
Added LZMA to the build.
1 parent bb56954 commit 3c4aede

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

Makefile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ CFLAGS-watchOS=-mwatchos-version-min=2.0
5757
CFLAGS-watchos.armv7k= -fembed-bitcode
5858
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
5959

60-
# override machine for arm64
61-
MACHINE-arm64=aarch64
60+
# override machine types for arm64
61+
MACHINE_DETAILED-arm64=aarch64
62+
MACHINE_SIMPLE-arm64=arm
6263

6364
all: $(foreach os,$(OS),$(os))
6465

@@ -160,16 +161,22 @@ $(PYTHON_DIR-host)/dist/bin/python$(PYTHON_VER): $(PYTHON_DIR-host)/Makefile
160161
# - $2 - OS
161162
define build-target
162163
ARCH-$1= $$(subst .,,$$(suffix $1))
163-
ifdef MACHINE-$$(ARCH-$1)
164-
MACHINE-$1= $$(MACHINE-$$(ARCH-$1))
164+
ifdef MACHINE_DETAILED-$$(ARCH-$1)
165+
MACHINE_DETAILED-$1= $$(MACHINE_DETAILED-$$(ARCH-$1))
165166
else
166-
MACHINE-$1= $$(ARCH-$1)
167+
MACHINE_DETAILED-$1= $$(ARCH-$1)
168+
endif
169+
ifdef MACHINE_SIMPLE-$$(ARCH-$1)
170+
MACHINE_SIMPLE-$1= $$(MACHINE_SIMPLE-$$(ARCH-$1))
171+
else
172+
MACHINE_SIMPLE-$1= $$(ARCH-$1)
167173
endif
168174
SDK-$1= $$(basename $1)
169175

170176
SDK_ROOT-$1= $$(shell xcrun --sdk $$(SDK-$1) --show-sdk-path)
171-
CC-$1= xcrun --sdk $$(SDK-$1) clang\
172-
-arch $$(ARCH-$1) --sysroot=$$(SDK_ROOT-$1) $$(CFLAGS-$2) $$(CFLAGS-$1)
177+
CC-$1= xcrun --sdk $$(SDK-$1) clang\
178+
-arch $$(ARCH-$1) --sysroot=$$(SDK_ROOT-$1) $$(CFLAGS-$2) $$(CFLAGS-$1)
179+
LDFLAGS-$1= -arch $$(ARCH-$1) -isysroot=$$(SDK_ROOT-$1)
173180

174181
OPENSSL_DIR-$1= build/$2/openssl-$(OPENSSL_VERSION)-$1
175182
BZIP2_DIR-$1= build/$2/bzip2-$(BZIP2_VERSION)-$1
@@ -230,7 +237,9 @@ $$(XZ_DIR-$1)/Makefile: downloads/xz-$(XZ_VERSION).tgz
230237
# Configure the build
231238
cd $$(XZ_DIR-$1) && ./configure \
232239
CC="$$(CC-$1)" \
233-
--host=$$(MACHINE-$1)-apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
240+
LDFLAGS="$$(LDFLAGS-$1)" \
241+
--disable-shared --enable-static \
242+
--host=$$(MACHINE_SIMPLE-$1)-apple-darwin \
234243
--prefix=$(PROJECT_DIR)/build/$2/xz
235244

236245
# Build XZ
@@ -250,14 +259,14 @@ $$(PYTHON_DIR-$1)/Makefile: downloads/Python-$(PYTHON_VERSION).tgz $(PYTHON_HOST
250259
# Configure target Python
251260
cd $$(PYTHON_DIR-$1) && PATH=$(PROJECT_DIR)/$(PYTHON_DIR-host)/dist/bin:$(PATH) ./configure \
252261
CC="$$(CC-$1)" LD="$$(CC-$1)" \
253-
--host=$$(MACHINE-$1)-apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
262+
--host=$$(MACHINE_DETAILED-$1)-apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
254263
--prefix=$(PROJECT_DIR)/$$(PYTHON_DIR-$1)/dist \
255264
--without-pymalloc --without-doc-strings --disable-ipv6 --without-ensurepip \
256265
ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \
257266
$$(PYTHON_CONFIGURE-$2)
258267

259268
# Build Python
260-
$$(PYTHON_DIR-$1)/dist/lib/libpython$(PYTHON_VER).a: $$(PYTHON_DIR-$1)/Makefile build/$2/OpenSSL.framework build/$2/bzip2/lib/libbz2.a
269+
$$(PYTHON_DIR-$1)/dist/lib/libpython$(PYTHON_VER).a: $$(PYTHON_DIR-$1)/Makefile build/$2/OpenSSL.framework build/$2/bzip2/lib/libbz2.a build/$2/xz/lib/liblzma.a
261270
# Build target Python
262271
cd $$(PYTHON_DIR-$1) && PATH=$(PROJECT_DIR)/$(PYTHON_DIR-host)/dist/bin:$(PATH) make all install
263272

@@ -267,7 +276,7 @@ build/$2/$$(pyconfig.h-$1): $$(PYTHON_DIR-$1)/dist/include/python$(PYTHON_VER)/p
267276
# Dump vars (for test)
268277
vars-$1:
269278
@echo "ARCH-$1: $$(ARCH-$1)"
270-
@echo "MACHINE-$1: $$(MACHINE-$1)"
279+
@echo "MACHINE_DETAILED-$1: $$(MACHINE_DETAILED-$1)"
271280
@echo "SDK-$1: $$(SDK-$1)"
272281
@echo "SDK_ROOT-$1: $$(SDK_ROOT-$1)"
273282
@echo "CC-$1: $$(CC-$1)"

patch/Python/Setup.embedded

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ _elementtree _elementtree.c \
1919
_heapq _heapqmodule.c
2020
_json _json.c
2121
_lsprof _lsprof.o rotatingtree.c
22-
# _lzma _lzmamodule.c -I$(srcdir)/../xz/include -L$(srcdir)/../xz/lib -llzma
22+
_lzma _lzmamodule.c -I$(srcdir)/../xz/include -L$(srcdir)/../xz/lib -llzma
2323
_md5 md5module.c
2424
_multibytecodec cjkcodecs/multibytecodec.c
2525
_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c

patch/Python/lib-exclude.lst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
bsddb
21
config-*
3-
ctypes/test
4-
curses
5-
distutils/tests
6-
ensurepip
7-
hotshot
8-
idlelib
9-
lib2to3/tests
10-
site-packages
11-
sqlite3/test
12-
test
2+
ctypes/test/*
3+
curses/*
4+
distutils/tests/*
5+
ensurepip/*
6+
idlelib/*
7+
lib2to3/tests/*
8+
site-packages/*
9+
sqlite3/test/*
10+
test/*
11+
tkinter/*
1312
turtle.py
14-
turtledemo
15-
wsgiref
13+
turtledemo/*
14+
wsgiref/*

0 commit comments

Comments
 (0)