diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..59a9212d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# Contributing + +PyBee <3's contributions! + +Please be aware, PyBee operates under a Code of Conduct. + +See [CONTRIBUTING to PyBee](https://pybee.org/contributing) for details. + diff --git a/LICENSE b/LICENSE index 1b9b59f1..8c4e7efb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,29 +1,4 @@ -Copyright (c) 2014 Russell Keith-Magee. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -=========================================================================== - -Portions of the build tools are derived from code provided as part -of Kivy-iOS. The copyright for Kivy-iOS is: - -Copyright (c) 2010-2013 Kivy Team and other contributors +Copyright (c) 2014-2017 Russell Keith-Magee. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile deleted file mode 100644 index c57cc556..00000000 --- a/Makefile +++ /dev/null @@ -1,317 +0,0 @@ -PROJECTDIR=$(shell pwd) - -# iOS Build variables. -OSX_SDK_ROOT=$(shell xcrun --sdk macosx --show-sdk-path) - -BUILD_NUMBER=4 - -# Version of packages that will be compiled by this meta-package -FFI_VERSION=3.1 -PYTHON_VERSION=3.4.2 -RUBICON_VERSION=0.1.2 - -# IPHONE build commands and flags -IPHONE_ARMV7_SDK_ROOT=$(shell xcrun --sdk iphoneos --show-sdk-path) -IPHONE_ARMV7_CC=$(shell xcrun -find -sdk iphoneos clang) -IPHONE_ARMV7_LD=$(shell xcrun -find -sdk iphoneos ld) -IPHONE_ARMV7_CFLAGS=-arch armv7 -pipe -no-cpp-precomp -isysroot $(IPHONE_ARMV7_SDK_ROOT) -miphoneos-version-min=6.0 -IPHONE_ARMV7_LDFLAGS=-arch armv7 -isysroot $(IPHONE_ARMV7_SDK_ROOT) -miphoneos-version-min=6.0 - -# IPHONE build commands and flags -IPHONE_ARMV7S_SDK_ROOT=$(shell xcrun --sdk iphoneos --show-sdk-path) -IPHONE_ARMV7S_CC=$(shell xcrun -find -sdk iphoneos clang) -IPHONE_ARMV7S_LD=$(shell xcrun -find -sdk iphoneos ld) -IPHONE_ARMV7S_CFLAGS=-arch armv7s -pipe -no-cpp-precomp -isysroot $(IPHONE_ARMV7S_SDK_ROOT) -miphoneos-version-min=6.0 -IPHONE_ARMV7S_LDFLAGS=-arch armv7s -isysroot $(IPHONE_ARMV7S_SDK_ROOT) -miphoneos-version-min=6.0 - -# IPHONE_SIMULATOR build commands and flags -IPHONE_SIMULATOR_SDK_ROOT=$(shell xcrun --sdk iphonesimulator --show-sdk-path) -IPHONE_SIMULATOR_CC=$(shell xcrun -find -sdk iphonesimulator clang) -IPHONE_SIMULATOR_LD=$(shell xcrun -find -sdk iphonesimulator ld) -IPHONE_SIMULATOR_CFLAGS=-arch i386 -pipe -no-cpp-precomp -isysroot $(IPHONE_SIMULATOR_SDK_ROOT) -miphoneos-version-min=6.0 -IPHONE_SIMULATOR_LDFLAGS=-arch i386 -isysroot $(IPHONE_SIMULATOR_SDK_ROOT) -miphoneos-version-min=6.0 - - -all: Python-$(PYTHON_VERSION)-iOS-support.b$(BUILD_NUMBER).tar.gz - -# Clean all builds -clean: - rm -rf build dist Python-$(PYTHON_VERSION)-iOS-support.b$(BUILD_NUMBER).tar.gz - -# Full clean - includes all downloaded products -distclean: clean - rm -rf downloads - -########################################################################### -# Working directories -########################################################################### - -downloads: - mkdir -p downloads - -build: - mkdir -p build - -dist: - mkdir -p dist - -########################################################################### -# libFFI -########################################################################### - -# Clean the libffi project -clean-ffi: - rm -rf build/libffi-$(FFI_VERSION) - rm -rf dist/ffi.framework - -# Down original libffi source code archive. -downloads/libffi-$(FFI_VERSION).tar.gz: downloads - curl -L ftp://sourceware.org/pub/libffi/libffi-$(FFI_VERSION).tar.gz > downloads/libffi-$(FFI_VERSION).tar.gz - -# Unpack libffi source archive into build working directory -build/libffi-$(FFI_VERSION): build downloads/libffi-$(FFI_VERSION).tar.gz - tar zxf downloads/libffi-$(FFI_VERSION).tar.gz - mv libffi-$(FFI_VERSION) build - -# Patch and build the framework -dist/ffi.framework/ffi: dist build/libffi-$(FFI_VERSION) - # Patch the libFFI sources - cd build/libffi-$(FFI_VERSION) && patch -p1 -N < ../../patch/libffi/generate-darwin-source-and-headers.py.patch - # Generate headers for iOS platforms - cd build/libffi-$(FFI_VERSION) && python generate-darwin-source-and-headers.py --only-ios - # Build all required targets. - cd build/libffi-$(FFI_VERSION)/build_iphoneos-armv7 && make - cd build/libffi-$(FFI_VERSION)/build_iphoneos-arm64 && make - cd build/libffi-$(FFI_VERSION)/build_iphonesimulator-i386 && make - # Copy the headers into a single directory - mkdir -p dist/ffi.framework/Versions/${FFI_VERSION}/Headers - cp build/libffi-$(FFI_VERSION)/darwin_common/include/* dist/ffi.framework/Versions/${FFI_VERSION}/Headers - cp build/libffi-$(FFI_VERSION)/darwin_ios/include/* dist/ffi.framework/Versions/${FFI_VERSION}/Headers - # Make the fat binary - xcrun lipo -create -output dist/ffi.framework/Versions/$(FFI_VERSION)/ffi build/libffi-$(FFI_VERSION)/build_iphoneos-arm64/.libs/libffi.a build/libffi-$(FFI_VERSION)/build_iphoneos-armv7/.libs/libffi.a build/libffi-$(FFI_VERSION)/build_iphonesimulator-i386/.libs/libffi.a - # Link the Current, Headers and binary. - cd dist/ffi.framework/Versions && ln -sf ${FFI_VERSION} Current - cd dist/ffi.framework && ln -sf Versions/Current/Headers - cd dist/ffi.framework && ln -sf Versions/Current/ffi - -########################################################################### -# rubicon-objc -########################################################################### - -# Clean the libffi project -clean-rubicon-objc: - rm -rf build/rubicon-objc-$(RUBICON_VERSION) - -# Down original librubicon-objc source code archive. -downloads/rubicon-objc-$(RUBICON_VERSION).tar.gz: downloads - curl -L https://github.com/pybee/rubicon-objc/archive/v$(RUBICON_VERSION).tar.gz > downloads/rubicon-objc-$(RUBICON_VERSION).tar.gz - -# Unpack rubicon-objc source archive into build working directory -build/rubicon-objc-$(RUBICON_VERSION): downloads/rubicon-objc-$(RUBICON_VERSION).tar.gz - tar zxf downloads/rubicon-objc-$(RUBICON_VERSION).tar.gz - mv rubicon-objc-$(RUBICON_VERSION) build - -########################################################################### -# Python -########################################################################### - -# Clean the Python project -clean-Python: - rm -rf build/Python-$(PYTHON_VERSION) - rm -rf dist/Python.framework - rm -rf dist/python - -# Down original Python source code archive. -downloads/Python-$(PYTHON_VERSION).tgz: downloads - curl -L https://www.python.org/ftp/python/$(PYTHON_VERSION)/Python-$(PYTHON_VERSION).tgz > downloads/Python-$(PYTHON_VERSION).tgz - -build/Python-$(PYTHON_VERSION)/host/python.exe: build downloads/Python-$(PYTHON_VERSION).tgz - # Unpack sources - tar zxf downloads/Python-$(PYTHON_VERSION).tgz - mkdir -p build/Python-$(PYTHON_VERSION) - mv Python-$(PYTHON_VERSION) build/Python-$(PYTHON_VERSION)/host - # Apply patches - cp patch/Python/ModulesSetup build/Python-$(PYTHON_VERSION)/host/Modules/Setup.local - cp patch/Python/_scproxy.py build/Python-$(PYTHON_VERSION)/host/Lib/_scproxy.py - cd build/Python-$(PYTHON_VERSION)/host && patch -p1 -N < ../../../patch/Python/dynload.patch - cd build/Python-$(PYTHON_VERSION)/host && patch -p1 -N < ../../../patch/Python/ssize-t-max.patch - cd build/Python-$(PYTHON_VERSION)/host && patch -p1 -N < ../../../patch/Python/static-_sqlite3.patch - # Configure and make the local build, providing compiled resources. - cd build/Python-$(PYTHON_VERSION)/host && ./configure CC="clang -Qunused-arguments -fcolor-diagnostics" LDFLAGS="-lsqlite3" CFLAGS="--sysroot=$(OSX_SDK_ROOT)" --prefix=$(PROJECTDIR)/build/Python-$(PYTHON_VERSION)/host/build - cd build/Python-$(PYTHON_VERSION)/host && make - -build/python/ios-simulator/Python: build build/Python-$(PYTHON_VERSION)/host/python.exe - # Unpack sources - tar zxf downloads/Python-$(PYTHON_VERSION).tgz - mkdir -p build/Python-$(PYTHON_VERSION) - mv Python-$(PYTHON_VERSION) build/Python-$(PYTHON_VERSION)/ios-simulator - # Apply patches - cp patch/Python/ModulesSetup build/Python-$(PYTHON_VERSION)/ios-simulator/Modules/Setup.local - cat patch/Python/ModulesSetup.mobile >> build/Python-$(PYTHON_VERSION)/ios-simulator/Modules/Setup.local - cp patch/Python/_scproxy.py build/Python-$(PYTHON_VERSION)/ios-simulator/Lib/_scproxy.py - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 -N < ../../../patch/Python/dynload.patch - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 -N < ../../../patch/Python/ssize-t-max.patch - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 -N < ../../../patch/Python/static-_sqlite3.patch - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 < ../../../patch/Python/xcompile.patch - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 < ../../../patch/Python/setuppath.patch - # Configure and build Simulator library - cd build/Python-$(PYTHON_VERSION)/ios-simulator && ./configure CC="$(IPHONE_SIMULATOR_CC)" LD="$(IPHONE_SIMULATOR_LD)" CFLAGS="$(IPHONE_SIMULATOR_CFLAGS) -I../../../dist/ffi.framework/Headers" LDFLAGS="$(IPHONE_SIMULATOR_LDFLAGS) -L../../../dist/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --prefix=$(PROJECTDIR)/build/python/ios-simulator --without-doc-strings - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 < ../../../patch/Python/ctypes_duplicate.patch - cd build/Python-$(PYTHON_VERSION)/ios-simulator && patch -p1 < ../../../patch/Python/pyconfig.patch - mkdir -p build/python/ios-simulator - cd build/Python-$(PYTHON_VERSION)/ios-simulator && cp ../host/python.exe hostpython - cd build/Python-$(PYTHON_VERSION)/ios-simulator && make altbininstall libinstall inclinstall libainstall HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes - # Relocate and rename the libpython binary - cd build/python/ios-simulator/lib && mv libpython$(basename $(PYTHON_VERSION)).a ../Python - # Clean up build directory - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm - cd build/python/ios-simulator/lib && rm -rf pkgconfig - # Pack libraries into .zip file - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv config .. - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages .. - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip * - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && rm -rf * - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv ../config . - cd build/python/ios-simulator/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages . - # Move all headers except for pyconfig.h into a Headers directory - mkdir -p build/python/ios-simulator/Headers - cd build/python/ios-simulator/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* . - cd build/python/ios-simulator/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION)) - - -build/python/ios-armv7/Python: build build/Python-$(PYTHON_VERSION)/host/python.exe - # Unpack sources - tar zxf downloads/Python-$(PYTHON_VERSION).tgz - mkdir -p build/Python-$(PYTHON_VERSION) - mv Python-$(PYTHON_VERSION) build/Python-$(PYTHON_VERSION)/ios-armv7 - # Apply extra patches for iPhone build - cp patch/Python/ModulesSetup build/Python-$(PYTHON_VERSION)/ios-armv7/Modules/Setup.local - cat patch/Python/ModulesSetup.mobile >> build/Python-$(PYTHON_VERSION)/ios-armv7/Modules/Setup.local - cp patch/Python/_scproxy.py build/Python-$(PYTHON_VERSION)/ios-armv7/Lib/_scproxy.py - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 -N < ../../../patch/Python/dynload.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 -N < ../../../patch/Python/ssize-t-max.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 -N < ../../../patch/Python/static-_sqlite3.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 < ../../../patch/Python/xcompile.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 < ../../../patch/Python/setuppath.patch - # Configure and build iPhone library - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && ./configure CC="$(IPHONE_ARMV7_CC)" LD="$(IPHONE_ARMV7_LD)" CFLAGS="$(IPHONE_ARMV7_CFLAGS) -I../../../dist/ffi.framework/Headers" LDFLAGS="$(IPHONE_ARMV7_LDFLAGS) -L../../../dist/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --host=armv7-apple-darwin --prefix=$(PROJECTDIR)/build/python/ios-armv7 --without-doc-strings - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 < ../../../patch/Python/ctypes_duplicate.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && patch -p1 < ../../../patch/Python/pyconfig.patch - mkdir -p build/python/ios-armv7 - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && cp ../host/python.exe hostpython - cd build/Python-$(PYTHON_VERSION)/ios-armv7 && make altbininstall libinstall inclinstall libainstall HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes - # Relocate and rename the libpython binary - cd build/python/ios-armv7/lib && mv libpython$(basename $(PYTHON_VERSION)).a ../Python - # Clean up build directory - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm - cd build/python/ios-armv7/lib && rm -rf pkgconfig - # Pack libraries into .zip file - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv config .. - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages .. - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip * - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && rm -rf * - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv ../config . - cd build/python/ios-armv7/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages . - # Move all headers except for pyconfig.h into a Headers directory - mkdir -p build/python/ios-armv7/Headers - cd build/python/ios-armv7/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* . - cd build/python/ios-armv7/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION)) - - -build/python/ios-armv7s/Python: build build/Python-$(PYTHON_VERSION)/host/python.exe - # Unpack sources - tar zxf downloads/Python-$(PYTHON_VERSION).tgz - mkdir -p build/Python-$(PYTHON_VERSION) - mv Python-$(PYTHON_VERSION) build/Python-$(PYTHON_VERSION)/ios-armv7s - # Apply extra patches for iPhone build - cp patch/Python/ModulesSetup build/Python-$(PYTHON_VERSION)/ios-armv7s/Modules/Setup.local - cat patch/Python/ModulesSetup.mobile >> build/Python-$(PYTHON_VERSION)/ios-armv7s/Modules/Setup.local - cp patch/Python/_scproxy.py build/Python-$(PYTHON_VERSION)/ios-armv7s/Lib/_scproxy.py - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 -N < ../../../patch/Python/dynload.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 -N < ../../../patch/Python/ssize-t-max.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 -N < ../../../patch/Python/static-_sqlite3.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 < ../../../patch/Python/xcompile.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 < ../../../patch/Python/setuppath.patch - # Configure and build iPhone library - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && ./configure CC="$(IPHONE_ARMV7_CC)" LD="$(IPHONE_ARMV7S_LD)" CFLAGS="$(IPHONE_ARMV7S_CFLAGS) -I../../../dist/ffi.framework/Headers" LDFLAGS="$(IPHONE_ARMV7S_LDFLAGS) -L../../../dist/ffi.framework/ -lsqlite3 -undefined dynamic_lookup" --without-pymalloc --disable-toolbox-glue --host=armv7s-apple-darwin --prefix=$(PROJECTDIR)/build/python/ios-armv7s --without-doc-strings - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 < ../../../patch/Python/ctypes_duplicate.patch - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && patch -p1 < ../../../patch/Python/pyconfig.patch - mkdir -p build/python/ios-armv7s - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && cp ../host/python.exe hostpython - cd build/Python-$(PYTHON_VERSION)/ios-armv7s && make altbininstall libinstall inclinstall libainstall HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes - # Relocate and rename the libpython binary - cd build/python/ios-armv7s/lib && mv libpython$(basename $(PYTHON_VERSION)).a ../Python - # Clean up build directory - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm config/libpython$(basename $(PYTHON_VERSION)).a config/python.o config/config.c.in config/makesetup - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm -rf *test* lib* wsgiref bsddb curses idlelib hotshot - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.pyc' | xargs rm - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && find . -iname '*.py' | xargs rm - cd build/python/ios-armv7s/lib && rm -rf pkgconfig - # Pack libraries into .zip file - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv config .. - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv site-packages .. - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && zip -r ../python27.zip * - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && rm -rf * - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv ../config . - cd build/python/ios-armv7s/lib/python$(basename $(PYTHON_VERSION)) && mv ../site-packages . - # Move all headers except for pyconfig.h into a Headers directory - mkdir -p build/python/ios-armv7s/Headers - cd build/python/ios-armv7s/Headers && mv ../include/python$(basename $(PYTHON_VERSION))/* . - cd build/python/ios-armv7s/Headers && mv pyconfig.h ../include/python$(basename $(PYTHON_VERSION)) - - -dist/Python.framework/Python: build/python/ios-simulator/Python build/python/ios-armv7/Python build/python/ios-armv7s/Python build/rubicon-objc-$(RUBICON_VERSION) - # Create the framework directory from the compiled resrouces - mkdir -p dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/ - cd dist/Python.framework/Versions && ln -fs $(basename $(PYTHON_VERSION)) Current - # Copy the headers from the simulator build - cp -r build/python/ios-simulator/Headers dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Headers - cd dist/Python.framework && ln -fs Versions/Current/Headers - # Copy the standard library from the simulator build - mkdir -p dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources - cp -r build/python/ios-simulator/lib dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources - cd dist/Python.framework && ln -fs Versions/Current/Resources - # Copy the pyconfig headers from the builds, and install the fat header. - mkdir -p dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python$(basename $(PYTHON_VERSION)) - cp build/python/ios-simulator/include/python$(basename $(PYTHON_VERSION))/pyconfig.h dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python$(basename $(PYTHON_VERSION))/pyconfig-simulator.h - cp build/python/ios-armv7/include/python$(basename $(PYTHON_VERSION))/pyconfig.h dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python$(basename $(PYTHON_VERSION))/pyconfig-armv7.h - cp patch/Python/pyconfig.h dist/Python.framework/Versions/$(basename $(PYTHON_VERSION))/Resources/include/python$(basename $(PYTHON_VERSION))/ - # Install Rubicon into site packages. - cd build && cp -r rubicon-objc-$(RUBICON_VERSION)/rubicon ../dist/Python.framework/Resources/lib/python$(basename $(PYTHON_VERSION))/site-packages/ - # Build a fat library with all targets included. - xcrun lipo -create -output dist/Python.framework/Versions/Current/Python build/python/ios-simulator/Python build/python/ios-armv7/Python build/python/ios-armv7s/Python - cd dist/Python.framework && ln -fs Versions/Current/Python - - -Python-$(PYTHON_VERSION)-iOS-support.b$(BUILD_NUMBER).tar.gz: dist/ffi.framework/ffi dist/Python.framework/Python - cd dist && tar zcvf ../Python-$(PYTHON_VERSION)-iOS-support.b$(BUILD_NUMBER).tar.gz ffi.framework Python.framework - - -env: - # PYTHON_VERSION $(PYTHON_VERSION) - # FFI_VERSION $(FFI_VERSION) - # OSX_SDK_ROOT $(OSX_SDK_ROOT) - - # IPHONE_ARMV7_SDK_ROOT $(IPHONE_ARMV7_SDK_ROOT) - # IPHONE_ARMV7_CC $(IPHONE_ARMV7_CC) - # IPHONE_ARMV7_LD $(IPHONE_ARMV7_LD) - # IPHONE_ARMV7_CFLAGS $(IPHONE_ARMV7_CFLAGS) - # IPHONE_ARMV7_LDFLAGS $(IPHONE_ARMV7_LDFLAGS) - - # IPHONE_ARMV7S_SDK_ROOT $(IPHONE_ARMV7S_SDK_ROOT) - # IPHONE_ARMV7S_CC $(IPHONE_ARMV7S_CC) - # IPHONE_ARMV7S_LD $(IPHONE_ARMV7S_LD) - # IPHONE_ARMV7S_CFLAGS $(IPHONE_ARMV7S_CFLAGS) - # IPHONE_ARMV7S_LDFLAGS $(IPHONE_ARMV7S_LDFLAGS) - - # IPHONE_SIMULATOR_SDK_ROOT $(IPHONE_SIMULATOR_SDK_ROOT) - # IPHONE_SIMULATOR_CC $(IPHONE_SIMULATOR_CC) - # IPHONE_SIMULATOR_LD $(IPHONE_SIMULATOR_LD) - # IPHONE_SIMULATOR_CFLAGS $(IPHONE_SIMULATOR_CFLAGS) - # IPHONE_SIMULATOR_LDFLAGS $(IPHONE_SIMULATOR_LDFLAGS) diff --git a/README.rst b/README.rst index 1c3d321f..be13da0d 100644 --- a/README.rst +++ b/README.rst @@ -1,72 +1,46 @@ -Python iOS Support -================== +Python Apple Support +==================== This is a meta-package for building a version of Python that can be embedded -into an iOS project. - -It works by downloading, patching, and building a fat binary static libffi.a -and libPython.a, and packaging them both in iOS Framework format. - -The ``site-packages`` has the `Rubicon Objective-C`_ library pre-installed. -This library enables you to have direct access to the iOS system libraries -from within the Python environment. - -The binaries support the ``$(ARCHS_STANDARD_32_BIT)`` set - that is, armv7 and -armv7s. This should enable the code to run on: - -* iPhone - - iPhone 3GS, - - iPhone 4 - - iPhone 4s - - iPhone 5 - - iPhone 5s -* iPad - - iPad 2 - - iPad (3rd gen) - - iPad (4th gen) - - iPad Air -* iPad Mini - - iPad Mini (1st gen) - - iPad Mini (2nd gen) -* iPod Touch - - iPod Touch (4th gen) - - iPod Touch (5th gen) - -This repository branch builds a packaged version of **Python 3.4.2**. -Other Python versions are available by cloning other branches of the main -repository. - -Quickstart ----------- - -Pre-built versions of the frameworks can be downloaded_, and added to -your iOS project. - -Alternatively, to build the frameworks on your own, download/clone this -repository, and then in the root directory, and run: - - $ make - -This should: - -1. Download the original source packages -2. Patch them as required for iOS compatibility -3. Build the packages as iOS frameworks. - -The build products will be in the `build` directory. You'll need to add -**all** these frameworks (not just Python.framework) to your project. - -.. _downloaded: https://github.com/pybee/Python-iOS-support/releases/download/3.4.2-b1/Python-3.4.2-iOS-support.b1.tar.gz - -Acknowledgements ----------------- - -This work draws on the groundwork provided by `Kivy's iOS packaging tools.`_ - -The approach to framework packaging is drawn from `Jeff Verkoeyen`_, and -`Ernesto García's`_ tutorials. - -.. _Kivy's iOS packaging tools.: https://github.com/kivy/kivy-ios -.. _Jeff Verkoeyen: https://github.com/jverkoey/iOS-Framework -.. _Ernesto García's: http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial -.. _Rubicon Objective-C: http://github.com/pybee/rubicon-objc +into a macOS, iOS, tvOS or watchOS project. + +It works by downloading, patching, and building a fat binary of Python and +selected pre-requisites, and packaging them as static libraries that can be +included in an Xcode project. + +The binaries support x86_64 for macOS; arm64 for iOS and appleTV devices; +and armv7k for watchOS. This should enable the code to run on: + +* MacBook +* iMac +* Mac Pro +* iPhone (5s or later) +* iPad (5th gen or later) +* iPad Air (all models) +* iPad Mini (2 or later) +* iPad Pro (all models) +* iPod Touch (6th gen or later) +* Apple TV (4th gen or later) +* Apple Watch + +The master branch of this repository has no content; there is an +independent branch for each supported version of Python. The following +Python versions are supported: + +* `Python 3.5 `__ +* `Python 3.6 `__ +* `Python 3.7 `__ +* `Python 3.8 `__ + +Suggestions for changes should be made against the `dev branch +`__; these +will then be backported into the supported Python releases. The dev branch will +track the most recent supported version of Python (currently, Python 3.8). + +See the individual branches for usage instructions. + +The following versions were supported in the past, but are no longer +maintained: + +* `Python 2.7 `__ (EOL January 2020) +* `Python 3.4 `__ (EOL March 2019) diff --git a/patch/Python/ModulesSetup b/patch/Python/ModulesSetup deleted file mode 100644 index 3938a1ea..00000000 --- a/patch/Python/ModulesSetup +++ /dev/null @@ -1,49 +0,0 @@ -posix posixmodule.c # posix (UNIX) system calls -errno errnomodule.c # posix (UNIX) errno values -pwd pwdmodule.c # this is needed to find out the user's home dir - # if $HOME is not set -_sre _sre.c # Fredrik Lundh's new regular expressions -_codecs _codecsmodule.c # access to the builtin codecs and codec registry -zipimport zipimport.c -_symtable symtablemodule.c -array arraymodule.c # array objects -cmath cmathmodule.c # -lm # complex math library functions -math mathmodule.c # -lm # math library functions, e.g. sin() -_struct _struct.c # binary structure packing/unpacking -time timemodule.c # -lm # time operations and variables -operator operator.c # operator.add() and similar goodies -_weakref _weakref.c # basic weak reference support -_random _randommodule.c # Random number generator -_collections _collectionsmodule.c # Container types -itertools itertoolsmodule.c # Functions creating iterators for efficient looping -strop stropmodule.c # String manipulations -_functools _functoolsmodule.c # Tools for working with functions and callable objects -_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator -datetime datetimemodule.c # date/time type -_bisect _bisectmodule.c # Bisection algorithms -fcntl fcntlmodule.c # fcntl(2) and ioctl(2) -select selectmodule.c # select(2); not on ancient System V -_socket socketmodule.c -_md5 md5module.c md5.c -_sha shamodule.c -_sha256 sha256module.c -_sha512 sha512module.c -binascii binascii.c -parser parsermodule.c -cStringIO cStringIO.c -cPickle cPickle.c -zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz -xxsubtype xxsubtype.c -unicodedata unicodedata.c # static Unicode character database - -# Theses modules are used by Kivy inside other module -# json in Settings, _io by zipfile... -_json _json.c -_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c -_heapq _heapqmodule.c - -# Special inclusion for sqlite3 -_sqlite3 -DSQLITE_OMIT_LOAD_EXTENSION _sqlite/cache.c _sqlite/microprotocols.c _sqlite/row.c _sqlite/connection.c _sqlite/module.c _sqlite/statement.c _sqlite/cursor.c _sqlite/prepare_protocol.c _sqlite/util.c - -# Include expat -pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI diff --git a/patch/Python/ModulesSetup.mobile b/patch/Python/ModulesSetup.mobile deleted file mode 100644 index 826bf1c0..00000000 --- a/patch/Python/ModulesSetup.mobile +++ /dev/null @@ -1,2 +0,0 @@ -# Ctypes -_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -I$(srcdir)/../../build/include/ffi diff --git a/patch/Python/_scproxy.py b/patch/Python/_scproxy.py deleted file mode 100644 index 24239409..00000000 --- a/patch/Python/_scproxy.py +++ /dev/null @@ -1,10 +0,0 @@ -''' -Stub functions for _scproxy on iOS -No proxy is supported yet. -''' - -def _get_proxy_settings(): - return {'exclude_simple': 1} - -def _get_proxies(): - return {} diff --git a/patch/Python/ctypes_duplicate.patch b/patch/Python/ctypes_duplicate.patch deleted file mode 100644 index be44824a..00000000 --- a/patch/Python/ctypes_duplicate.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- Python-2.7-old/Modules/_ctypes/cfield.c 2010-05-09 22:46:46.000000000 +0800 -+++ Python-2.7-new/Modules/_ctypes/cfield.c 2014-04-27 16:06:06.000000000 +0800 -@@ -1747,31 +1747,4 @@ - } ffi_type; - */ - --/* align and size are bogus for void, but they must not be zero */ --ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; -- --ffi_type ffi_type_uint8 = { 1, 1, FFI_TYPE_UINT8 }; --ffi_type ffi_type_sint8 = { 1, 1, FFI_TYPE_SINT8 }; -- --ffi_type ffi_type_uint16 = { 2, 2, FFI_TYPE_UINT16 }; --ffi_type ffi_type_sint16 = { 2, 2, FFI_TYPE_SINT16 }; -- --ffi_type ffi_type_uint32 = { 4, 4, FFI_TYPE_UINT32 }; --ffi_type ffi_type_sint32 = { 4, 4, FFI_TYPE_SINT32 }; -- --ffi_type ffi_type_uint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_UINT64 }; --ffi_type ffi_type_sint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_SINT64 }; -- --ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT }; --ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE }; -- --#ifdef ffi_type_longdouble --#undef ffi_type_longdouble --#endif -- /* This is already defined on OSX */ --ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, -- FFI_TYPE_LONGDOUBLE }; -- --ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; -- - /*---------------- EOF ----------------*/ diff --git a/patch/Python/dynload.patch b/patch/Python/dynload.patch deleted file mode 100644 index 7cb73f60..00000000 --- a/patch/Python/dynload.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Python-2.7.1/Python/dynload_shlib.c.orig 2011-12-05 00:00:00.000000000 +0100 -+++ Python-2.7.1/Python/dynload_shlib.c 2011-12-05 00:02:51.000000000 +0100 -@@ -84,6 +84,15 @@ - PyOS_snprintf(funcname, sizeof(funcname), - LEAD_UNDERSCORE "init%.200s", shortname); - -+ /* On IOS, dlopen crash as soon as we try to open one of our library. -+ * Instead, we have done a redirection of linking to convert our .so into a -+ * .a. Then the main executable is linked with theses symbol. So, instead -+ * of trying to dlopen, directly do the dlsym. -+ * -- Mathieu -+ */ -+ return (dl_funcptr) dlsym(RTLD_MAIN_ONLY, funcname); -+ -+#if 0 - if (fp != NULL) { - int i; - struct stat statb; -@@ -140,4 +149,5 @@ - handles[nhandles++].handle = handle; - p = (dl_funcptr) dlsym(handle, funcname); - return p; -+#endif - } diff --git a/patch/Python/environ_symbol_fix.patch b/patch/Python/environ_symbol_fix.patch deleted file mode 100644 index 2de5ac80..00000000 --- a/patch/Python/environ_symbol_fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: Modules/posixmodule.c -=================================================================== ---- Modules/posixmodule.c (revision 52827) -+++ Modules/posixmodule.c (working copy) -@@ -314,7 +314,7 @@ - #endif - - /* Return a dictionary corresponding to the POSIX environment table */ --#ifdef WITH_NEXT_FRAMEWORK -+#ifdef __APPLE__ - /* On Darwin/MacOSX a shared library or framework has no access to - ** environ directly, we must obtain it with _NSGetEnviron(). - */ -@@ -332,7 +332,7 @@ - d = PyDict_New(); - if (d == NULL) - return NULL; --#ifdef WITH_NEXT_FRAMEWORK -+#ifdef __APPLE__ - if (environ == NULL) - environ = *_NSGetEnviron(); - #endif - - diff --git a/patch/Python/pyconfig.h b/patch/Python/pyconfig.h deleted file mode 100644 index bb9890f4..00000000 --- a/patch/Python/pyconfig.h +++ /dev/null @@ -1,5 +0,0 @@ -#if TARGET_IPHONE_SIMULATOR -#include "pyconfig-simulator.h" -#else -#include "pyconfig-armv7.h" -#endif \ No newline at end of file diff --git a/patch/Python/pyconfig.patch b/patch/Python/pyconfig.patch deleted file mode 100644 index a7fe3420..00000000 --- a/patch/Python/pyconfig.patch +++ /dev/null @@ -1,159 +0,0 @@ ---- Python2.7-old/pyconfig.h 2013-08-26 19:26:05.000000000 +0200 -+++ Python2.7-new/pyconfig.h 2013-08-27 00:11:06.000000000 +0200 -@@ -72,7 +72,7 @@ - /* #undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE */ - - /* Define to 1 if you have the `bind_textdomain_codeset' function. */ --#define HAVE_BIND_TEXTDOMAIN_CODESET 1 -+/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */ - - /* Define to 1 if you have the header file. */ - /* #undef HAVE_BLUETOOTH_BLUETOOTH_H */ -@@ -218,7 +218,7 @@ - /* #undef HAVE_FDATASYNC */ - - /* Define to 1 if you have the `finite' function. */ --#define HAVE_FINITE 1 -+/* #undef HAVE_FINITE */ - - /* Define to 1 if you have the `flock' function. */ - #define HAVE_FLOCK 1 -@@ -233,7 +233,7 @@ - #define HAVE_FPATHCONF 1 - - /* Define to 1 if you have the `fseek64' function. */ --#define HAVE_FSEEK64 1 -+/* #undef HAVE_FSEEK64 */ - - /* Define to 1 if you have the `fseeko' function. */ - #define HAVE_FSEEKO 1 -@@ -245,7 +245,7 @@ - #define HAVE_FSYNC 1 - - /* Define to 1 if you have the `ftell64' function. */ --#define HAVE_FTELL64 1 -+/* #undef HAVE_FTELL64 */ - - /* Define to 1 if you have the `ftello' function. */ - #define HAVE_FTELLO 1 -@@ -260,7 +260,7 @@ - #define HAVE_GAI_STRERROR 1 - - /* Define to 1 if you have the `gamma' function. */ --#define HAVE_GAMMA 1 -+/* #undef HAVE_GAMMA */ - - /* Define if we can use gcc inline assembler to get and set x87 control word - */ -@@ -279,10 +279,10 @@ - #define HAVE_GETGROUPS 1 - - /* Define to 1 if you have the `gethostbyname' function. */ --/* #undef HAVE_GETHOSTBYNAME */ -+#define HAVE_GETHOSTBYNAME 1 - - /* Define this if you have some version of gethostbyname_r() */ --#define HAVE_GETHOSTBYNAME_R 1 -+/* #undef HAVE_GETHOSTBYNAME_R */ - - /* Define this if you have the 3-arg version of gethostbyname_r(). */ - /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ -@@ -291,7 +291,7 @@ - /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ - - /* Define this if you have the 6-arg version of gethostbyname_r(). */ --#define HAVE_GETHOSTBYNAME_R_6_ARG 1 -+/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */ - - /* Define to 1 if you have the `getitimer' function. */ - #define HAVE_GETITIMER 1 -@@ -327,19 +327,19 @@ - #define HAVE_GETPWENT 1 - - /* Define to 1 if you have the `getresgid' function. */ --#define HAVE_GETRESGID 1 -+/* #undef HAVE_GETRESGID */ - - /* Define to 1 if you have the `getresuid' function. */ --#define HAVE_GETRESUID 1 -+/* #undef HAVE_GETRESUID */ - - /* Define to 1 if you have the `getsid' function. */ - #define HAVE_GETSID 1 - - /* Define to 1 if you have the `getspent' function. */ --#define HAVE_GETSPENT 1 -+/* #undef HAVE_GETSPENT */ - - /* Define to 1 if you have the `getspnam' function. */ --#define HAVE_GETSPNAM 1 -+/* #undef HAVE_GETSPNAM */ - - /* Define to 1 if you have the `gettimeofday' function. */ - #define HAVE_GETTIMEOFDAY 1 -@@ -465,7 +465,7 @@ - #define HAVE_MKTIME 1 - - /* Define to 1 if you have the `mremap' function. */ --#define HAVE_MREMAP 1 -+/* #undef HAVE_MREMAP */ - - /* Define to 1 if you have the header file. */ - /* #undef HAVE_NCURSES_H */ -@@ -492,7 +492,7 @@ - #define HAVE_PAUSE 1 - - /* Define to 1 if you have the `plock' function. */ --#define HAVE_PLOCK 1 -+/* #undef HAVE_PLOCK */ - - /* Define to 1 if you have the `poll' function. */ - #define HAVE_POLL 1 -@@ -567,7 +567,7 @@ - #define HAVE_SEM_OPEN 1 - - /* Define to 1 if you have the `sem_timedwait' function. */ --#define HAVE_SEM_TIMEDWAIT 1 -+/* #undef HAVE_SEM_TIMEDWAIT */ - - /* Define to 1 if you have the `sem_unlink' function. */ - #define HAVE_SEM_UNLINK 1 -@@ -600,10 +600,10 @@ - #define HAVE_SETREGID 1 - - /* Define to 1 if you have the `setresgid' function. */ --#define HAVE_SETRESGID 1 -+/* #undef HAVE_SETRESGID */ - - /* Define to 1 if you have the `setresuid' function. */ --#define HAVE_SETRESUID 1 -+/* #undef HAVE_SETRESUID */ - - /* Define to 1 if you have the `setreuid' function. */ - #define HAVE_SETREUID 1 -@@ -829,7 +829,7 @@ - #define HAVE_TMPNAM 1 - - /* Define to 1 if you have the `tmpnam_r' function. */ --#define HAVE_TMPNAM_R 1 -+/* #undef HAVE_TMPNAM_R */ - - /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -@@ -894,7 +894,7 @@ - #define HAVE_ZLIB_COPY 1 - - /* Define to 1 if you have the `_getpty' function. */ --#define HAVE__GETPTY 1 -+/* #undef HAVE__GETPTY */ - - /* Define if you are using Mach cthreads directly under /include */ - /* #undef HURD_C_THREADS */ -@@ -1245,5 +1245,4 @@ - #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ - #endif - --#endif /*Py_PYCONFIG_H*/ -- -+#endif /*Py_PYCONFIG_H*/ -\ No newline at end of file diff --git a/patch/Python/setuppath.patch b/patch/Python/setuppath.patch deleted file mode 100644 index c4d9d19e..00000000 --- a/patch/Python/setuppath.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Python-2.7.1/setup.py.orig 2013-10-25 17:28:03.000000000 +0200 -+++ Python-2.7.1/setup.py 2013-10-25 17:27:56.000000000 +0200 -@@ -87,7 +87,7 @@ - f = os.path.join(sysroot, dir[1:], filename) - - if os.path.exists(f): -- return [dir] -+ return [os.path.dirname(f)] - - # Not found anywhere - return None diff --git a/patch/Python/ssize-t-max.patch b/patch/Python/ssize-t-max.patch deleted file mode 100644 index 3d63b49d..00000000 --- a/patch/Python/ssize-t-max.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -Naur Python-2.7.1.orig/Include/pyport.h Python-2.7.1/Include/pyport.h ---- Python-2.7.1.orig/Include/pyport.h 2010-09-14 18:10:22.000000000 +0200 -+++ Python-2.7.1/Include/pyport.h 2011-05-13 12:24:53.000000000 +0200 -@@ -186,9 +186,11 @@ - #endif - - /* Largest positive value of type Py_ssize_t. */ --#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) -+//#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) - /* Smallest negative value of type Py_ssize_t. */ --#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) -+//#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) -+#define PY_SSIZE_T_MAX TMP_MAX -+#define PY_SSIZE_T_MIN -TMP_MAX - - #if SIZEOF_PID_T > SIZEOF_LONG - # error "Python doesn't support sizeof(pid_t) > sizeof(long)" diff --git a/patch/Python/static-_sqlite3.patch b/patch/Python/static-_sqlite3.patch deleted file mode 100644 index 783c5efb..00000000 --- a/patch/Python/static-_sqlite3.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- Python-2.7.1/Modules/_sqlite/module.c.orig 2012-10-28 02:30:58.000000000 +0200 -+++ Python-2.7.1/Modules/_sqlite/module.c 2012-10-28 02:28:12.000000000 +0200 -@@ -28,6 +28,9 @@ - #include "prepare_protocol.h" - #include "microprotocols.h" - #include "row.h" -+#ifndef MODULE_NAME -+#define MODULE_NAME "_sqlite3" -+#endif - - #if SQLITE_VERSION_NUMBER >= 3003003 - #define HAVE_SHARED_CACHE ---- Python-2.7.1/Modules/_sqlite/sqlitecompat.h.orig 2012-10-28 02:30:53.000000000 +0200 -+++ Python-2.7.1/Modules/_sqlite/sqlitecompat.h 2012-10-28 02:28:14.000000000 +0200 -@@ -26,6 +26,10 @@ - #ifndef PYSQLITE_COMPAT_H - #define PYSQLITE_COMPAT_H - -+#ifndef MODULE_NAME -+#define MODULE_NAME "_sqlite3" -+#endif -+ - /* define Py_ssize_t for pre-2.5 versions of Python */ - - #if PY_VERSION_HEX < 0x02050000 diff --git a/patch/Python/xcompile.patch b/patch/Python/xcompile.patch deleted file mode 100644 index 6f3a08ed..00000000 --- a/patch/Python/xcompile.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff -Naur Python-2.7-old/Makefile.pre.in Python-2.7-new/Makefile.pre.in ---- Python-2.7-old/Makefile.pre.in 2010-04-11 17:10:46.000000000 -0700 -+++ Python-2.7-new/Makefile.pre.in 2010-07-09 13:40:47.000000000 -0700 -@@ -179,6 +179,7 @@ - - PYTHON= python$(EXE) - BUILDPYTHON= python$(BUILDEXE) -+HOSTPYTHON= ./$(BUILDPYTHON) - - # The task to run while instrument when building the profile-opt target - PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -@@ -212,6 +213,8 @@ - # Parser - PGEN= Parser/pgen$(EXE) - -+HOSTPGEN= $(PGEN) -+ - POBJS= \ - Parser/acceler.o \ - Parser/grammar1.o \ -@@ -404,8 +407,8 @@ - # Build the shared modules - sharedmods: $(BUILDPYTHON) - @case $$MAKEFLAGS in \ -- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ -- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ -+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ -+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ - esac - - # Build static library -@@ -538,7 +541,7 @@ - - $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - -@$(INSTALL) -d Include -- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - - $(PGEN): $(PGENOBJS) - $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) -@@ -919,26 +922,26 @@ - done; \ - done - $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" -+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" - - # Create the PLATDIR source directory, if one wasn't distributed.. - $(srcdir)/Lib/$(PLATDIR): -@@ -1042,8 +1045,10 @@ - - # Install the dynamically loadable modules - # This goes into $(exec_prefix) --sharedinstall: sharedmods -- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ -+sharedinstall: sharedmods -+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ -+ --skip-build \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ -diff -Naur Python-2.7-old/setup.py Python-2.7-new/setup.py ---- Python-2.7-old/setup.py 2010-06-27 05:36:16.000000000 -0700 -+++ Python-2.7-new/setup.py 2010-07-09 13:54:29.000000000 -0700 -@@ -23,6 +23,10 @@ - # This global variable is used to hold the list of modules to be disabled. - disabled_module_list = [] - -+# _ctypes fails to cross-compile due to the libffi configure script. -+if os.environ.has_key('PYTHONXCPREFIX'): -+ disabled_module_list.append('_ctypes') -+ - def add_dir_to_list(dirlist, dir): - """Add the directory 'dir' to the list 'dirlist' (at the front) if - 1) 'dir' is not already in 'dirlist' -@@ -278,6 +282,14 @@ - (ext.name, sys.exc_info()[1])) - self.failed.append(ext.name) - return -+ -+ # Inport check will not work when cross-compiling. -+ if os.environ.has_key('PYTHONXCPREFIX'): -+ self.announce( -+ 'WARNING: skipping inport check for cross-compiled: "%s"' % -+ ext.name) -+ return -+ - # Workaround for Mac OS X: The Carbon-based modules cannot be - # reliably imported into a command-line Python - if 'Carbon' in ext.extra_link_args: - ---- Python-2.7Orig/configure 2011-04-29 22:30:59.231331437 +1000 -+++ Python-2.7/configure 2010-05-29 01:28:47.000000000 +1000 -@@ -13517,7 +13517,7 @@ - $as_echo_n "(cached) " >&6 - else - if test "$cross_compiling" = yes; then : -- ac_cv_have_long_long_format=no -+ ac_cv_have_long_long_format="cross -- assuming yes" - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ -@@ -13569,7 +13569,7 @@ - $as_echo "$ac_cv_have_long_long_format" >&6; } - fi - --if test "$ac_cv_have_long_long_format" = yes -+if test "$ac_cv_have_long_long_format" != no - then - - $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h - diff --git a/patch/libffi/generate-darwin-source-and-headers.py.patch b/patch/libffi/generate-darwin-source-and-headers.py.patch deleted file mode 100644 index 87af8638..00000000 --- a/patch/libffi/generate-darwin-source-and-headers.py.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- libffi-3.1-old/generate-darwin-source-and-headers.py 2014-10-23 17:49:33.000000000 +0800 -+++ libffi-3.1-new/generate-darwin-source-and-headers.py 2014-10-23 17:50:01.000000000 +0800 -@@ -14,7 +14,7 @@ - sdk = 'iphonesimulator' - arch = 'i386' - triple = 'i386-apple-darwin11' -- version_min = '-miphoneos-version-min=5.1.1' -+ version_min = '-miphoneos-version-min=6.0' - - prefix = "#ifdef __i386__\n\n" - suffix = "\n\n#endif" -@@ -40,7 +40,7 @@ - sdk = 'iphoneos' - arch = 'armv7' - triple = 'arm-apple-darwin11' -- version_min = '-miphoneos-version-min=5.1.1' -+ version_min = '-miphoneos-version-min=6.0' - - prefix = "#ifdef __arm__\n\n" - suffix = "\n\n#endif"