5
5
# - iOS - build everything for iOS
6
6
# - tvOS - build everything for tvOS
7
7
# - watchOS - build everything for watchOS
8
- # - OpenSSL.framework -macOS - build OpenSSL.framework for macOS
9
- # - OpenSSL.framework -iOS - build OpenSSL.framework for iOS
10
- # - OpenSSL.framework -tvOS - build OpenSSL.framework for tvOS
11
- # - OpenSSL.framework -watchOS - build OpenSSL.framework for watchOS
12
- # - BZip2.framework -macOS - build BZip2.framework for macOS
13
- # - BZip2.framework -iOS - build BZip2.framework for iOS
14
- # - BZip2.framework -tvOS - build BZip2.framework for tvOS
15
- # - BZip2.framework -watchOS - build BZip2.framework for watchOS
16
- # - XZ.framework -macOS - build XZ.framework for macOS
17
- # - XZ.framework -iOS - build XZ.framework for iOS
18
- # - XZ.framework -tvOS - build XZ.framework for tvOS
19
- # - XZ.framework -watchOS - build XZ.framework for watchOS
20
- # - Python.framework -macOS - build Python.framework for macOS
21
- # - Python.framework -iOS - build Python.framework for iOS
22
- # - Python.framework -tvOS - build Python.framework for tvOS
23
- # - Python.framework -watchOS - build Python.framework for watchOS
8
+ # - OpenSSL-macOS - build OpenSSL for macOS
9
+ # - OpenSSL-iOS - build OpenSSL for iOS
10
+ # - OpenSSL-tvOS - build OpenSSL for tvOS
11
+ # - OpenSSL-watchOS - build OpenSSL for watchOS
12
+ # - BZip2-macOS - build BZip2 for macOS
13
+ # - BZip2-iOS - build BZip2 for iOS
14
+ # - BZip2-tvOS - build BZip2 for tvOS
15
+ # - BZip2-watchOS - build BZip2 for watchOS
16
+ # - XZ-macOS - build XZ for macOS
17
+ # - XZ-iOS - build XZ for iOS
18
+ # - XZ-tvOS - build XZ for tvOS
19
+ # - XZ-watchOS - build XZ for watchOS
20
+ # - Python-macOS - build Python for macOS
21
+ # - Python-iOS - build Python for iOS
22
+ # - Python-tvOS - build Python for tvOS
23
+ # - Python-watchOS - build Python for watchOS
24
24
25
25
# Current director
26
26
PROJECT_DIR =$(shell pwd)
@@ -102,7 +102,7 @@ upload: $(foreach os,$(OS),$(os))
102
102
clean-OpenSSL :
103
103
rm -rf build/* /openssl-$(OPENSSL_VERSION ) -* \
104
104
build/* /libssl.a build/* /libcrypto.a \
105
- build/* /OpenSSL.framework
105
+ build/* /OpenSSL
106
106
107
107
# Download original OpenSSL source code archive.
108
108
downloads/openssl-$(OPENSSL_VERSION ) .tgz :
@@ -149,7 +149,7 @@ clean-Python:
149
149
build/* /Python-$(PYTHON_VERSION ) -* \
150
150
build/* /libpython$(PYTHON_VER ) m.a \
151
151
build/* /pyconfig-* .h \
152
- build/* /Python.framework
152
+ build/* /Python
153
153
154
154
# Download original Python source code archive.
155
155
downloads/Python-$(PYTHON_VERSION ) .tgz :
@@ -222,12 +222,16 @@ endif
222
222
223
223
# Build OpenSSL
224
224
$$(OPENSSL_DIR-$1 ) /libssl.a $$(OPENSSL_DIR-$1 ) /libcrypto.a: $$(OPENSSL_DIR-$1 ) /Makefile
225
+ # Installing multiple times causes problems with the man directory.
226
+ # Since we're just overwriting anyway, and we're not going to keep the man files
227
+ # delete the man directory (if it exists) first.
228
+ rm -rf $(PROJECT_DIR ) /build/$2/openssl/man
225
229
# Make the build
226
230
cd $$(OPENSSL_DIR-$1 ) && \
227
231
CC="$$(CC-$1 ) " \
228
232
CROSS_TOP="$$(dir $$(SDK_ROOT-$1 ) ) .." \
229
233
CROSS_SDK="$$(notdir $$(SDK_ROOT-$1 ) ) " \
230
- make all
234
+ make all && make install
231
235
232
236
# Unpack BZip2
233
237
$$(BZIP2_DIR-$1 ) /Makefile: downloads/bzip2-$(BZIP2_VERSION ) .tgz
@@ -276,7 +280,7 @@ ifeq ($2,macOS)
276
280
cd $$(PYTHON_DIR-$1) && MACOSX_DEPLOYMENT_TARGET=$$(MACOSX_DEPLOYMENT_TARGET) ./configure \
277
281
--prefix=$(PROJECT_DIR)/$$(PYTHON_DIR-$1)/dist \
278
282
--without-doc-strings --enable-ipv6 --without-ensurepip \
279
- $$(PYTHON_CONFIGU.RE -$2)
283
+ $$(PYTHON_CONFIGURE -$2)
280
284
else
281
285
cd $$(PYTHON_DIR-$1) && PATH=$(PROJECT_DIR)/build/macOS/python/bin:$(PATH) ./configure \
282
286
CC="$$(CC-$1)" LD="$$(CC-$1)" \
289
293
endif
290
294
291
295
# Build Python
292
- $$(PYTHON_DIR-$1 ) /dist/lib/libpython$(PYTHON_VER ) m.a: build/$2/OpenSSL.framework build/$2/BZip2.framework build/$2/XZ.framework $$(PYTHON_DIR-$1 ) /Makefile
296
+ $$(PYTHON_DIR-$1 ) /dist/lib/libpython$(PYTHON_VER ) m.a: build/$2/Support/ OpenSSL build/$2/Support/ BZip2 build/$2/Support/XZ $$(PYTHON_DIR-$1 ) /Makefile
293
297
# Build target Python
294
298
cd $$(PYTHON_DIR-$1 ) && PATH=$(PROJECT_DIR ) /$(PYTHON_DIR-macOS ) /dist/bin:$(PATH ) make all install
295
299
@@ -320,11 +324,11 @@ endef
320
324
define build
321
325
$$(foreach target,$$(TARGETS-$1 ) ,$$(eval $$(call build-target,$$(target ) ,$1) ) )
322
326
323
- OPENSSL_FRAMEWORK-$1=build/$1/OpenSSL.framework
324
- BZIP2_FRAMEWORK-$1=build/$1/BZip2.framework
325
- XZ_FRAMEWORK-$1=build/$1/XZ.framework
326
- PYTHON_FRAMEWORK-$1=build/$1/Python.framework
327
- PYTHON_RESOURCES-$1=$$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Resources
327
+ OPENSSL_FRAMEWORK-$1=build/$1/Support/ OpenSSL
328
+ BZIP2_FRAMEWORK-$1=build/$1/Support/ BZip2
329
+ XZ_FRAMEWORK-$1=build/$1/Support/XZ
330
+ PYTHON_FRAMEWORK-$1=build/$1/Support/ Python
331
+ PYTHON_RESOURCES-$1=$$(PYTHON_FRAMEWORK-$1 ) /Resources
328
332
329
333
$1: dist/Python-$(PYTHON_VER ) -$1-support.b$(BUILD_NUMBER ) .tar.gz
330
334
@@ -333,40 +337,33 @@ clean-$1:
333
337
334
338
dist/Python-$(PYTHON_VER ) -$1-support.b$(BUILD_NUMBER ) .tar.gz: $$(BZIP2_FRAMEWORK-$1 ) $$(XZ_FRAMEWORK-$1 ) $$(OPENSSL_FRAMEWORK-$1 ) $$(PYTHON_FRAMEWORK-$1 )
335
339
mkdir -p dist
336
- echo "Python version: $(PYTHON_VERSION ) " > build/$1/support.version
337
- echo "Build: $(BUILD_NUMBER ) " >> build/$1/support.version
340
+ echo "Python version: $(PYTHON_VERSION ) " > build/$1/Support/VERSIONS
341
+ echo "Build: $(BUILD_NUMBER ) " >> build/$1/Support/VERSIONS
342
+ echo "---------------------" >> build/$1/Support/VERSIONS
343
+ echo "BZip2: $(BZIP2_VERSION ) " >> build/$1/Support/VERSIONS
344
+ echo "OpenSSL: $(OPENSSL_VERSION ) " >> build/$1/Support/VERSIONS
345
+ echo "XZ: $(XZ_VERSION ) " >> build/$1/Support/VERSIONS
338
346
ifeq ($1,macOS)
339
347
cp -r build/$1/Python-$(PYTHON_VERSION)-macosx.x86_64/dist build/$1/python
340
- tar zcvf $$@ -C build/$1 support.version python
348
+ mv build/$1/Support/VERSIONS build/$1
349
+ tar zcvf $$@ -C build/$1 VERSIONS python
341
350
else
342
- tar zcvf $$@ -C build/$1 support.version $$(notdir $$^)
351
+ tar zcvf $$@ -C build/$1 Support
343
352
endif
344
353
345
- # Build OpenSSL.framework
346
- OpenSSL.framework -$1: $$(OPENSSL_FRAMEWORK-$1 )
354
+ # Build OpenSSL
355
+ OpenSSL-$1: $$(OPENSSL_FRAMEWORK-$1 )
347
356
348
357
$$(OPENSSL_FRAMEWORK-$1 ) : build/$1/libssl.a build/$1/libcrypto.a
349
358
# Create framework directory structure
350
- mkdir -p $$(OPENSSL_FRAMEWORK-$1 ) /Versions/ $( OPENSSL_VERSION ) /Resources
359
+ mkdir -p $$(OPENSSL_FRAMEWORK-$1 )
351
360
352
361
# Copy the headers
353
- cp -f -r $$(OPENSSL_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /include $$(OPENSSL_FRAMEWORK-$1 ) /Versions/ $( OPENSSL_VERSION ) / Headers
362
+ cp -f -r $$(OPENSSL_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /include $$(OPENSSL_FRAMEWORK-$1 ) /Headers
354
363
355
364
# Create the fat library
356
365
xcrun libtool -no_warning_for_no_symbols -static \
357
- -o $$(OPENSSL_FRAMEWORK-$1 ) /Versions/$(OPENSSL_VERSION ) /OpenSSL $$^
358
-
359
- # Create symlinks
360
- ln -fs $(OPENSSL_VERSION ) $$(OPENSSL_FRAMEWORK-$1 ) /Versions/Current
361
- ln -fs Versions/Current/Headers $$(OPENSSL_FRAMEWORK-$1 )
362
- ln -fs Versions/Current/Resources $$(OPENSSL_FRAMEWORK-$1 )
363
- ln -fs Versions/Current/OpenSSL $$(OPENSSL_FRAMEWORK-$1 )
364
-
365
- # Create plist file
366
- sed -e "s/xxxNAMExxx/OpenSSL/g" $(PROJECT_DIR ) /patch/Info.plist.tmpl > $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.1
367
- sed -e "s/xxxBUNDLExxx/org.openssl/g" $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.1 > $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.2
368
- sed -e "s/xxxVERSIONxxx/$$(OPENSSL_VERSION ) /g" $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.2 > $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist
369
- rm $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.1 $$(OPENSSL_FRAMEWORK-$1 ) /Resources/Info.plist.2
366
+ -o $$(OPENSSL_FRAMEWORK-$1 ) /libOpenSSL.a $$^
370
367
371
368
372
369
build/$1/libssl.a: $$(foreach target,$$(TARGETS-$1 ) ,$$(OPENSSL_DIR-$$(target ) ) /libssl.a)
@@ -377,83 +374,59 @@ build/$1/libcrypto.a: $$(foreach target,$$(TARGETS-$1),$$(OPENSSL_DIR-$$(target)
377
374
mkdir -p build/$1
378
375
xcrun lipo -create -output $$@ $$^
379
376
380
- # Build BZip2.framework
381
- BZip2.framework -$1: $$(BZIP2_FRAMEWORK-$1 )
377
+ # Build BZip2
378
+ BZip2-$1: $$(BZIP2_FRAMEWORK-$1 )
382
379
383
380
$$(BZIP2_FRAMEWORK-$1 ) : build/$1/bzip2/lib/libbz2.a
384
381
# Create framework directory structure
385
- mkdir -p $$(BZIP2_FRAMEWORK-$1 ) /Versions/ $( BZIP2_VERSION ) /Resources
382
+ mkdir -p $$(BZIP2_FRAMEWORK-$1 )
386
383
387
384
# Copy the headers
388
- cp -f -r build/$1/bzip2/include $$(BZIP2_FRAMEWORK-$1 ) /Versions/ $( BZIP2_VERSION ) / Headers
385
+ cp -f -r build/$1/bzip2/include $$(BZIP2_FRAMEWORK-$1 ) /Headers
389
386
390
387
# Create the fat library
391
388
xcrun libtool -no_warning_for_no_symbols -static \
392
- -o $$(BZIP2_FRAMEWORK-$1 ) /Versions/$(BZIP2_VERSION ) /bzip2 $$^
393
-
394
- # Create symlinks
395
- ln -fs $(BZIP2_VERSION ) $$(BZIP2_FRAMEWORK-$1 ) /Versions/Current
396
- ln -fs Versions/Current/Headers $$(BZIP2_FRAMEWORK-$1 )
397
- ln -fs Versions/Current/Resources $$(BZIP2_FRAMEWORK-$1 )
398
- ln -fs Versions/Current/bzip2 $$(BZIP2_FRAMEWORK-$1 )
399
-
400
- # Create plist file
401
- sed -e "s/xxxNAMExxx/BZip2/g" $(PROJECT_DIR ) /patch/Info.plist.tmpl > $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.1
402
- sed -e "s/xxxBUNDLExxx/org.bzip.bzip2/g" $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.1 > $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.2
403
- sed -e "s/xxxVERSIONxxx/$$(BZIP2_VERSION ) /g" $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.2 > $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist
404
- rm $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.1 $$(BZIP2_FRAMEWORK-$1 ) /Resources/Info.plist.2
389
+ -o $$(BZIP2_FRAMEWORK-$1 ) /libbzip2.a $$^
405
390
406
391
407
392
build/$1/bzip2/lib/libbz2.a: $$(foreach target,$$(TARGETS-$1 ) ,$$(BZIP2_DIR-$$(target ) ) /libbz2.a)
408
393
mkdir -p build/$1
409
394
xcrun lipo -create -o $$@ $$^
410
395
411
- # Build XZ.framework
412
- XZ.framework -$1: $$(XZ_FRAMEWORK-$1 )
396
+ # Build XZ
397
+ XZ-$1: $$(XZ_FRAMEWORK-$1 )
413
398
414
399
$$(XZ_FRAMEWORK-$1 ) : build/$1/xz/lib/liblzma.a
415
400
# Create framework directory structure
416
- mkdir -p $$(XZ_FRAMEWORK-$1 ) /Versions/ $( XZ_VERSION ) /Resources
401
+ mkdir -p $$(XZ_FRAMEWORK-$1 )
417
402
418
403
# Copy the headers
419
- cp -f -r build/$1/xz/include $$(XZ_FRAMEWORK-$1 ) /Versions/ $( XZ_VERSION ) / Headers
404
+ cp -f -r build/$1/xz/include $$(XZ_FRAMEWORK-$1 ) /Headers
420
405
421
406
# Create the fat library
422
407
xcrun libtool -no_warning_for_no_symbols -static \
423
- -o $$(XZ_FRAMEWORK-$1 ) /Versions/$(XZ_VERSION ) /xz $$^
424
-
425
- # Create symlinks
426
- ln -fs $(XZ_VERSION ) $$(XZ_FRAMEWORK-$1 ) /Versions/Current
427
- ln -fs Versions/Current/Headers $$(XZ_FRAMEWORK-$1 )
428
- ln -fs Versions/Current/Resources $$(XZ_FRAMEWORK-$1 )
429
- ln -fs Versions/Current/xz $$(XZ_FRAMEWORK-$1 )
430
-
431
- # Create plist file
432
- sed -e "s/xxxNAMExxx/XZ/g" $(PROJECT_DIR ) /patch/Info.plist.tmpl > $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.1
433
- sed -e "s/xxxBUNDLExxx/org.tukaani.xz/g" $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.1 > $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.2
434
- sed -e "s/xxxVERSIONxxx/$$(XZ_VERSION ) /g" $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.2 > $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist
435
- rm $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.1 $$(XZ_FRAMEWORK-$1 ) /Resources/Info.plist.2
408
+ -o $$(XZ_FRAMEWORK-$1 ) /libxz.a $$^
436
409
437
410
build/$1/xz/lib/liblzma.a: $$(foreach target,$$(TARGETS-$1 ) ,$$(XZ_DIR-$$(target ) ) /src/liblzma/.libs/liblzma.a)
438
411
mkdir -p build/$1
439
412
xcrun lipo -create -o $$@ $$^
440
413
441
- $1: Python.framework -$1
414
+ $1: Python-$1
442
415
443
- Python.framework -$1: $$(PYTHON_FRAMEWORK-$1 )
416
+ Python-$1: $$(PYTHON_FRAMEWORK-$1 )
444
417
445
- # Build Python.framework
418
+ # Build Python
446
419
$$(PYTHON_FRAMEWORK-$1 ) : build/$1/libpython$(PYTHON_VER ) m.a $$(foreach target,$$(TARGETS-$1 ) ,build/$1/$$(pyconfig.h-$$(target ) ) )
447
420
mkdir -p $$(PYTHON_RESOURCES-$1 ) /include/python$(PYTHON_VER ) m
448
421
449
422
# Copy the headers. The headers are the same for every platform, except for pyconfig.h
450
- cp -f -r $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /dist/include/python$(PYTHON_VER ) m $$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Headers
451
- cp -f $$(filter % .h,$$^ ) $$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Headers
452
- cp -f $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /iOS/include/pyconfig.h $$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Headers
423
+ cp -f -r $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /dist/include/python$(PYTHON_VER ) m $$(PYTHON_FRAMEWORK-$1 ) /Headers
424
+ cp -f $$(filter % .h,$$^ ) $$(PYTHON_FRAMEWORK-$1 ) /Headers
425
+ cp -f $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1 ) ) ) /iOS/include/pyconfig.h $$(PYTHON_FRAMEWORK-$1 ) /Headers
453
426
454
427
# Copy Python.h and pyconfig.h into the resources include directory
455
- cp -f -r $$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Headers/pyconfig*.h $$(PYTHON_RESOURCES-$1 ) /include/python$(PYTHON_VER ) m
456
- cp -f -r $$(PYTHON_FRAMEWORK-$1 ) /Versions/ $( PYTHON_VER ) / Headers/Python.h $$(PYTHON_RESOURCES-$1 ) /include/python$(PYTHON_VER ) m
428
+ cp -f -r $$(PYTHON_FRAMEWORK-$1 ) /Headers/pyconfig*.h $$(PYTHON_RESOURCES-$1 ) /include/python$(PYTHON_VER ) m
429
+ cp -f -r $$(PYTHON_FRAMEWORK-$1 ) /Headers/Python.h $$(PYTHON_RESOURCES-$1 ) /include/python$(PYTHON_VER ) m
457
430
458
431
# Copy the standard library from the simulator build
459
432
ifneq ($(TEST ) ,)
@@ -468,19 +441,8 @@ else
468
441
endif
469
442
470
443
# Copy fat library
471
- cp -f $$(filter % .a,$$^ ) $$(PYTHON_FRAMEWORK-$1 ) /Versions/$(PYTHON_VER ) /Python
472
-
473
- # Create symlinks
474
- ln -fs $(PYTHON_VER ) $$(PYTHON_FRAMEWORK-$1 ) /Versions/Current
475
- ln -fs Versions/Current/Headers $$(PYTHON_FRAMEWORK-$1 )
476
- ln -fs Versions/Current/Resources $$(PYTHON_FRAMEWORK-$1 )
477
- ln -fs Versions/Current/Python $$(PYTHON_FRAMEWORK-$1 )
478
-
479
- # Create plist file
480
- sed -e "s/xxxNAMExxx/Python/g" $(PROJECT_DIR ) /patch/Info.plist.tmpl > $$(PYTHON_RESOURCES-$1 ) /Info.plist.1
481
- sed -e "s/xxxBUNDLExxx/org.python/g" $$(PYTHON_RESOURCES-$1 ) /Info.plist.1 > $$(PYTHON_RESOURCES-$1 ) /Info.plist.2
482
- sed -e "s/xxxVERSIONxxx/$$(PYTHON_VERSION ) /g" $$(PYTHON_RESOURCES-$1 ) /Info.plist.2 > $$(PYTHON_RESOURCES-$1 ) /Info.plist
483
- rm $$(PYTHON_RESOURCES-$1 ) /Info.plist.1 $$(PYTHON_RESOURCES-$1 ) /Info.plist.2
444
+ cp -f $$(filter % .a,$$^ ) $$(PYTHON_FRAMEWORK-$1 ) /libPython.a
445
+
484
446
485
447
# Build libpython fat library
486
448
build/$1/libpython$(PYTHON_VER ) m.a: $$(foreach target,$$(TARGETS-$1 ) ,$$(PYTHON_DIR-$$(target ) ) /dist/lib/libpython$(PYTHON_VER ) m.a)
0 commit comments