fix merge conflicts
This commit is contained in:
commit
256cd1213f
270 changed files with 4290 additions and 22976 deletions
4
.ci/constants.py
Normal file
4
.ci/constants.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
BROKEN_RECIPES = set()
|
||||
|
||||
# recipes that were already built will be skipped
|
||||
CORE_RECIPES = set(["kivy", "hostpython3", "python3"])
|
48
.ci/rebuild_updated_recipes.py
Normal file
48
.ci/rebuild_updated_recipes.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Continuous Integration helper script.
|
||||
Automatically detects recipes modified in a changeset (compares with master)
|
||||
and recompiles them.
|
||||
|
||||
Current limitations:
|
||||
- will fail on conflicting requirements
|
||||
"""
|
||||
import sh
|
||||
import subprocess
|
||||
from fnmatch import fnmatch
|
||||
from constants import CORE_RECIPES, BROKEN_RECIPES
|
||||
|
||||
|
||||
def modified_recipes(branch="origin/master"):
|
||||
"""
|
||||
Returns a set of modified recipes between the current branch and the one
|
||||
in param.
|
||||
"""
|
||||
# using the contrib version on purpose rather than sh.git, since it comes
|
||||
# with a bunch of fixes, e.g. disabled TTY, see:
|
||||
# https://stackoverflow.com/a/20128598/185510
|
||||
sh.contrib.git.fetch("origin", "master")
|
||||
git_diff = sh.contrib.git.diff("--name-only", branch)
|
||||
recipes = set()
|
||||
for file_path in git_diff:
|
||||
if fnmatch(file_path, "kivy_ios/recipes/*/__init__.py\n"):
|
||||
recipe = file_path.split("/")[2]
|
||||
recipes.add(recipe)
|
||||
return recipes
|
||||
|
||||
|
||||
def main():
|
||||
recipes = modified_recipes()
|
||||
recipes -= CORE_RECIPES
|
||||
recipes -= BROKEN_RECIPES
|
||||
updated_recipes = " ".join(recipes)
|
||||
if updated_recipes != "":
|
||||
subprocess.run(
|
||||
f"python3 toolchain.py build {updated_recipes}", shell=True, check=True
|
||||
)
|
||||
else:
|
||||
print("Nothing to do. No updated recipes.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
11
.ci/test_project.sh
Executable file
11
.ci/test_project.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
python3 toolchain.py create Touchtracer kivy-ci-clone/examples/demo/touchtracer
|
||||
|
||||
xcodebuild -project touchtracer-ios/touchtracer.xcodeproj \
|
||||
-scheme touchtracer \
|
||||
-destination generic/platform=iOS\
|
||||
clean build CODE_SIGNING_ALLOWED=NO | xcpretty
|
51
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
51
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
The issue tracker is a tool to address bugs.
|
||||
Please use the Discord community or Stack Overflow for support questions,
|
||||
more information at https://github.com/kivy/kivy-ios#support
|
||||
|
||||
Before opening a new issue, make sure you do the following:
|
||||
* check that your issue isn't already filed: https://github.com/kivy/kivy-ios/issues
|
||||
* prepare a short, runnable example that reproduces the issue
|
||||
* reproduce the problem with the latest development version (`master`)
|
||||
* double-check that the issue is indeed a bug and not a support request
|
||||
* please use backticks to format code or logs
|
||||
-->
|
||||
|
||||
**Versions**
|
||||
|
||||
* Python :
|
||||
* MacOS version :
|
||||
* XCode Version :
|
||||
* Cython version :
|
||||
|
||||
**Describe the bug**
|
||||
// REPLACE ME: A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
// REPLACE ME: Add your `toolchain.py ....` command or a complete explanation of what you did so We can reproduce your error.
|
||||
|
||||
**Expected behavior**
|
||||
// REPLACE ME: A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logs**
|
||||
```
|
||||
// REPLACE ME: Paste the build output containing the error
|
||||
```
|
||||
|
||||
**Screenshots**
|
||||
<!--
|
||||
ONLY for XCode related errors, use the LOGS section for toolchain.py related problems!
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
100
.github/workflows/kivy_ios.yml
vendored
Normal file
100
.github/workflows/kivy_ios.yml
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
name: kivy-ios
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
flake8:
|
||||
name: Flake8 tests
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout kivy-ios
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v1.1.0
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Run flake8
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install tox>=2.0
|
||||
tox -e pep8
|
||||
|
||||
build_python3_kivy:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout kivy-ios
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7.x
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.x
|
||||
- name: Install requirements
|
||||
run: |
|
||||
pip3 install -r requirements.txt
|
||||
brew install autoconf automake libtool pkg-config
|
||||
brew link libtool
|
||||
pip3 install Cython==0.29.17
|
||||
gem install xcpretty
|
||||
- name: Build Python & Kivy
|
||||
run: |
|
||||
python toolchain.py build python3 kivy
|
||||
- name: Checkout kivy for tests apps
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: kivy/kivy
|
||||
path: kivy-ci-clone
|
||||
- name: Create & Build test project
|
||||
run: |
|
||||
.ci/test_project.sh
|
||||
|
||||
build_python3_kivy_venv:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout kivy-ios
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7.x
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.x
|
||||
- name: Install requirements
|
||||
run: |
|
||||
python -m venv venv
|
||||
. venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
pip install sh
|
||||
brew install autoconf automake libtool pkg-config
|
||||
brew link libtool
|
||||
pip install Cython==0.29.17
|
||||
- name: Build Python & Kivy
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
python toolchain.py build python3 kivy
|
||||
- name: Checkout kivy for tests apps
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: kivy/kivy
|
||||
path: kivy-ci-clone
|
||||
- name: Create & Build test project
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
.ci/test_project.sh
|
||||
|
||||
build_updated_recipes:
|
||||
needs: flake8
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout kivy-ios
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7.x
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.x
|
||||
- name: Install requirements
|
||||
run: |
|
||||
pip3 install -r requirements.txt
|
||||
brew install autoconf automake libtool pkg-config
|
||||
brew link libtool
|
||||
pip3 install Cython==0.29.17
|
||||
- name: Build updated recipes
|
||||
run: |
|
||||
python3 .ci/rebuild_updated_recipes.py
|
25
.github/workflows/pypi-release.yml
vendored
Normal file
25
.github/workflows/pypi-release.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: PyPI release
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
pypi_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.x
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade setuptools wheel twine
|
||||
- name: Build
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
twine check dist/*
|
||||
- name: Publish package
|
||||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
|
||||
uses: pypa/gh-action-pypi-publish@v1.1.0
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.pypi_password }}
|
35
.github/workflows/setup.yml
vendored
Normal file
35
.github/workflows/setup.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: setup
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout kivy-ios
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v1.1.0
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install --upgrade setuptools wheel twine
|
||||
- name: sdist bdist_wheel
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
- name: Twine check
|
||||
run: |
|
||||
twine check dist/*
|
||||
- name: Local install
|
||||
run: |
|
||||
python -m venv venv
|
||||
. venv/bin/activate
|
||||
pip install dist/kivy-ios-*.tar.gz
|
||||
pip install Cython==0.29.17
|
||||
brew install autoconf automake libtool pkg-config
|
||||
- name: Basic toolchain commands
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
toolchain --help
|
||||
toolchain recipes
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -19,3 +19,5 @@ src/ios/ios.c
|
|||
*.DS_Store*
|
||||
*-ios/
|
||||
__pycache__
|
||||
.tox
|
||||
venv
|
||||
|
|
48
CHANGELOG.md
Normal file
48
CHANGELOG.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Changelog
|
||||
|
||||
## [1.1.2] - 2020-05-11
|
||||
### Fixed
|
||||
- Fixes (venv build) reference to SDL\_main.h [\#493](https://github.com/kivy/kivy-ios/issues/493) ([AndreMiras](https://github.com/AndreMiras))
|
||||
|
||||
## [1.1.1] - 2020-05-11
|
||||
### Added
|
||||
- Add python depends [\#455](https://github.com/kivy/kivy-ios/issues/455) ([misl6](https://github.com/misl6))
|
||||
|
||||
### Removed
|
||||
- Removed Python 2 support [\#482](https://github.com/kivy/kivy-ios/issues/482) ([AndreMiras](https://github.com/AndreMiras))
|
||||
|
||||
### Fixed
|
||||
- Adds initial\_working\_directory [\#489](https://github.com/kivy/kivy-ios/issues/489) ([misl6](https://github.com/misl6))
|
||||
- Adds netifaces recipe, closes #239 [\#488](https://github.com/kivy/kivy-ios/issues/488) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Uses contextlib.suppress to ignore exceptions [\#487](https://github.com/kivy/kivy-ios/issues/487) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- DRY via the find\_xcodeproj() helper method [\#486](https://github.com/kivy/kivy-ios/issues/486) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Uses cd context manager in Python3Recipe.reduce\_python() [\#485](https://github.com/kivy/kivy-ios/issues/485) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Uses Python 3 syntax [\#484](https://github.com/kivy/kivy-ios/issues/484) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Also lints the tools/ folder [\#483](https://github.com/kivy/kivy-ios/issues/483) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Migrates libffi build to Python 3 [\#481](https://github.com/kivy/kivy-ios/issues/481) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Uses a couple of syntax shortcuts [\#479](https://github.com/kivy/kivy-ios/issues/479) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Takes ToolchainCL definition outside the main [\#478](https://github.com/kivy/kivy-ios/issues/478) ([AndreMiras](https://github.com/AndreMiras))
|
||||
|
||||
## [1.1.0] - 2020-05-05
|
||||
### Added
|
||||
- Automatically publish to PyPI upon tagging [\#475](https://github.com/kivy/kivy-ios/issues/475) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Dedicated setup.py test workflow [\#474](https://github.com/kivy/kivy-ios/issues/474) ([AndreMiras](https://github.com/AndreMiras))
|
||||
|
||||
### Fixed
|
||||
- Fixes a regression introduced during the linting [\#477](https://github.com/kivy/kivy-ios/issues/477) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- More fixes to Numpy so that the binary is accepted by the App Store [\#473](https://github.com/kivy/kivy-ios/issues/473) ([lerela](https://github.com/lerela))
|
||||
- Do not build known broken recipes [\#471](https://github.com/kivy/kivy-ios/issues/471) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Fixes minor typos in the issue template [\#469](https://github.com/kivy/kivy-ios/issues/469) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Activates venv before venv build [\#464](https://github.com/kivy/kivy-ios/issues/464) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Fixes building in venv [\#462](https://github.com/kivy/kivy-ios/issues/462) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Cleanup - Removes vendored deps [\#454](https://github.com/kivy/kivy-ios/issues/454) ([misl6](https://github.com/misl6))
|
||||
|
||||
### Changed
|
||||
- Updates README.md with install/usage from PyPI [\#476](https://github.com/kivy/kivy-ios/issues/476) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Moving to dedicated kivy\_ios/ package directory [\#472](https://github.com/kivy/kivy-ios/issues/472) ([AndreMiras](https://github.com/AndreMiras))
|
||||
- Bumps Cython version [\#470](https://github.com/kivy/kivy-ios/issues/470) ([misl6](https://github.com/misl6))
|
||||
- Uses new `cd` context manager more [\#465](https://github.com/kivy/kivy-ios/issues/465) ([AndreMiras](https://github.com/AndreMiras))
|
||||
|
||||
|
||||
## [1.0.0] - 2020-05-02
|
||||
- Initial release
|
98
README.md
98
README.md
|
@ -1,5 +1,7 @@
|
|||
# Kivy for iOS
|
||||
|
||||
[![kivy-ios](https://github.com/kivy/kivy-ios/workflows/kivy-ios/badge.svg)](https://github.com/kivy/kivy-ios/actions?query=workflow%3Akivy-ios)
|
||||
[![PyPI version](https://badge.fury.io/py/kivy-ios.svg)](https://badge.fury.io/py/kivy-ios)
|
||||
[![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers)
|
||||
[![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors)
|
||||
|
||||
|
@ -14,25 +16,23 @@ The toolchain supports:
|
|||
- iPhone Simulator (x86_64)
|
||||
- iPhone / iOS (armv7 and arm64)
|
||||
|
||||
You can select between Python 2.7 or Python 3.7 by specifying the recipes
|
||||
`python2` or `python3` when building.
|
||||
|
||||
These recipes are not ported to the new toolchain yet:
|
||||
|
||||
- lxml
|
||||
|
||||
|
||||
## Requirements
|
||||
## Installation & requirements
|
||||
|
||||
Currently, the toolchain requires a few tools for compilation. You will need:
|
||||
Before we start, we strongly advise to use a Python virtual environment to install Python packages.
|
||||
|
||||
- Ensure you have python3 installed - this is needed for toolchain.py:
|
||||
python3 -m venv venv
|
||||
. venv/bin/activate
|
||||
|
||||
brew install python
|
||||
Install [Kivy for iOS from PyPI](https://pypi.org/project/kivy-ios) with pip like any Python package.
|
||||
|
||||
- Ensure you have the right dependencies installed for python3:
|
||||
pip3 install kivy-ios
|
||||
|
||||
pip3 install -r requirements.txt
|
||||
Additionally you would need few system dependencies and configuration.
|
||||
|
||||
- Xcode 10 or above, with an iOS SDK and command line tools installed:
|
||||
|
||||
|
@ -43,12 +43,6 @@ Currently, the toolchain requires a few tools for compilation. You will need:
|
|||
brew install autoconf automake libtool pkg-config
|
||||
brew link libtool
|
||||
|
||||
- Install Cython (0.28.1):
|
||||
|
||||
# pip method if available (sudo might be needed.)
|
||||
pip install cython==0.28.1
|
||||
|
||||
|
||||
## Using the toolchain
|
||||
|
||||
Any Python extensions or C/C++ library must be compiled: you need to have what
|
||||
|
@ -58,61 +52,58 @@ contained in a `recipe`.
|
|||
|
||||
You can list the available recipes and their versions with:
|
||||
|
||||
$ ./toolchain.py recipes
|
||||
$ toolchain recipes
|
||||
audiostream master
|
||||
click master
|
||||
click 7.1.2
|
||||
cymunk master
|
||||
distribute 0.7.3
|
||||
ffmpeg 2.6.3
|
||||
ffpyplayer v3.2
|
||||
flask master
|
||||
flask 1.1.2
|
||||
freetype 2.5.5
|
||||
hostlibffi 3.2.1
|
||||
hostpython2 2.7.1
|
||||
hostpython3 3.7.1
|
||||
ios master
|
||||
itsdangerous master
|
||||
jinja2 master
|
||||
itsdangerous 1.1.0
|
||||
jinja2 2.11.2
|
||||
kivy 1.10.1
|
||||
libffi 3.2.1
|
||||
libjpeg v9a
|
||||
libpng 1.6.26
|
||||
markupsafe master
|
||||
markupsafe 1.1.1
|
||||
moodstocks 4.1.5
|
||||
numpy 1.9.1
|
||||
numpy 1.16.4
|
||||
openssl 1.0.2k
|
||||
photolibrary master
|
||||
pil 2.8.2
|
||||
pillow 6.1.0
|
||||
plyer master
|
||||
pycrypto 2.6.1
|
||||
pykka 1.2.1
|
||||
pyobjus master
|
||||
python2 2.7.1
|
||||
python3 3.7.1
|
||||
pyyaml 3.11
|
||||
sdl2 2.0.8
|
||||
sdl2_image 2.0.0
|
||||
sdl2_mixer 2.0.0
|
||||
sdl2_ttf 2.0.12
|
||||
werkzeug master
|
||||
werkzeug 1.0.1
|
||||
|
||||
Then, start the compilation with:
|
||||
|
||||
$ ./toolchain.py build python3 kivy
|
||||
$ toolchain build python3 kivy
|
||||
|
||||
You can build recipes at the same time by adding them as parameters:
|
||||
|
||||
$ ./toolchain.py build python3 openssl kivy
|
||||
$ toolchain build python3 openssl kivy
|
||||
|
||||
Recipe builds can be removed via the clean command e.g.:
|
||||
|
||||
$ ./toolchain.py clean openssl
|
||||
|
||||
$ toolchain clean openssl
|
||||
|
||||
You can install package that don't require compilation with pip::
|
||||
|
||||
$ ./toolchain.py pip install plyer
|
||||
$ toolchain pip install plyer
|
||||
|
||||
The Kivy recipe depends on several others, like the sdl* and python recipes.
|
||||
The Kivy recipe depends on several others, like the sdl\* and python recipes.
|
||||
These may in turn depend on others e.g. sdl2_ttf depends on freetype, etc.
|
||||
You can think of it as follows: the kivy recipe will compile everything
|
||||
necessary for a minimal working version of Kivy.
|
||||
|
@ -122,14 +113,14 @@ time, 3x over (remember, 3 archs, x86_64, armv7, arm64) will take time.
|
|||
|
||||
For a complete list of available commands, type:
|
||||
|
||||
$ ./toolchain.py
|
||||
$ toolchain
|
||||
|
||||
## Create the Xcode project
|
||||
|
||||
The `toolchain.py` can create the initial Xcode project for you::
|
||||
|
||||
$ ./toolchain.py create <title> <app_directory>
|
||||
$ ./toolchain.py create Touchtracer ~/code/kivy/examples/demo/touchtracer
|
||||
$ toolchain create <title> <app_directory>
|
||||
$ toolchain create Touchtracer ~/code/kivy/examples/demo/touchtracer
|
||||
|
||||
Your app directory must contain a main.py. A directory named `<title>-ios`
|
||||
will be created, with an Xcode project in it.
|
||||
|
@ -200,12 +191,12 @@ things you can do to achieve this:
|
|||
|
||||
The procedure is to first compile/build all the host recipes as is:
|
||||
|
||||
./toolchain.py build hostpython3
|
||||
toolchain build hostpython3
|
||||
|
||||
Then build all the rest of the recipes using --arch=armv7 --arch=arm64
|
||||
arguments as follows:
|
||||
|
||||
./toolchain.py build python3 kivy --arch=armv7 --arch=arm64
|
||||
toolchain build python3 kivy --arch=armv7 --arch=arm64
|
||||
|
||||
Note that these packages will not run in the iOS emulators, so use them
|
||||
only for deployment.
|
||||
|
@ -213,7 +204,7 @@ things you can do to achieve this:
|
|||
## Usage
|
||||
|
||||
```
|
||||
./toolchain.py <command> [<args>]
|
||||
toolchain <command> [<args>]
|
||||
|
||||
Available commands:
|
||||
build Build a recipe (compile a library for the required target
|
||||
|
@ -229,8 +220,26 @@ Xcode:
|
|||
launchimage Create Launch images for your xcode project
|
||||
icon Create Icons for your xcode project
|
||||
pip Install a pip dependency into the distribution
|
||||
pip3 Install a pip dependency into the python 3 distribution
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Alternatively, it's also possible to clone the repository and use all the
|
||||
described commands in the above sections.
|
||||
Clone and install it to your local virtual environment:
|
||||
|
||||
git clone https://github.com/kivy/kivy-ios.git
|
||||
cd kivy-ios/
|
||||
python3 -m venv venv
|
||||
. venv/bin/activate
|
||||
pip install -e .
|
||||
|
||||
Then use the `toolchain.py` script:
|
||||
|
||||
python toolchain.py --help
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### Fatal error: "stdio.h" file not found
|
||||
|
@ -247,6 +256,16 @@ It is due to invalid archs, search for them and check it. Maybe you
|
|||
targetted a simulator but have only armv7/arm64. Maybe you want to target
|
||||
your iPad but it as only x86_64.
|
||||
|
||||
### Why does the python multiprocess/subprocess module not work?
|
||||
|
||||
The iOS application model does not currently support multi-processing in a
|
||||
cross-platform compatible way. The application design focuses on minimizing
|
||||
processor usage (to minimize power consumption) and promotes an
|
||||
[alternative concurrency model](https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html).
|
||||
|
||||
If you need to make use of multiple processes, you should consider using
|
||||
[PyObjus](https://github.com/kivy/pyobjus) to leverage native iOS
|
||||
functionals for this.
|
||||
|
||||
## Support
|
||||
|
||||
|
@ -305,3 +324,4 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|||
<a href="https://opencollective.com/kivy/sponsor/7/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/kivy/sponsor/8/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/kivy/sponsor/9/website" target="_blank"><img src="https://opencollective.com/kivy/sponsor/9/avatar.svg"></a>
|
||||
|
||||
|
|
46
kivy_ios/context_managers.py
Normal file
46
kivy_ios/context_managers.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
"""
|
||||
This module houses context managers to assist in the managing of state during
|
||||
kivy-ios builds.
|
||||
"""
|
||||
from logging import getLogger
|
||||
from contextlib import contextmanager
|
||||
from os import getcwd, chdir, environ
|
||||
from os.path import expanduser
|
||||
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def cd(newdir):
|
||||
"""
|
||||
Set the current working directory to `newdir` for the duration of the
|
||||
context.
|
||||
"""
|
||||
prevdir = getcwd()
|
||||
logger.info("cd {}".format(newdir))
|
||||
chdir(expanduser(newdir))
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
logger.info("cd {}".format(prevdir))
|
||||
chdir(prevdir)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def python_path(newdir):
|
||||
"""
|
||||
Set the PYTHONPATH environmnet variable to `newdir` for the duraiton of the
|
||||
context.
|
||||
"""
|
||||
prevdir = environ.get("PYTHONPATH")
|
||||
logger.debug("Setting PYTHONPATH to {}".format(newdir))
|
||||
environ["PYTHONPATH"] = newdir
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
logger.debug("Setting PYTHONPATH to {}".format(prevdir))
|
||||
if prevdir is None:
|
||||
environ.pop("PYTHONPATH")
|
||||
else:
|
||||
environ["PYTHONPATH"] = prevdir
|
|
@ -1,4 +1,4 @@
|
|||
from toolchain import CythonRecipe
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
|
||||
|
||||
class AudiostreamRecipe(CythonRecipe):
|
||||
|
@ -10,4 +10,3 @@ class AudiostreamRecipe(CythonRecipe):
|
|||
|
||||
|
||||
recipe = AudiostreamRecipe()
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
# pure-python package, this can be removed when we'll support any python package
|
||||
from toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh, os
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class ClickRecipe(PythonRecipe):
|
||||
version = "master"
|
||||
version = "7.1.2"
|
||||
url = "https://github.com/mitsuhiko/click/archive/{version}.zip"
|
||||
depends = ["python"]
|
||||
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = arch.get_env()
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
cmd = sh.Command("sed")
|
||||
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python3")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
|
||||
recipe = ClickRecipe()
|
||||
|
||||
recipe = ClickRecipe()
|
12
kivy_ios/recipes/curly/__init__.py
Normal file
12
kivy_ios/recipes/curly/__init__.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from kivy_ios.toolchain import CythonRecipe
|
||||
|
||||
|
||||
class CurlyRecipe(CythonRecipe):
|
||||
version = "master"
|
||||
url = "https://github.com/tito/curly/archive/{version}.zip"
|
||||
library = "libcurly.a"
|
||||
depends = ["python", "libcurl", "sdl2", "sdl2_image"]
|
||||
pre_build_ext = True
|
||||
|
||||
|
||||
recipe = CurlyRecipe()
|
24
kivy_ios/recipes/cymunk/__init__.py
Normal file
24
kivy_ios/recipes/cymunk/__init__.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
"""
|
||||
Author: Lawrence Du, Lukasz Mach
|
||||
E-mail: larrydu88@gmail.com, maho@pagema.net
|
||||
"""
|
||||
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
|
||||
|
||||
class CymunkRecipe(CythonRecipe):
|
||||
version = 'master'
|
||||
url = 'https://github.com/kivy/cymunk/archive/{version}.zip'
|
||||
name = 'cymunk'
|
||||
pre_build_ext = True
|
||||
library = 'libcymunk.a'
|
||||
|
||||
depends = ['python']
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
ret = super(CymunkRecipe, self).get_recipe_env(arch)
|
||||
ret['CFLAGS'] += ' -Wno-implicit-function-declaration'
|
||||
return ret
|
||||
|
||||
|
||||
recipe = CymunkRecipe()
|
|
@ -1,11 +1,11 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class FFMpegRecipe(Recipe):
|
||||
version = "2.6.3"
|
||||
url = "http://www.ffmpeg.org/releases/ffmpeg-{version}.tar.bz2"
|
||||
version = "n3.4.5"
|
||||
url = "https://github.com/FFmpeg/FFmpeg/archive/{version}.zip"
|
||||
include_per_arch = True
|
||||
include_dir = "dist/include"
|
||||
optional_depends = ["openssl"]
|
||||
|
@ -17,16 +17,18 @@ class FFMpegRecipe(Recipe):
|
|||
"libavresample/libavresample.a",
|
||||
"libavutil/libavutil.a",
|
||||
"libswresample/libswresample.a",
|
||||
"libswscale/libswscale.a"]
|
||||
"libswscale/libswscale.a",
|
||||
]
|
||||
pbx_frameworks = ["VideoToolbox"]
|
||||
|
||||
def build_arch(self, arch):
|
||||
options = [
|
||||
"--disable-everything",
|
||||
"--enable-parser=h264,aac",
|
||||
"--enable-decoder=h263,h264,aac",
|
||||
"--enable-filter=aresample,resample,crop",
|
||||
"--enable-protocol=file,http",
|
||||
"--enable-demuxer=sdp",
|
||||
"--enable-parsers",
|
||||
"--enable-decoders",
|
||||
"--enable-demuxers",
|
||||
"--enable-filter=aresample,resample,crop,scale",
|
||||
"--enable-protocol=file,http,rtmp",
|
||||
"--enable-pic",
|
||||
"--enable-small",
|
||||
"--enable-hwaccels",
|
||||
|
@ -41,7 +43,6 @@ class FFMpegRecipe(Recipe):
|
|||
"--disable-vdpau",
|
||||
"--disable-vaapi",
|
||||
"--disable-dct",
|
||||
|
||||
# disable binaries / doc
|
||||
"--enable-cross-compile",
|
||||
"--disable-debug",
|
||||
|
@ -67,6 +68,7 @@ class FFMpegRecipe(Recipe):
|
|||
"--extra-cflags={}".format(build_env["CFLAGS"]),
|
||||
"--extra-cxxflags={}".format(build_env["CFLAGS"]),
|
||||
"--extra-ldflags={}".format(build_env["LDFLAGS"]),
|
||||
"--disable-x86asm",
|
||||
*options,
|
||||
_env=build_env)
|
||||
"""
|
||||
|
@ -90,4 +92,3 @@ class FFMpegRecipe(Recipe):
|
|||
|
||||
|
||||
recipe = FFMpegRecipe()
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
from toolchain import CythonRecipe, shprint
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class FFPyplayerRecipe(CythonRecipe):
|
||||
version = "v3.2"
|
||||
version = "4.2.0"
|
||||
url = "https://github.com/matham/ffpyplayer/archive/{version}.zip"
|
||||
library = "libffpyplayer.a"
|
||||
depends = ["python", "ffmpeg"]
|
||||
|
@ -19,12 +18,18 @@ class FFPyplayerRecipe(CythonRecipe):
|
|||
env["CC"] += " -I{}".format(
|
||||
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
|
||||
env["SDL_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
"common", "sdl2")
|
||||
"common", "sdl2")
|
||||
env["FFMPEG_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
arch.arch, "ffmpeg")
|
||||
arch.arch, "ffmpeg")
|
||||
env["CONFIG_POSTPROC"] = "0"
|
||||
return env
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
# common to all archs
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.apply_patch("misc-visibility.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
|
||||
recipe = FFPyplayerRecipe()
|
||||
|
41
kivy_ios/recipes/ffpyplayer/misc-visibility.patch
Normal file
41
kivy_ios/recipes/ffpyplayer/misc-visibility.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
diff --git a/ffpyplayer/clib/misc.c b/ffpyplayer/clib/misc.c
|
||||
index 55181d1..6011ffa 100644
|
||||
--- a/ffpyplayer/clib/misc.c
|
||||
+++ b/ffpyplayer/clib/misc.c
|
||||
@@ -1,8 +1,7 @@
|
||||
-
|
||||
#include "misc.h"
|
||||
|
||||
#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
|
||||
-void print_all_libs_info(int flags, int level)
|
||||
+void __attribute__ ((visibility ("hidden"))) print_all_libs_info(int flags, int level)
|
||||
{
|
||||
#if CONFIG_AVUTIL
|
||||
PRINT_LIB_INFO(avutil, AVUTIL, flags, level);
|
||||
@@ -30,7 +29,7 @@ void print_all_libs_info(int flags, int level)
|
||||
#endif
|
||||
}
|
||||
|
||||
-const AVOption *opt_find(void *obj, const char *name, const char *unit,
|
||||
+const AVOption __attribute__ ((visibility ("hidden"))) *opt_find(void *obj, const char *name, const char *unit,
|
||||
int opt_flags, int search_flags)
|
||||
{
|
||||
const AVOption *o = av_opt_find(obj, name, unit, opt_flags, search_flags);
|
||||
@@ -40,7 +39,7 @@ const AVOption *opt_find(void *obj, const char *name, const char *unit,
|
||||
}
|
||||
|
||||
#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
|
||||
-int opt_default(const char *opt, const char *arg,
|
||||
+int __attribute__ ((visibility ("hidden"))) opt_default(const char *opt, const char *arg,
|
||||
struct SwsContext *sws_opts, AVDictionary **sws_dict, AVDictionary **swr_opts,
|
||||
AVDictionary **resample_opts, AVDictionary **format_opts, AVDictionary **codec_opts)
|
||||
{
|
||||
@@ -140,7 +139,7 @@ int opt_default(const char *opt, const char *arg,
|
||||
return AVERROR_OPTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
-int get_plane_sizes(int size[4], int required_plane[4], enum AVPixelFormat pix_fmt,
|
||||
+int __attribute__ ((visibility ("hidden"))) get_plane_sizes(int size[4], int required_plane[4], enum AVPixelFormat pix_fmt,
|
||||
int height, const int linesizes[4])
|
||||
{
|
||||
int i, total_size;
|
|
@ -1,13 +1,15 @@
|
|||
# pure-python package, this can be removed when we'll support any python package
|
||||
from toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh, os
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class FlaskRecipe(PythonRecipe):
|
||||
version = "master"
|
||||
version = "1.1.2"
|
||||
url = "https://github.com/mitsuhiko/flask/archive/{version}.zip"
|
||||
depends = ["python","jinja2","werkzeug","itsdangerous","click"]
|
||||
|
||||
depends = ["python", "jinja2", "werkzeug", "itsdangerous", "click"]
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
|
@ -15,10 +17,8 @@ class FlaskRecipe(PythonRecipe):
|
|||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = arch.get_env()
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
cmd = sh.Command("sed")
|
||||
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
|
||||
recipe = FlaskRecipe()
|
||||
|
||||
recipe = FlaskRecipe()
|
|
@ -1,4 +1,4 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
@ -32,4 +32,3 @@ class FreetypeRecipe(Recipe):
|
|||
|
||||
|
||||
recipe = FreetypeRecipe()
|
||||
|
34
kivy_ios/recipes/host_setuptools/__init__.py
Normal file
34
kivy_ios/recipes/host_setuptools/__init__.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
class HostSetuptools(Recipe):
|
||||
depends = ["openssl", "hostpython"]
|
||||
archs = ["x86_64"]
|
||||
url = "setuptools"
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
|
||||
shprint(hostpython, "./ez_setup.py")
|
||||
# Extract setuptools egg and remove .pth files. Otherwise subsequent
|
||||
# python package installations using setuptools will raise exceptions.
|
||||
# Setuptools version 28.3.0
|
||||
site_packages_path = join(
|
||||
self.ctx.dist_dir, 'hostpython',
|
||||
'lib', 'python3.7', 'site-packages')
|
||||
os.chdir(site_packages_path)
|
||||
with open('setuptools.pth', 'r') as f:
|
||||
setuptools_egg_path = f.read().strip('./').strip('\n')
|
||||
unzip = sh.Command('unzip')
|
||||
shprint(unzip, setuptools_egg_path)
|
||||
os.remove(setuptools_egg_path)
|
||||
os.remove('setuptools.pth')
|
||||
os.remove('easy-install.pth')
|
||||
shutil.rmtree('EGG-INFO')
|
||||
|
||||
|
||||
recipe = HostSetuptools()
|
24
kivy_ios/recipes/host_setuptools3/__init__.py
Normal file
24
kivy_ios/recipes/host_setuptools3/__init__.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint, cache_execution
|
||||
from kivy_ios.context_managers import cd, python_path
|
||||
import sh
|
||||
|
||||
|
||||
class HostSetuptools3(Recipe):
|
||||
depends = ["openssl", "hostpython3", "python3"]
|
||||
archs = ["x86_64"]
|
||||
version = '40.9.0'
|
||||
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip'
|
||||
|
||||
@cache_execution
|
||||
def install(self):
|
||||
arch = self.filtered_archs[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
|
||||
with python_path(self.ctx.site_packages_dir):
|
||||
with cd(build_dir):
|
||||
shprint(hostpython, "setup.py", "install",
|
||||
f"--prefix={self.ctx.python_prefix}")
|
||||
|
||||
|
||||
recipe = HostSetuptools3()
|
1
kivy_ios/recipes/host_setuptools3/setuptools/README.rst
Normal file
1
kivy_ios/recipes/host_setuptools3/setuptools/README.rst
Normal file
|
@ -0,0 +1 @@
|
|||
Make toolchain happy
|
|
@ -1,10 +1,11 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
import sh
|
||||
from os.path import exists
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LibffiRecipe(Recipe):
|
||||
version = "3.2.1"
|
||||
url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
|
||||
|
@ -29,7 +30,7 @@ class LibffiRecipe(Recipe):
|
|||
return
|
||||
# necessary as it doesn't compile with XCode 6.0. If we use 5.1.1, the
|
||||
# compiler for i386 is not working.
|
||||
#shprint(sh.sed,
|
||||
# shprint(sh.sed,
|
||||
# "-i.bak",
|
||||
# "s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=6.0/g",
|
||||
# "generate-darwin-source-and-headers.py")
|
||||
|
@ -38,6 +39,7 @@ class LibffiRecipe(Recipe):
|
|||
self.apply_patch("staticlib.patch")
|
||||
self.apply_patch("staticlib2.patch")
|
||||
self.apply_patch("libffi-xcode10.patch")
|
||||
self.apply_patch("generate-darwin-source-and-headers-python3-items.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def build_arch(self, arch):
|
||||
|
@ -47,8 +49,8 @@ class LibffiRecipe(Recipe):
|
|||
"generate-darwin-source-and-headers.py",
|
||||
"_generate-darwin-source-and-headers.py")
|
||||
shprint(sh.touch, "generate-darwin-source-and-headers.py")
|
||||
python27 = sh.Command("python2.7")
|
||||
shprint(python27, "_generate-darwin-source-and-headers.py", "--only-osx")
|
||||
python3 = sh.Command("python3")
|
||||
shprint(python3, "_generate-darwin-source-and-headers.py", "--only-osx")
|
||||
shprint(sh.xcodebuild,
|
||||
self.ctx.concurrent_xcodebuild,
|
||||
"ONLY_ACTIVE_ARCH=NO",
|
||||
|
@ -63,4 +65,5 @@ class LibffiRecipe(Recipe):
|
|||
def postbuild_arch(self, arch):
|
||||
pass
|
||||
|
||||
|
||||
recipe = LibffiRecipe()
|
|
@ -0,0 +1,12 @@
|
|||
diff -Nru libffi-3.2.1/generate-darwin-source-and-headers.py libffi-3.2.1-new/generate-darwin-source-and-headers.py
|
||||
--- libffi-3.2.1/generate-darwin-source-and-headers.py 2014-11-08 13:47:24.000000000 +0100
|
||||
+++ libffi-3.2.1-new/generate-darwin-source-and-headers.py 2020-05-06 10:30:46.000000000 +0200
|
||||
@@ -194,7 +194,7 @@
|
||||
build_target(desktop64_platform, platform_headers)
|
||||
|
||||
mkdir_p('darwin_common/include')
|
||||
- for header_name, tag_tuples in platform_headers.iteritems():
|
||||
+ for header_name, tag_tuples in platform_headers.items():
|
||||
basename, suffix = os.path.splitext(header_name)
|
||||
with open(os.path.join('darwin_common/include', header_name), 'w') as header:
|
||||
for tag_tuple in tag_tuples:
|
|
@ -1,27 +1,31 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from toolchain import Recipe
|
||||
from kivy_ios.toolchain import Recipe
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HostpythonAliasRecipe(Recipe):
|
||||
"""
|
||||
Note this recipe was created to handle both hostpython2 and hostpython3.
|
||||
As hostpython2 support was dropped, this could probably be simplified.
|
||||
"""
|
||||
is_alias = True
|
||||
|
||||
def init_after_import(self, ctx):
|
||||
hostpython = ctx.state.get("hostpython")
|
||||
if not hostpython:
|
||||
# search in wanted_recipes if it's the first time
|
||||
if "hostpython2" in ctx.wanted_recipes:
|
||||
hostpython = "hostpython2"
|
||||
elif "hostpython3" in ctx.wanted_recipes:
|
||||
if "hostpython3" in ctx.wanted_recipes:
|
||||
hostpython = "hostpython3"
|
||||
else:
|
||||
logger.error("No hostpython version set in the build.")
|
||||
logger.error("Add python2 or python3 in your recipes:")
|
||||
logger.error("Add python3 in your recipes:")
|
||||
logger.error("./toolchain.py build python3 ...")
|
||||
sys.exit(1)
|
||||
if hostpython:
|
||||
self.depends = [hostpython]
|
||||
|
||||
|
||||
recipe = HostpythonAliasRecipe()
|
100
kivy_ios/recipes/hostpython3/__init__.py
Normal file
100
kivy_ios/recipes/hostpython3/__init__.py
Normal file
|
@ -0,0 +1,100 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import os
|
||||
import sh
|
||||
import shutil
|
||||
import logging
|
||||
from kivy_ios.context_managers import cd
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Hostpython3Recipe(Recipe):
|
||||
version = "3.8.2"
|
||||
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
|
||||
depends = ["hostlibffi", "hostopenssl"]
|
||||
optional_depends = []
|
||||
archs = ["x86_64"]
|
||||
build_subdir = 'native-build'
|
||||
|
||||
def init_with_ctx(self, ctx):
|
||||
super().init_with_ctx(ctx)
|
||||
self.set_hostpython(self, "3.8")
|
||||
self.ctx.so_suffix = ".cpython-38m-darwin.so"
|
||||
self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython3", "bin", "python")
|
||||
self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython3", "bin", "pgen")
|
||||
logger.info("Global: hostpython located at {}".format(self.ctx.hostpython))
|
||||
logger.info("Global: hostpgen located at {}".format(self.ctx.hostpgen))
|
||||
|
||||
def get_build_subdir(self, arch):
|
||||
return join(self.get_build_dir(arch), self.build_subdir)
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.apply_patch("pyconfig_detection.patch")
|
||||
self.copy_file("ModulesSetup", "Modules/Setup.local")
|
||||
self.set_marker("patched")
|
||||
|
||||
def postbuild_arch(self, arch):
|
||||
return
|
||||
|
||||
def get_build_env(self):
|
||||
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
|
||||
build_env = self.ctx.env.copy()
|
||||
self.build_env_x86_84 = build_env
|
||||
ccache = (build_env["CCACHE"] + ' ') if 'CCACHE' in build_env else ''
|
||||
build_env["CC"] = ccache + "clang -Qunused-arguments -fcolor-diagnostics"
|
||||
build_env["LDFLAGS"] = " ".join([
|
||||
"-lsqlite3",
|
||||
"-lffi",
|
||||
"-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib"))
|
||||
])
|
||||
build_env["CFLAGS"] = " ".join([
|
||||
"--sysroot={}".format(sdk_path),
|
||||
"-arch x86_64",
|
||||
"-mmacosx-version-min=10.12",
|
||||
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
|
||||
])
|
||||
return build_env
|
||||
|
||||
def build_x86_64(self):
|
||||
build_env = self.get_build_env()
|
||||
configure = sh.Command(join(self.build_dir, "configure"))
|
||||
arch = self.filtered_archs[0]
|
||||
build_subdir = self.get_build_subdir(arch.arch)
|
||||
os.makedirs(build_subdir, exist_ok=True)
|
||||
with cd(build_subdir):
|
||||
shprint(configure,
|
||||
"--prefix={}".format(join(self.ctx.dist_dir, "hostpython3")),
|
||||
"--with-openssl={}".format(join(self.ctx.dist_dir, 'hostopenssl')),
|
||||
_env=build_env)
|
||||
shprint(sh.make, "-C", build_subdir, self.ctx.concurrent_make,
|
||||
_env=build_env)
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_env = self.get_build_env()
|
||||
build_subdir = self.get_build_subdir(arch.arch)
|
||||
build_env["PATH"] = os.environ["PATH"]
|
||||
shprint(sh.make, self.ctx.concurrent_make,
|
||||
"-C", build_subdir,
|
||||
"install",
|
||||
_env=build_env)
|
||||
shutil.copy(
|
||||
join(self.ctx.dist_dir, "hostpython3", "bin", "python3"),
|
||||
join(self.ctx.dist_dir, "hostpython3", "bin", "python"))
|
||||
"""
|
||||
I don't like this kind of "patches".
|
||||
sysconfig was overriding our cflags and extensions were failing to build.
|
||||
This hack resets the cflags provided by sysconfig.
|
||||
"""
|
||||
with open(join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8", "distutils", "sysconfig.py"), 'r') as sysconfigfile:
|
||||
lines = sysconfigfile.readlines()
|
||||
lines[192] = ' cflags = ""\n'
|
||||
with open(join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8", "distutils", "sysconfig.py"), 'w') as sysconfigfile:
|
||||
sysconfigfile.writelines(lines)
|
||||
|
||||
|
||||
recipe = Hostpython3Recipe()
|
25
kivy_ios/recipes/hostpython3/pyconfig_detection.patch
Normal file
25
kivy_ios/recipes/hostpython3/pyconfig_detection.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py
|
||||
--- Python-3.8.2/Lib/site.py 2020-02-24 22:36:25.000000000 +0100
|
||||
+++ Python-3.8.2-new/Lib/site.py 2020-05-01 17:10:43.000000000 +0200
|
||||
@@ -458,9 +458,8 @@
|
||||
|
||||
env = os.environ
|
||||
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
|
||||
- executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__']
|
||||
- else:
|
||||
- executable = sys.executable
|
||||
+ print("Ignoring __PYVENV_LAUNCHER__")
|
||||
+ executable = sys.executable
|
||||
exe_dir, _ = os.path.split(os.path.abspath(executable))
|
||||
site_prefix = os.path.dirname(exe_dir)
|
||||
sys._home = None
|
||||
@@ -487,7 +486,8 @@
|
||||
if key == 'include-system-site-packages':
|
||||
system_site = value.lower()
|
||||
elif key == 'home':
|
||||
- sys._home = value
|
||||
+ # this is breaking pyconfig.h path detection with venv
|
||||
+ print('Ignoring "sys._home = value" override')
|
||||
|
||||
sys.prefix = sys.exec_prefix = site_prefix
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from toolchain import CythonRecipe
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
|
||||
|
||||
class IosRecipe(CythonRecipe):
|
||||
|
@ -6,7 +6,7 @@ class IosRecipe(CythonRecipe):
|
|||
url = "src"
|
||||
library = "libios.a"
|
||||
depends = ["python"]
|
||||
pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit"]
|
||||
pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit", "WebKit", "Photos"]
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
from os.path import join
|
|
@ -11,12 +11,18 @@ from os.path import basename
|
|||
|
||||
cdef extern from "ios_wrapper.h":
|
||||
ctypedef void (*ios_send_email_cb)(char *, void *)
|
||||
ctypedef struct padding:
|
||||
float top
|
||||
float bottom
|
||||
float right
|
||||
float left
|
||||
int ios_send_email(char *subject, char *text, char *mimetype, char
|
||||
*filename, char *filename_alias, ios_send_email_cb cb, void *userdata)
|
||||
void ios_open_url(char *url)
|
||||
void load_url_webview(char *url, int width, int height)
|
||||
void load_url_webview(char *url, int x, int y, int width, int height)
|
||||
float ios_uiscreen_get_scale()
|
||||
int ios_uiscreen_get_dpi()
|
||||
padding ios_get_safe_area()
|
||||
|
||||
cdef void _send_email_done(char *status, void *data):
|
||||
cdef object callback = <object>data
|
||||
|
@ -27,11 +33,11 @@ cdef void _send_email_done(char *status, void *data):
|
|||
#Support for iOS webview
|
||||
#
|
||||
class IOSWebView(object):
|
||||
def open(self, url, width, height):
|
||||
open_url_wbv(url, width, height)
|
||||
def open(self, url, x, y, width, height):
|
||||
open_url_wbv(url, x, y, width, height)
|
||||
|
||||
|
||||
def open_url_wbv(url, width, height):
|
||||
def open_url_wbv(url, x, y, width, height):
|
||||
'''
|
||||
OPEN URL in webview
|
||||
|
||||
|
@ -45,13 +51,13 @@ def open_url_wbv(url, width, height):
|
|||
`width`: int
|
||||
Width of the window
|
||||
|
||||
Example for opening up a web page in UIWebview::
|
||||
Example for opening up a web page in WKWebview::
|
||||
|
||||
import ios
|
||||
url = "http://www.google.com"
|
||||
ios.IOSWebView().open(url, width, height)
|
||||
ios.IOSWebView().open(url, x, y, width, height)
|
||||
'''
|
||||
load_url_webview(url, width, height)
|
||||
load_url_webview(url, x, y, width, height)
|
||||
|
||||
#
|
||||
# Support for webbrowser module
|
||||
|
@ -206,6 +212,11 @@ def get_dpi():
|
|||
'''
|
||||
return ios_uiscreen_get_dpi()
|
||||
|
||||
def get_safe_area():
|
||||
'''Return the safe area bounds
|
||||
'''
|
||||
return ios_get_safe_area()
|
||||
|
||||
|
||||
from pyobjus import autoclass, selector, protocol
|
||||
from pyobjus.protocols import protocols
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#include <WebKit/WebKit.h>
|
||||
#include "ios_wrapper.h"
|
||||
|
||||
void ios_open_url(char *url)
|
||||
|
@ -15,10 +16,10 @@ void ios_open_url(char *url)
|
|||
/*
|
||||
* Webview support
|
||||
*/
|
||||
void load_url_webview(char *url, int width, int height)
|
||||
void load_url_webview(char *url, int x, int y, int width, int height)
|
||||
{
|
||||
NSString *nsurl = [NSString stringWithCString:(char *)url encoding:NSUTF8StringEncoding];
|
||||
UIWebView *webView = [[UIWebView alloc] initWithFrame: CGRectMake(0, 0, width, height)];
|
||||
WKWebView *webView = [[WKWebView alloc] initWithFrame: CGRectMake(x, y, width, height)];
|
||||
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
|
||||
UIView *view = [window.rootViewController view];
|
||||
[view addSubview:webView];
|
45
kivy_ios/recipes/ios/src/ios_filechooser.m
Normal file
45
kivy_ios/recipes/ios/src/ios_filechooser.m
Normal file
|
@ -0,0 +1,45 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#include "ios_wrapper.h"
|
||||
|
||||
@interface NativeImagePicker : NSObject
|
||||
@end
|
||||
@implementation NativeImagePicker
|
||||
|
||||
- (NSString*) getFileName:(NSURL *) ns_url {
|
||||
// Return the file name without the path or file extention
|
||||
NSString *image_name = ns_url.pathComponents.lastObject;
|
||||
NSArray *listItems = [image_name componentsSeparatedByString:@"."];
|
||||
NSString *ret = listItems[0];
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (NSString*) writeToPNG: (NSDictionary *) info {
|
||||
/* Given the info frozen dictionary returned by the file picker, convert
|
||||
the image selected to a PNG and return the full path. */
|
||||
|
||||
// Get the image name, stripped of path and extention
|
||||
NSString *image_name = [self getFileName: info[UIImagePickerControllerImageURL]];
|
||||
|
||||
// Get the png representation of the image
|
||||
UIImage *image = info[UIImagePickerControllerOriginalImage];
|
||||
NSData *imageData = UIImagePNGRepresentation(image);
|
||||
|
||||
// Generate the final image destination
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||
NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", image_name]];
|
||||
|
||||
// Write the image data to the file
|
||||
if (![imageData writeToFile:imagePath atomically:NO])
|
||||
{
|
||||
NSLog(@"Failed to cache image data to disk");
|
||||
return @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"the cachedImagedPath is %@",imagePath);
|
||||
return imagePath;
|
||||
}
|
||||
}
|
||||
@end
|
|
@ -106,24 +106,4 @@ int ios_send_email(char *subject, char *text, char *mimetype, char *filename,
|
|||
[controller release];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
float ios_uiscreen_get_scale() {
|
||||
float scale = 1.0;
|
||||
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
|
||||
scale = [[UIScreen mainScreen] scale];
|
||||
};
|
||||
return scale;
|
||||
}
|
||||
|
||||
int ios_uiscreen_get_dpi() {
|
||||
float scale = ios_uiscreen_get_scale();
|
||||
float dpi = 160 * scale;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
dpi = 132 * scale;
|
||||
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
dpi = 163 * scale;
|
||||
}
|
||||
return dpi;
|
||||
}
|
||||
}
|
163
kivy_ios/recipes/ios/src/ios_utils.m
Normal file
163
kivy_ios/recipes/ios/src/ios_utils.m
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* iOS utils
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <sys/utsname.h>
|
||||
#include "ios_wrapper.h"
|
||||
|
||||
|
||||
float ios_uiscreen_get_scale() {
|
||||
float scale = 1.0;
|
||||
if ([[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)]) {
|
||||
scale = [[UIScreen mainScreen] nativeScale];
|
||||
};
|
||||
return scale;
|
||||
}
|
||||
|
||||
int ios_uiscreen_get_dpi() {
|
||||
/*
|
||||
* dpi function from src/video/uikit/SDL_uikitmodes.m (SDL2)
|
||||
*/
|
||||
|
||||
/*
|
||||
* A well up to date list of device info can be found here:
|
||||
* https://github.com/lmirosevic/GBDeviceInfo/blob/master/GBDeviceInfo/GBDeviceInfo_iOS.m
|
||||
*/
|
||||
NSDictionary* devices = @{
|
||||
@"iPhone1,1": @163,
|
||||
@"iPhone1,2": @163,
|
||||
@"iPhone2,1": @163,
|
||||
@"iPhone3,1": @326,
|
||||
@"iPhone3,2": @326,
|
||||
@"iPhone3,3": @326,
|
||||
@"iPhone4,1": @326,
|
||||
@"iPhone5,1": @326,
|
||||
@"iPhone5,2": @326,
|
||||
@"iPhone5,3": @326,
|
||||
@"iPhone5,4": @326,
|
||||
@"iPhone6,1": @326,
|
||||
@"iPhone6,2": @326,
|
||||
@"iPhone7,1": @401,
|
||||
@"iPhone7,2": @326,
|
||||
@"iPhone8,1": @326,
|
||||
@"iPhone8,2": @401,
|
||||
@"iPhone8,4": @326,
|
||||
@"iPhone9,1": @326,
|
||||
@"iPhone9,2": @401,
|
||||
@"iPhone9,3": @326,
|
||||
@"iPhone9,4": @401,
|
||||
@"iPhone10,1": @326,
|
||||
@"iPhone10,2": @401,
|
||||
@"iPhone10,3": @458,
|
||||
@"iPhone10,4": @326,
|
||||
@"iPhone10,5": @401,
|
||||
@"iPhone10,6": @458,
|
||||
@"iPhone11,2": @458,
|
||||
@"iPhone11,4": @458,
|
||||
@"iPhone11,6": @458,
|
||||
@"iPhone11,8": @326,
|
||||
@"iPhone12,1": @326,
|
||||
@"iPhone12,3": @458,
|
||||
@"iPhone12,5": @458,
|
||||
@"iPad1,1": @132,
|
||||
@"iPad2,1": @132,
|
||||
@"iPad2,2": @132,
|
||||
@"iPad2,3": @132,
|
||||
@"iPad2,4": @132,
|
||||
@"iPad2,5": @163,
|
||||
@"iPad2,6": @163,
|
||||
@"iPad2,7": @163,
|
||||
@"iPad3,1": @264,
|
||||
@"iPad3,2": @264,
|
||||
@"iPad3,3": @264,
|
||||
@"iPad3,4": @264,
|
||||
@"iPad3,5": @264,
|
||||
@"iPad3,6": @264,
|
||||
@"iPad4,1": @264,
|
||||
@"iPad4,2": @264,
|
||||
@"iPad4,3": @264,
|
||||
@"iPad4,4": @326,
|
||||
@"iPad4,5": @326,
|
||||
@"iPad4,6": @326,
|
||||
@"iPad4,7": @326,
|
||||
@"iPad4,8": @326,
|
||||
@"iPad4,9": @326,
|
||||
@"iPad5,1": @326,
|
||||
@"iPad5,2": @326,
|
||||
@"iPad5,3": @264,
|
||||
@"iPad5,4": @264,
|
||||
@"iPad6,3": @264,
|
||||
@"iPad6,4": @264,
|
||||
@"iPad6,7": @264,
|
||||
@"iPad6,8": @264,
|
||||
@"iPad6,11": @264,
|
||||
@"iPad6,12": @264,
|
||||
@"iPad7,1": @264,
|
||||
@"iPad7,2": @264,
|
||||
@"iPad7,3": @264,
|
||||
@"iPad7,4": @264,
|
||||
@"iPad7,5": @264,
|
||||
@"iPad7,6": @264,
|
||||
@"iPad7,11": @264,
|
||||
@"iPad7,12": @264,
|
||||
@"iPad8,1": @264,
|
||||
@"iPad8,2": @264,
|
||||
@"iPad8,3": @264,
|
||||
@"iPad8,4": @264,
|
||||
@"iPad8,5": @264,
|
||||
@"iPad8,6": @264,
|
||||
@"iPad8,7": @264,
|
||||
@"iPad8,8": @264,
|
||||
@"iPad11,1": @326,
|
||||
@"iPad11,2": @326,
|
||||
@"iPad11,3": @326,
|
||||
@"iPad11,4": @326,
|
||||
@"iPod1,1": @163,
|
||||
@"iPod2,1": @163,
|
||||
@"iPod3,1": @163,
|
||||
@"iPod4,1": @326,
|
||||
@"iPod5,1": @326,
|
||||
@"iPod7,1": @326,
|
||||
@"iPod9,1": @326,
|
||||
};
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
NSString* deviceName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
|
||||
id foundDPI = devices[deviceName];
|
||||
if (foundDPI) {
|
||||
return (float)[foundDPI integerValue];
|
||||
} else {
|
||||
/*
|
||||
* Estimate the DPI based on the screen scale multiplied by the base DPI for the device
|
||||
* type (e.g. based on iPhone 1 and iPad 1)
|
||||
*/
|
||||
float scale = ios_uiscreen_get_scale();
|
||||
float dpi = 160 * scale;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
dpi = 132 * scale;
|
||||
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
dpi = 163 * scale;
|
||||
}
|
||||
return dpi;
|
||||
}
|
||||
}
|
||||
|
||||
padding ios_get_safe_area() {
|
||||
padding safearea;
|
||||
if (@available(iOS 11.0, *)){
|
||||
UIWindow *window = UIApplication.sharedApplication.windows[0];
|
||||
safearea.top = window.safeAreaInsets.top;
|
||||
safearea.bottom = window.safeAreaInsets.bottom;
|
||||
safearea.left = window.safeAreaInsets.left;
|
||||
safearea.right = window.safeAreaInsets.right;
|
||||
} else {
|
||||
safearea.top = 0;
|
||||
safearea.bottom = 0;
|
||||
safearea.left = 0;
|
||||
safearea.right = 0;
|
||||
}
|
||||
return safearea;
|
||||
}
|
|
@ -1,10 +1,18 @@
|
|||
#ifndef __IOS_WRAPPER
|
||||
#define __IOS_WRAPPER
|
||||
|
||||
typedef struct {
|
||||
float top;
|
||||
float bottom;
|
||||
float right;
|
||||
float left;
|
||||
} padding;
|
||||
|
||||
float ios_uiscreen_get_scale(void);
|
||||
int ios_uiscreen_get_dpi(void);
|
||||
padding ios_get_safe_area(void);
|
||||
void ios_open_url(char *url);
|
||||
void load_url_webview(char *url, int width, int height);
|
||||
void load_url_webview(char *url, int x, int y, int width, int height);
|
||||
|
||||
typedef void (*ios_send_email_cb)(char *, void *);
|
||||
|
14
kivy_ios/recipes/ios/src/setup.py
Executable file
14
kivy_ios/recipes/ios/src/setup.py
Executable file
|
@ -0,0 +1,14 @@
|
|||
from distutils.core import setup, Extension
|
||||
|
||||
|
||||
setup(name='ios',
|
||||
version='1.1',
|
||||
ext_modules=[
|
||||
Extension('ios',
|
||||
['ios.c', 'ios_utils.m', 'ios_mail.m', 'ios_browser.m',
|
||||
'ios_filechooser.m'],
|
||||
libraries=[],
|
||||
library_dirs=[],
|
||||
)
|
||||
]
|
||||
)
|
|
@ -1,24 +1,24 @@
|
|||
# pure-python package, this can be removed when we'll support any python package
|
||||
from toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.context_managers import cd
|
||||
from os.path import join
|
||||
import sh, os
|
||||
import sh
|
||||
|
||||
|
||||
class ItsDangerousRecipe(PythonRecipe):
|
||||
version = "master"
|
||||
version = "1.1.0"
|
||||
url = "https://github.com/mitsuhiko/itsdangerous/archive/{version}.zip"
|
||||
depends = ["python"]
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = arch.get_env()
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
cmd = sh.Command("sed")
|
||||
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python3")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
with cd(build_dir):
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
|
||||
|
||||
recipe = ItsDangerousRecipe()
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
# pure-python package, this can be removed when we'll support any python package
|
||||
from toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh, os
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class Jinja2Recipe(PythonRecipe):
|
||||
version = "master"
|
||||
version = "2.11.2"
|
||||
url = "https://github.com/mitsuhiko/jinja2/archive/{version}.zip"
|
||||
depends = ["python","markupsafe"]
|
||||
depends = ["python", "markupsafe"]
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
|
@ -14,11 +16,9 @@ class Jinja2Recipe(PythonRecipe):
|
|||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = arch.get_env()
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
cmd = sh.Command("sed")
|
||||
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python3")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
|
||||
recipe = Jinja2Recipe()
|
||||
|
||||
recipe = Jinja2Recipe()
|
|
@ -3,10 +3,10 @@ Author: Lawrence Du
|
|||
E-mail: larrydu88@gmail.com
|
||||
"""
|
||||
|
||||
from toolchain import CythonRecipe, shprint
|
||||
from kivy_ios.toolchain import CythonRecipe, shprint
|
||||
import sh
|
||||
from os.path import join
|
||||
from os import environ, chdir
|
||||
from os import chdir
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -16,46 +16,41 @@ class KiventCoreRecipe(CythonRecipe):
|
|||
version = 'master'
|
||||
url = 'https://github.com/kivy/kivent/archive/{version}.zip'
|
||||
name = 'kivent_core'
|
||||
depends = ['libffi','kivy'] #note: unsure if libffi is necessary here
|
||||
pre_build_ext=False
|
||||
depends = ['libffi', 'kivy'] # note: unsure if libffi is necessary here
|
||||
pre_build_ext = False
|
||||
subbuilddir = False
|
||||
cythonize = True
|
||||
pbx_frameworks = ["OpenGLES"] #note: This line may be unnecessary
|
||||
|
||||
pbx_frameworks = ["OpenGLES"] # note: This line may be unnecessary
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(KiventCoreRecipe,self).get_recipe_env(arch)
|
||||
env = super(KiventCoreRecipe, self).get_recipe_env(arch)
|
||||
env['CYTHONPATH'] = self.get_recipe(
|
||||
'kivy', self.ctx).get_build_dir(arch.arch)
|
||||
return env
|
||||
|
||||
|
||||
def get_build_dir(self,arch, sub=False):
|
||||
def get_build_dir(self, arch, sub=False):
|
||||
"""
|
||||
Call this to get the correct build_dir, where setup.py is located which is
|
||||
actually under modules/core/setup.py
|
||||
"""
|
||||
builddir = super(KiventCoreRecipe, self).get_build_dir(str(arch))
|
||||
if sub or self.subbuilddir:
|
||||
core_build_dir = join (builddir, 'modules', 'core')
|
||||
core_build_dir = join(builddir, 'modules', 'core')
|
||||
logger.info("Core build directory is located at {}".format(core_build_dir))
|
||||
return core_build_dir
|
||||
else:
|
||||
logger.info("Building in {}".format(builddir))
|
||||
return builddir
|
||||
|
||||
|
||||
def build_arch(self, arch):
|
||||
"""
|
||||
Override build.arch to avoid calling setup.py here (Call it in
|
||||
install() instead).
|
||||
"""
|
||||
|
||||
self.subbuildir = True
|
||||
self.cythonize_build()
|
||||
self.biglink()
|
||||
self.subbuilddir=False
|
||||
|
||||
self.subbuilddir = False
|
||||
|
||||
def install(self):
|
||||
"""
|
||||
|
@ -63,7 +58,7 @@ class KiventCoreRecipe(CythonRecipe):
|
|||
kivent_core/modules/core/setup.py
|
||||
|
||||
This constructs the equivalent of the command
|
||||
"$python2.7 setup.py build_ext install"
|
||||
"$python setup.py build_ext install"
|
||||
only with the environment variables altered for each different architecture
|
||||
The appropriate version of kivy also needs to be added to the path, and this
|
||||
differs for each architecture (i386, x86_64, armv7, etc)
|
||||
|
@ -73,35 +68,35 @@ class KiventCoreRecipe(CythonRecipe):
|
|||
"""
|
||||
arch = list(self.filtered_archs)[0]
|
||||
|
||||
build_dir = self.get_build_dir(arch.arch,sub=True)
|
||||
logger.info("Building kivent_core {} in {}".format(arch.arch,build_dir))
|
||||
build_dir = self.get_build_dir(arch.arch, sub=True)
|
||||
logger.info("Building kivent_core {} in {}".format(arch.arch, build_dir))
|
||||
chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
|
||||
#Get the appropriate environment for this recipe (including CYTHONPATH)
|
||||
#build_env = arch.get_env()
|
||||
# Get the appropriate environment for this recipe (including CYTHONPATH)
|
||||
# build_env = arch.get_env()
|
||||
build_env = self.get_recipe_env(arch)
|
||||
|
||||
dest_dir = join (self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages')
|
||||
|
||||
#Add Architecture specific kivy path for 'import kivy' to PYTHONPATH
|
||||
# Add Architecture specific kivy path for 'import kivy' to PYTHONPATH
|
||||
arch_kivy_path = self.get_recipe('kivy', self.ctx).get_build_dir(arch.arch)
|
||||
build_env['PYTHONPATH'] = join( build_env['PYTHONPATH'],':',arch_kivy_path)
|
||||
build_env['PYTHONPATH'] = join(build_env['PYTHONPATH'], ':', arch_kivy_path)
|
||||
|
||||
#Make sure you call kivent_core/modules/core/setup.py
|
||||
subdir_path = self.get_build_dir(str(arch),sub=True)
|
||||
setup_path = join(subdir_path,"setup.py")
|
||||
# Make sure you call kivent_core/modules/core/setup.py
|
||||
subdir_path = self.get_build_dir(str(arch), sub=True)
|
||||
setup_path = join(subdir_path, "setup.py")
|
||||
|
||||
|
||||
#Print out directories for sanity check
|
||||
# Print out directories for sanity check
|
||||
logger.info("ENVS", build_env)
|
||||
logger.info("ROOT",self.ctx.root_dir)
|
||||
logger.info("BUILD",self.ctx.build_dir)
|
||||
logger.info("ROOT", self.ctx.root_dir)
|
||||
logger.info("BUILD", self.ctx.build_dir)
|
||||
logger.info("INCLUDE", self.ctx.include_dir)
|
||||
logger.info("DISTDIR", self.ctx.dist_dir)
|
||||
logger.info("ARCH KIVY LOC",self.get_recipe('kivy', self.ctx).get_build_dir(arch.arch))
|
||||
logger.info("ARCH KIVY LOC", self.get_recipe('kivy', self.ctx).get_build_dir(arch.arch))
|
||||
|
||||
shprint(hostpython, setup_path, "build_ext", "install", _env=build_env)
|
||||
|
||||
|
||||
recipe = KiventCoreRecipe()
|
|
@ -1,18 +1,29 @@
|
|||
from toolchain import CythonRecipe
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
from os.path import join
|
||||
import logging
|
||||
import shutil
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class KivyRecipe(CythonRecipe):
|
||||
version = "1.10.1"
|
||||
"""
|
||||
post kivy 2.0.0rc1
|
||||
Includes these iOS specific fixes:
|
||||
- Statusbar / Fullscreen fix (PR #4589)
|
||||
- Extend usage of certifi on iOS (PR #4648)
|
||||
"""
|
||||
version = "067064c23a275187e67f1c9d7de7cc06f384af4d"
|
||||
url = "https://github.com/kivy/kivy/archive/{version}.zip"
|
||||
library = "libkivy.a"
|
||||
depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",
|
||||
"pyobjus", "python"]
|
||||
pbx_frameworks = ["OpenGLES", "Accelerate"]
|
||||
"pyobjus", "python", "host_setuptools3"]
|
||||
python_depends = ["certifi"]
|
||||
pbx_frameworks = ["OpenGLES", "Accelerate", "CoreMedia", "CoreVideo"]
|
||||
pre_build_ext = True
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(KivyRecipe, self).get_recipe_env(arch)
|
||||
env = super().get_recipe_env(arch)
|
||||
env["KIVY_SDL2_PATH"] = ":".join([
|
||||
join(self.ctx.dist_dir, "include", "common", "sdl2"),
|
||||
join(self.ctx.dist_dir, "include", "common", "sdl2_image"),
|
||||
|
@ -36,11 +47,12 @@ class KivyRecipe(CythonRecipe):
|
|||
|
||||
def build_arch(self, arch):
|
||||
self._patch_setup()
|
||||
super(KivyRecipe, self).build_arch(arch)
|
||||
super().build_arch(arch)
|
||||
|
||||
def _patch_setup(self):
|
||||
# patch setup to remove some functionnalities
|
||||
pyconfig = join(self.build_dir, "setup.py")
|
||||
|
||||
def _remove_line(lines, pattern):
|
||||
for line in lines[:]:
|
||||
if pattern in line:
|
||||
|
@ -48,9 +60,13 @@ class KivyRecipe(CythonRecipe):
|
|||
with open(pyconfig) as fd:
|
||||
lines = fd.readlines()
|
||||
_remove_line(lines, "flags['libraries'] = ['GLESv2']")
|
||||
#_remove_line(lines, "c_options['use_sdl'] = True")
|
||||
with open(pyconfig, "w") as fd:
|
||||
fd.writelines(lines)
|
||||
|
||||
def reduce_python_package(self):
|
||||
dest_dir = join(self.ctx.site_packages_dir, "kivy")
|
||||
shutil.rmtree(join(dest_dir, "tools"))
|
||||
shutil.rmtree(join(dest_dir, "tests"))
|
||||
|
||||
|
||||
recipe = KivyRecipe()
|
29
kivy_ios/recipes/libcurl/__init__.py
Normal file
29
kivy_ios/recipes/libcurl/__init__.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class CurlRecipe(Recipe):
|
||||
version = "7.65.3"
|
||||
url = "https://curl.haxx.se/download/curl-{version}.tar.gz"
|
||||
library = "lib/.libs/libcurl.a"
|
||||
include_dir = "include"
|
||||
depends = ["openssl"]
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = arch.get_env()
|
||||
configure = sh.Command(join(self.build_dir, "configure"))
|
||||
shprint(configure,
|
||||
"CC={}".format(build_env["CC"]),
|
||||
"LD={}".format(build_env["LD"]),
|
||||
"CFLAGS={}".format(build_env["CFLAGS"]),
|
||||
"LDFLAGS={}".format(build_env["LDFLAGS"]),
|
||||
"--prefix=/",
|
||||
"--host={}".format(arch.triple),
|
||||
"--disable-shared",
|
||||
"--without-libidn2")
|
||||
shprint(sh.make, "clean")
|
||||
shprint(sh.make, self.ctx.concurrent_make)
|
||||
|
||||
|
||||
recipe = CurlRecipe()
|
|
@ -1,12 +1,11 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
import sh
|
||||
from os.path import exists
|
||||
|
||||
|
||||
class LibffiRecipe(Recipe):
|
||||
version = "3.2.1"
|
||||
# url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
|
||||
url = "https://www.mirrorservice.org/sites/sourceware.org/pub/libffi/libffi-{version}.tar.gz"
|
||||
url = "https://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
|
||||
library = "build/Release-{arch.sdk}/libffi.a"
|
||||
include_per_arch = True
|
||||
include_dir = "build_{arch.sdk}-{arch.arch}/include"
|
||||
|
@ -22,6 +21,7 @@ class LibffiRecipe(Recipe):
|
|||
"s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=8.0/g",
|
||||
"generate-darwin-source-and-headers.py")
|
||||
self.apply_patch("fix-win32-unreferenced-symbol.patch")
|
||||
self.apply_patch("generate-darwin-source-and-headers-python3-items.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def build_arch(self, arch):
|
||||
|
@ -31,8 +31,8 @@ class LibffiRecipe(Recipe):
|
|||
"generate-darwin-source-and-headers.py",
|
||||
"_generate-darwin-source-and-headers.py")
|
||||
shprint(sh.touch, "generate-darwin-source-and-headers.py")
|
||||
python27 = sh.Command("python2.7")
|
||||
shprint(python27, "_generate-darwin-source-and-headers.py", "--only-ios")
|
||||
python3 = sh.Command("python3")
|
||||
shprint(python3, "_generate-darwin-source-and-headers.py", "--only-ios")
|
||||
shprint(sh.xcodebuild, self.ctx.concurrent_xcodebuild,
|
||||
"ONLY_ACTIVE_ARCH=NO",
|
||||
"ARCHS={}".format(arch.arch),
|
|
@ -0,0 +1,12 @@
|
|||
diff -Nru libffi-3.2.1/generate-darwin-source-and-headers.py libffi-3.2.1-new/generate-darwin-source-and-headers.py
|
||||
--- libffi-3.2.1/generate-darwin-source-and-headers.py 2014-11-08 13:47:24.000000000 +0100
|
||||
+++ libffi-3.2.1-new/generate-darwin-source-and-headers.py 2020-05-06 10:30:46.000000000 +0200
|
||||
@@ -194,7 +194,7 @@
|
||||
build_target(desktop64_platform, platform_headers)
|
||||
|
||||
mkdir_p('darwin_common/include')
|
||||
- for header_name, tag_tuples in platform_headers.iteritems():
|
||||
+ for header_name, tag_tuples in platform_headers.items():
|
||||
basename, suffix = os.path.splitext(header_name)
|
||||
with open(os.path.join('darwin_common/include', header_name), 'w') as header:
|
||||
for tag_tuple in tag_tuples:
|
|
@ -1,7 +1,6 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class JpegRecipe(Recipe):
|
||||
|
@ -16,7 +15,6 @@ class JpegRecipe(Recipe):
|
|||
]
|
||||
include_per_arch = True
|
||||
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = arch.get_env()
|
||||
configure = sh.Command(join(self.build_dir, "configure"))
|
||||
|
@ -31,6 +29,5 @@ class JpegRecipe(Recipe):
|
|||
shprint(sh.make, "clean")
|
||||
shprint(sh.make, self.ctx.concurrent_make)
|
||||
|
||||
|
||||
recipe = JpegRecipe()
|
||||
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from toolchain import Recipe, shprint
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class PngRecipe(Recipe):
|
||||
version = '1.6.26'
|
||||
url = 'http://downloads.sourceforge.net/sourceforge/libpng/libpng-{version}.tar.gz'
|
||||
|
@ -23,4 +24,5 @@ class PngRecipe(Recipe):
|
|||
shprint(sh.make, "clean")
|
||||
shprint(sh.make, self.ctx.concurrent_make, _env=build_env)
|
||||
|
||||
|
||||
recipe = PngRecipe()
|
58
kivy_ios/recipes/libzbar/__init__.py
Executable file
58
kivy_ios/recipes/libzbar/__init__.py
Executable file
|
@ -0,0 +1,58 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class LibZBarRecipe(Recipe):
|
||||
|
||||
version = '0.10'
|
||||
|
||||
url = 'https://github.com/ZBar/ZBar/archive/{version}.zip'
|
||||
|
||||
depends = ['hostpython3']
|
||||
|
||||
library = 'zbar/.libs/libzbar.a'
|
||||
|
||||
include_per_arch = True
|
||||
include_dir = [
|
||||
("include", "")
|
||||
]
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.apply_patch("werror.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def build_arch(self, arch):
|
||||
super(LibZBarRecipe, self).build_arch(arch)
|
||||
build_env = arch.get_env()
|
||||
build_env["CFLAGS"] = " ".join([
|
||||
"-I{}".format(join(self.ctx.dist_dir, "build", "libiconv", arch.arch)) +
|
||||
" -arch {}".format(arch.arch), build_env['CFLAGS']
|
||||
])
|
||||
shprint(sh.Command('autoreconf'), '-vif')
|
||||
shprint(
|
||||
sh.Command('./configure'),
|
||||
"CC={}".format(build_env["CC"]),
|
||||
"LD={}".format(build_env["LD"]),
|
||||
"CFLAGS={}".format(build_env["CFLAGS"]),
|
||||
"LDFLAGS={}".format(build_env["LDFLAGS"]),
|
||||
"--host={}".format(arch.triple),
|
||||
'--target={}'.format(arch.triple),
|
||||
# Python bindings are compiled in a separated recipe
|
||||
'--with-python=no',
|
||||
'--with-gtk=no',
|
||||
'--with-qt=no',
|
||||
'--with-x=no',
|
||||
'--with-jpeg=no',
|
||||
'--with-imagemagick=no',
|
||||
'--enable-pthread=no',
|
||||
'--enable-video=no',
|
||||
"--disable-shared",
|
||||
_env=build_env)
|
||||
shprint(sh.make, 'clean')
|
||||
shprint(sh.make, _env=build_env)
|
||||
|
||||
|
||||
recipe = LibZBarRecipe()
|
13
kivy_ios/recipes/libzbar/werror.patch
Executable file
13
kivy_ios/recipes/libzbar/werror.patch
Executable file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/configure.ac b/configure.ac
|
||||
index 256aedb..727caba 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -3,7 +3,7 @@ AC_PREREQ([2.61])
|
||||
AC_INIT([zbar], [0.10], [spadix@users.sourceforge.net])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_MACRO_DIR(config)
|
||||
-AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects std-options dist-bzip2])
|
||||
+AM_INIT_AUTOMAKE([1.10 -Wall foreign subdir-objects std-options dist-bzip2])
|
||||
AC_CONFIG_HEADERS([include/config.h])
|
||||
AC_CONFIG_SRCDIR(zbar/scanner.c)
|
||||
LT_PREREQ([2.2])
|
|
@ -1,10 +1,12 @@
|
|||
# pure-python package, this can be removed when we'll support any python package
|
||||
from toolchain import PythonRecipe, shprint
|
||||
from kivy_ios.toolchain import PythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh, os
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class MarkupSafeRecipe(PythonRecipe):
|
||||
version = "master"
|
||||
version = "1.1.1"
|
||||
url = "https://github.com/mitsuhiko/markupsafe/archive/{version}.zip"
|
||||
depends = ["python"]
|
||||
|
||||
|
@ -14,15 +16,13 @@ class MarkupSafeRecipe(PythonRecipe):
|
|||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = arch.get_env()
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python3")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
cmd = sh.Command("sed")
|
||||
shprint(cmd, "-i", "", "s/,.*Feature//g", "./setup.py", _env=build_env)
|
||||
shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
|
||||
shprint(cmd, "-i", "", "/^speedups = Feature/,/^)$/s/.*//g", "./setup.py", _env=build_env)
|
||||
shprint(cmd, "-i", "", "s/features\['speedups'\].*=.*speedups/pass/g", "./setup.py", _env=build_env)
|
||||
shprint(cmd, "-i", "", "s/features\['speedups'\].*=.*speedups/pass/g", "./setup.py", _env=build_env) # noqa: W605
|
||||
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
|
||||
|
||||
|
||||
recipe = MarkupSafeRecipe()
|
||||
|
43
kivy_ios/recipes/netifaces/__init__.py
Normal file
43
kivy_ios/recipes/netifaces/__init__.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
import sh
|
||||
|
||||
from os.path import join
|
||||
|
||||
from kivy_ios.toolchain import CythonRecipe, shprint
|
||||
from kivy_ios.context_managers import cd
|
||||
|
||||
|
||||
class NetifacesRecipe(CythonRecipe):
|
||||
version = "0.10.9"
|
||||
url = "https://pypi.io/packages/source/n/netifaces/netifaces-{version}.tar.gz"
|
||||
depends = ["python3", "host_setuptools3"]
|
||||
python_depends = ["setuptools"]
|
||||
library = "libnetifaces.a"
|
||||
cythonize = False
|
||||
|
||||
def dest_dir(self):
|
||||
return join(self.ctx.dist_dir, "root", "python3")
|
||||
|
||||
def get_netifaces_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["PYTHONPATH"] = join(
|
||||
self.dest_dir(), "lib", "python3.8", "site-packages"
|
||||
)
|
||||
return build_env
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
build_env = self.get_netifaces_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
with cd(build_dir):
|
||||
shprint(
|
||||
hostpython,
|
||||
"setup.py",
|
||||
"install",
|
||||
"--prefix",
|
||||
self.dest_dir(),
|
||||
_env=build_env,
|
||||
)
|
||||
|
||||
|
||||
recipe = NetifacesRecipe()
|
|
@ -1,12 +1,12 @@
|
|||
from toolchain import CythonRecipe
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
from os.path import join
|
||||
import sh
|
||||
import shutil
|
||||
|
||||
|
||||
class NumpyRecipe(CythonRecipe):
|
||||
version = "1.9.1"
|
||||
url = "https://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz"
|
||||
version = "1.16.4"
|
||||
url = "https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip"
|
||||
library = "libnumpy.a"
|
||||
libraries = ["libnpymath.a", "libnpysort.a"]
|
||||
include_dir = "numpy/core/include"
|
||||
|
@ -17,11 +17,11 @@ class NumpyRecipe(CythonRecipe):
|
|||
def prebuild_arch(self, arch):
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.apply_patch("numpy-1.9.1.patch")
|
||||
self.apply_patch("numpy-1.16.4.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(NumpyRecipe, self).get_recipe_env(arch)
|
||||
env = super().get_recipe_env(arch)
|
||||
# CC must have the CFLAGS with arm arch, because numpy tries first to
|
||||
# compile and execute an empty C to see if the compiler works. This is
|
||||
# obviously not working when crosscompiling
|
||||
|
@ -32,7 +32,7 @@ class NumpyRecipe(CythonRecipe):
|
|||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
super(NumpyRecipe, self).build_arch(arch)
|
||||
super().build_arch(arch)
|
||||
sh.cp(sh.glob(join(self.build_dir, "build", "temp.*", "libnpy*.a")),
|
||||
self.build_dir)
|
||||
|
||||
|
@ -51,4 +51,5 @@ class NumpyRecipe(CythonRecipe):
|
|||
shutil.rmtree(join(dest_dir, "random", "tests"))
|
||||
shutil.rmtree(join(dest_dir, "tests"))
|
||||
|
||||
|
||||
recipe = NumpyRecipe()
|
128
kivy_ios/recipes/numpy/numpy-1.16.4.patch
Normal file
128
kivy_ios/recipes/numpy/numpy-1.16.4.patch
Normal file
|
@ -0,0 +1,128 @@
|
|||
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
|
||||
index aad0aae43..407e64fe3 100644
|
||||
--- a/numpy/core/setup.py
|
||||
+++ b/numpy/core/setup.py
|
||||
@@ -757,7 +757,9 @@ def configuration(parent_package='',top_path=None):
|
||||
join('src', 'common', 'numpyos.c'),
|
||||
]
|
||||
|
||||
- blas_info = get_info('blas_opt', 0)
|
||||
+ # XXX IOS, no blas available
|
||||
+ # blas_info = get_info('blas_opt', 0)
|
||||
+ blas_info = None
|
||||
if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []):
|
||||
extra_info = blas_info
|
||||
# These files are also in MANIFEST.in so that they are always in
|
||||
@@ -822,7 +824,10 @@ def configuration(parent_package='',top_path=None):
|
||||
join('include', 'numpy', 'npy_1_7_deprecated_api.h'),
|
||||
# add library sources as distuils does not consider libraries
|
||||
# dependencies
|
||||
- ] + npysort_sources + npymath_sources
|
||||
+
|
||||
+ # XXX This breaks for iOS, it results on duplicate symbols
|
||||
+ # ] + npysort_sources + npymath_sources
|
||||
+ ] #+ npysort_sources + npymath_sources
|
||||
|
||||
multiarray_src = [
|
||||
join('src', 'multiarray', 'alloc.c'),
|
||||
@@ -921,7 +926,7 @@ def configuration(parent_package='',top_path=None):
|
||||
|
||||
config.add_extension('_multiarray_umath',
|
||||
sources=multiarray_src + umath_src +
|
||||
- npymath_sources + common_src +
|
||||
+ common_src +
|
||||
[generate_config_h,
|
||||
generate_numpyconfig_h,
|
||||
generate_numpy_api,
|
||||
diff --git a/numpy/linalg/lapack_lite/python_xerbla.c b/numpy/linalg/lapack_lite/python_xerbla.c
|
||||
index dfc195556..7110d1fc3 100644
|
||||
--- a/numpy/linalg/lapack_lite/python_xerbla.c
|
||||
+++ b/numpy/linalg/lapack_lite/python_xerbla.c
|
||||
@@ -20,7 +20,7 @@
|
||||
info: Number of the invalid parameter.
|
||||
*/
|
||||
|
||||
-int xerbla_(char *srname, integer *info)
|
||||
+int custom_xerbla_(char *srname, integer *info)
|
||||
{
|
||||
static const char format[] = "On entry to %.*s" \
|
||||
" parameter number %d had an illegal value";
|
||||
diff --git a/numpy/linalg/lapack_litemodule.c b/numpy/linalg/lapack_litemodule.c
|
||||
index 696a6d874..d187ad2d1 100644
|
||||
--- a/numpy/linalg/lapack_litemodule.c
|
||||
+++ b/numpy/linalg/lapack_litemodule.c
|
||||
@@ -45,7 +45,7 @@ extern int FNAME(zungqr)(int *m, int *n, int *k, f2c_doublecomplex a[],
|
||||
int *lda, f2c_doublecomplex tau[],
|
||||
f2c_doublecomplex work[], int *lwork, int *info);
|
||||
|
||||
-extern int FNAME(xerbla)(char *srname, int *info);
|
||||
+extern int FNAME(custom_xerbla)(char *srname, int *info);
|
||||
|
||||
static PyObject *LapackError;
|
||||
|
||||
@@ -291,7 +291,7 @@ lapack_lite_xerbla(PyObject *NPY_UNUSED(self), PyObject *args)
|
||||
|
||||
NPY_BEGIN_THREADS_DEF;
|
||||
NPY_BEGIN_THREADS;
|
||||
- FNAME(xerbla)("test", &info);
|
||||
+ FNAME(custom_xerbla)("test", &info);
|
||||
NPY_END_THREADS;
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
diff --git a/numpy/linalg/setup.py b/numpy/linalg/setup.py
|
||||
index 66c07c9e1..6f81243be 100644
|
||||
--- a/numpy/linalg/setup.py
|
||||
+++ b/numpy/linalg/setup.py
|
||||
@@ -48,7 +48,7 @@ def configuration(parent_package='', top_path=None):
|
||||
# umath_linalg module
|
||||
config.add_extension(
|
||||
'_umath_linalg',
|
||||
- sources=['umath_linalg.c.src', get_lapack_lite_sources],
|
||||
+ sources=['umath_linalg.c.src', lambda e, b: []],
|
||||
depends=['lapack_lite/f2c.h'],
|
||||
extra_info=lapack_info,
|
||||
libraries=['npymath'],
|
||||
diff --git a/numpy/linalg/umath_linalg.c.src b/numpy/linalg/umath_linalg.c.src
|
||||
index 9fc68a7aa..270c9bc32 100644
|
||||
--- a/numpy/linalg/umath_linalg.c.src
|
||||
+++ b/numpy/linalg/umath_linalg.c.src
|
||||
@@ -68,6 +68,8 @@ dbg_stack_trace()
|
||||
# define FNAME(x) x##_
|
||||
#endif
|
||||
|
||||
+# define FNAME_APPLE(x) cblas_##x
|
||||
+
|
||||
typedef struct { float r, i; } f2c_complex;
|
||||
typedef struct { double r, i; } f2c_doublecomplex;
|
||||
/* typedef long int (*L_fp)(); */
|
||||
@@ -284,21 +286,25 @@ FNAME(zpotri)(char *uplo, int *n,
|
||||
int *info);
|
||||
|
||||
extern int
|
||||
-FNAME(scopy)(int *n,
|
||||
+FNAME_APPLE(scopy)(int *n,
|
||||
float *sx, int *incx,
|
||||
float *sy, int *incy);
|
||||
+#define scopy_ FNAME_APPLE(scopy)
|
||||
extern int
|
||||
-FNAME(dcopy)(int *n,
|
||||
+FNAME_APPLE(dcopy)(int *n,
|
||||
double *sx, int *incx,
|
||||
double *sy, int *incy);
|
||||
+#define dcopy_ FNAME_APPLE(dcopy)
|
||||
extern int
|
||||
-FNAME(ccopy)(int *n,
|
||||
+FNAME_APPLE(ccopy)(int *n,
|
||||
f2c_complex *sx, int *incx,
|
||||
f2c_complex *sy, int *incy);
|
||||
+#define ccopy_ FNAME_APPLE(ccopy)
|
||||
extern int
|
||||
-FNAME(zcopy)(int *n,
|
||||
+FNAME_APPLE(zcopy)(int *n,
|
||||
f2c_doublecomplex *sx, int *incx,
|
||||
- f2c_doublecomplex *sy, int *incy);
|
||||
+ f2c_doublecomplex *sy, int *incy);
|
||||
+#define zcopy_ FNAME_APPLE(zcopy)
|
||||
|
||||
extern float
|
||||
FNAME(sdot)(int *n,
|
36
kivy_ios/recipes/openssl/__init__.py
Normal file
36
kivy_ios/recipes/openssl/__init__.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
arch_mapper = {'i386': 'darwin-i386-cc',
|
||||
'x86_64': 'darwin64-x86_64-cc',
|
||||
'armv7': 'ios-cross',
|
||||
'arm64': 'ios64-cross'}
|
||||
|
||||
|
||||
class OpensslRecipe(Recipe):
|
||||
version = "1.1.1f"
|
||||
url = "http://www.openssl.org/source/openssl-{version}.tar.gz"
|
||||
libraries = ["libssl.a", "libcrypto.a"]
|
||||
include_dir = "include"
|
||||
include_per_arch = True
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = arch.get_env()
|
||||
target = arch_mapper[arch.arch]
|
||||
shprint(sh.env, _env=build_env)
|
||||
sh.perl(join(self.build_dir, "Configure"),
|
||||
target,
|
||||
_env=build_env)
|
||||
if target.endswith('-cross'):
|
||||
with open('Makefile', 'r') as makefile:
|
||||
filedata = makefile.read()
|
||||
filedata = filedata.replace('$(CROSS_TOP)/SDKs/$(CROSS_SDK)', arch.sysroot)
|
||||
with open('Makefile', 'w') as makefile:
|
||||
makefile.write(filedata)
|
||||
shprint(sh.make, "clean")
|
||||
shprint(sh.make, self.ctx.concurrent_make, "build_libs")
|
||||
|
||||
|
||||
recipe = OpensslRecipe()
|
|
@ -1,4 +1,4 @@
|
|||
from toolchain import CythonRecipe
|
||||
from kivy_ios.toolchain import CythonRecipe
|
||||
|
||||
|
||||
class PhotoRecipe(CythonRecipe):
|
||||
|
@ -11,6 +11,5 @@ class PhotoRecipe(CythonRecipe):
|
|||
def install(self):
|
||||
self.install_python_package(name="photolibrary.so", is_dir=False)
|
||||
|
||||
|
||||
recipe = PhotoRecipe()
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from kivy_ios.toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
|
@ -6,11 +6,11 @@ import fnmatch
|
|||
|
||||
|
||||
class PillowRecipe(Recipe):
|
||||
version = "2.8.2"
|
||||
version = "6.1.0"
|
||||
url = "https://pypi.python.org/packages/source/P/Pillow/Pillow-{version}.tar.gz"
|
||||
#url = "https://github.com/python-pillow/Pillow/archive/{version}.tar.gz"
|
||||
library = "libpil.a"
|
||||
depends = ["hostpython", "host_setuptools", "pkgresources", "freetype", "libjpeg", "python", "ios"]
|
||||
library = "libpillow.a"
|
||||
depends = ["hostpython3", "host_setuptools3", "freetype", "libjpeg", "python3", "ios"]
|
||||
python_depends = ["setuptools"]
|
||||
pbx_libraries = ["libz", "libbz2"]
|
||||
include_per_arch = True
|
||||
|
||||
|
@ -28,29 +28,25 @@ class PillowRecipe(Recipe):
|
|||
" -I{}".format(join(self.ctx.dist_dir, "include", arch.arch, "libjpeg")) +
|
||||
" -arch {}".format(arch.arch)
|
||||
])
|
||||
build_env['PATH'] = os.environ['PATH']
|
||||
return build_env
|
||||
|
||||
def build_arch(self, arch):
|
||||
self.apply_patch('pil_setup.patch')
|
||||
build_env = self.get_pil_env(arch)
|
||||
#build_dir = self.get_build_dir(arch.arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
#build_env["PYTHONHOME"] = hostpython
|
||||
# first try to generate .h
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
hostpython3 = sh.Command(self.ctx.hostpython)
|
||||
shprint(hostpython3, "setup.py", "build_ext", "--disable-tiff",
|
||||
"--disable-webp", "-g", _env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
hostpython3 = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_pil_env(arch)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
shprint(hostpython, "-m", "easy_install",
|
||||
"--prefix", dest_dir, "-Z", "./",
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python3")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8', 'site-packages')
|
||||
shprint(hostpython3, "setup.py", "install", "--prefix", dest_dir,
|
||||
_env=build_env)
|
||||
|
||||
def biglink(self):
|
||||
|
@ -59,7 +55,7 @@ class PillowRecipe(Recipe):
|
|||
if fnmatch.filter(filenames, "*.so.libs"):
|
||||
dirs.append(root)
|
||||
cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink"))
|
||||
shprint(cmd, join(self.build_dir, "libpil.a"), *dirs)
|
||||
shprint(cmd, join(self.build_dir, "libpillow.a"), *dirs)
|
||||
|
||||
|
||||
recipe = PillowRecipe()
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
from toolchain import PythonRecipe
|
||||
from kivy_ios.toolchain import PythonRecipe
|
||||
|
||||
|
||||
class PlyerRecipe(PythonRecipe):
|
||||
version = "master"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue