add / update recipes and build changes for Python 3.6.6 compatibility (#315)
* add / update recipes and build changes for Python 3.6.6 compatibility * include Python 3 apt packages in travis build script * use Python 3.6 in Travis * Enable _blake2 and _sha3 in Python 3. Remove unnecessary files. * change zope.interface version * update cffi version
This commit is contained in:
parent
f12460e83a
commit
e08f6ee73c
80 changed files with 2063 additions and 3644 deletions
14
.travis.yml
14
.travis.yml
|
@ -1,14 +1,15 @@
|
||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: xenial
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- '2.7'
|
- '3.6'
|
||||||
install:
|
install:
|
||||||
- deactivate
|
- deactivate
|
||||||
- export PATH=/usr/bin:$PATH
|
- export PATH=/usr/bin:$PATH
|
||||||
- sudo dpkg --add-architecture i386
|
- sudo dpkg --add-architecture i386
|
||||||
|
- sudo add-apt-repository ppa:jonathonf/python-3.6 -y
|
||||||
- sudo apt-get -qq update
|
- sudo apt-get -qq update
|
||||||
- sudo apt-get -qq install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
|
- sudo apt-get -qq install build-essential python3.6 python3.6-dev python3.6-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
|
||||||
- sudo pip install --upgrade cython==0.25.2 pip setuptools
|
- sudo pip install --upgrade cython==0.25.2 pip setuptools
|
||||||
- wget -q https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
|
- wget -q https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
|
||||||
- tar -xf node-v8.11.1-linux-x64.tar.xz
|
- tar -xf node-v8.11.1-linux-x64.tar.xz
|
||||||
|
@ -26,11 +27,14 @@ install:
|
||||||
- cd ..
|
- cd ..
|
||||||
- mv buildozer.spec.travis buildozer.spec
|
- mv buildozer.spec.travis buildozer.spec
|
||||||
- mkdir -p cd ~/.buildozer/android/platform/
|
- mkdir -p cd ~/.buildozer/android/platform/
|
||||||
- wget -q 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P ~/.buildozer/android/platform/
|
- wget -q 'https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||||
- wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
- wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
||||||
- wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P ~/.buildozer/android/platform/
|
- wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P ~/.buildozer/android/platform/
|
||||||
- wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P ~/.buildozer/android/platform/
|
- wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P ~/.buildozer/android/platform/
|
||||||
- unzip -qq ~/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d ~/.buildozer/android/platform/
|
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||||
|
- cp -f $TRAVIS_BUILD_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||||
|
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||||
|
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||||
- tar -xf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/
|
- tar -xf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/
|
||||||
- mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
- mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||||
- unzip -qq ~/.buildozer/android/platform/platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
- unzip -qq ~/.buildozer/android/platform/platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||||
|
|
11
Vagrantfile
vendored
11
Vagrantfile
vendored
|
@ -43,7 +43,7 @@ Vagrant.configure("2") do |config|
|
||||||
dpkg --add-architecture i386
|
dpkg --add-architecture i386
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y libssl-dev
|
apt-get install -y libssl-dev
|
||||||
apt-get install -y autoconf libffi-dev pkg-config libtool build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 python-pip
|
apt-get install -y python3.6 python3.6-dev python3-pip autoconf libffi-dev pkg-config libtool build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 python-pip
|
||||||
pip install -f --upgrade setuptools pyopenssl
|
pip install -f --upgrade setuptools pyopenssl
|
||||||
git clone https://github.com/lbryio/buildozer.git
|
git clone https://github.com/lbryio/buildozer.git
|
||||||
cd buildozer
|
cd buildozer
|
||||||
|
@ -63,12 +63,15 @@ Vagrant.configure("2") do |config|
|
||||||
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
||||||
|
|
||||||
mkdir -p cd $HOME/.buildozer/android/platform/
|
mkdir -p cd $HOME/.buildozer/android/platform/
|
||||||
wget -q 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P $HOME/.buildozer/android/platform/
|
wget -q 'https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P $HOME/.buildozer/android/
|
||||||
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
||||||
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
||||||
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
||||||
unzip -qq $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d $HOME/.buildozer/android/platform/
|
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C $HOME/.buildozer/android/
|
||||||
rm $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip
|
rm $HOME/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||||
|
ln -s $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||||
|
cp -f $HOME/lbry-android/scripts/build-target-python.sh $HOME/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||||
|
rm -rf $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||||
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
||||||
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
||||||
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.21.2#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
@ -98,16 +98,16 @@ android.minapi = 21
|
||||||
android.sdk = 23
|
android.sdk = 23
|
||||||
|
|
||||||
# (str) Android NDK version to use
|
# (str) Android NDK version to use
|
||||||
android.ndk = 13b
|
#android.ndk = 13b
|
||||||
|
|
||||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||||
#android.private_storage = True
|
#android.private_storage = True
|
||||||
|
|
||||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||||
|
|
||||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.sdk_path = ~/Dev/SDKs/android
|
#android.sdk_path = ~/.buildozer/android
|
||||||
|
|
||||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ant_path =
|
#android.ant_path =
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.21.2#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
@ -98,16 +98,16 @@ android.minapi = 21
|
||||||
android.sdk = 23
|
android.sdk = 23
|
||||||
|
|
||||||
# (str) Android NDK version to use
|
# (str) Android NDK version to use
|
||||||
android.ndk = 13b
|
#android.ndk = 13b
|
||||||
|
|
||||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||||
#android.private_storage = True
|
#android.private_storage = True
|
||||||
|
|
||||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||||
|
|
||||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.sdk_path = ~/Dev/SDKs/android
|
#android.sdk_path = ~/.buildozer/android
|
||||||
|
|
||||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ant_path =
|
#android.ant_path =
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.21.2#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
@ -98,16 +98,16 @@ android.minapi = 21
|
||||||
android.sdk = 23
|
android.sdk = 23
|
||||||
|
|
||||||
# (str) Android NDK version to use
|
# (str) Android NDK version to use
|
||||||
android.ndk = 13b
|
#android.ndk = 13b
|
||||||
|
|
||||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||||
#android.private_storage = True
|
#android.private_storage = True
|
||||||
|
|
||||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||||
|
|
||||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||||
#android.sdk_path = ~/Dev/SDKs/android
|
#android.sdk_path = ~/.buildozer/android
|
||||||
|
|
||||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||||
#android.ant_path =
|
#android.ant_path =
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from os.path import (join, dirname, isdir, splitext, basename, realpath)
|
from os.path import (join, dirname, isdir, splitext, basename)
|
||||||
from os import listdir, mkdir
|
from os import listdir
|
||||||
import sh
|
import sh
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
from pythonforandroid.logger import (warning, shprint, info, logger,
|
from pythonforandroid.logger import (warning, shprint, info, logger,
|
||||||
debug, error)
|
debug)
|
||||||
from pythonforandroid.util import (current_directory, ensure_dir,
|
from pythonforandroid.util import (current_directory, ensure_dir,
|
||||||
temp_directory, which)
|
temp_directory, which)
|
||||||
from pythonforandroid.recipe import Recipe
|
from pythonforandroid.recipe import Recipe
|
||||||
|
|
|
@ -310,7 +310,7 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
|
||||||
setenv("PYTHON_SERVICE_ARGUMENT", arg, 1);
|
setenv("PYTHON_SERVICE_ARGUMENT", arg, 1);
|
||||||
|
|
||||||
char ca_path[128];
|
char ca_path[128];
|
||||||
snprintf(ca_path, 128, "%s/lib/python2.7/site-packages/certifi/cacert.pem", python_home);
|
snprintf(ca_path, 128, "%s/crystax_python/site-packages/certifi/cacert.pem", python_home);
|
||||||
setenv("SSL_CERT_FILE", ca_path, 1);
|
setenv("SSL_CERT_FILE", ca_path, 1);
|
||||||
|
|
||||||
char *argv[] = {"."};
|
char *argv[] = {"."};
|
||||||
|
|
|
@ -396,6 +396,7 @@ class Context(object):
|
||||||
'platforms',
|
'platforms',
|
||||||
'android-{}'.format(self.android_min_api),
|
'android-{}'.format(self.android_min_api),
|
||||||
platform_dir)
|
platform_dir)
|
||||||
|
|
||||||
if not exists(self.ndk_platform):
|
if not exists(self.ndk_platform):
|
||||||
warning('ndk_platform doesn\'t exist: {}'.format(
|
warning('ndk_platform doesn\'t exist: {}'.format(
|
||||||
self.ndk_platform))
|
self.ndk_platform))
|
||||||
|
@ -529,7 +530,7 @@ class Context(object):
|
||||||
if self.python_recipe.from_crystax:
|
if self.python_recipe.from_crystax:
|
||||||
return self.get_python_install_dir()
|
return self.get_python_install_dir()
|
||||||
return join(self.get_python_install_dir(),
|
return join(self.get_python_install_dir(),
|
||||||
'lib', 'python2.7', 'site-packages')
|
'lib', 'python3.6', 'site-packages')
|
||||||
|
|
||||||
def get_libs_dir(self, arch):
|
def get_libs_dir(self, arch):
|
||||||
'''The libs dir for a given arch.'''
|
'''The libs dir for a given arch.'''
|
||||||
|
@ -634,7 +635,7 @@ def run_pymodules_install(ctx, modules):
|
||||||
|
|
||||||
venv = sh.Command(ctx.virtualenv)
|
venv = sh.Command(ctx.virtualenv)
|
||||||
with current_directory(join(ctx.build_dir)):
|
with current_directory(join(ctx.build_dir)):
|
||||||
shprint(venv, '--python=python2.7', 'venv')
|
shprint(venv, '--python=python3.6', 'venv')
|
||||||
|
|
||||||
info('Creating a requirements.txt file for the Python modules')
|
info('Creating a requirements.txt file for the Python modules')
|
||||||
with open('requirements.txt', 'w') as fileh:
|
with open('requirements.txt', 'w') as fileh:
|
||||||
|
|
|
@ -70,10 +70,6 @@ class Distribution(object):
|
||||||
correct set of recipes.
|
correct set of recipes.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# AND: This whole function is a bit hacky, it needs checking
|
|
||||||
# properly to make sure it follows logically correct
|
|
||||||
# possibilities
|
|
||||||
|
|
||||||
existing_dists = Distribution.get_distributions(ctx)
|
existing_dists = Distribution.get_distributions(ctx)
|
||||||
|
|
||||||
needs_build = True # whether the dist needs building, will be returned
|
needs_build = True # whether the dist needs building, will be returned
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -16,7 +15,7 @@ if not six.PY3:
|
||||||
stderr = codecs.getwriter('utf8')(stderr)
|
stderr = codecs.getwriter('utf8')(stderr)
|
||||||
|
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
unistr = unicode
|
unistr = unicode # noqa F821
|
||||||
else:
|
else:
|
||||||
unistr = str
|
unistr = str
|
||||||
|
|
||||||
|
@ -43,6 +42,7 @@ class LevelDifferentiatingFormatter(logging.Formatter):
|
||||||
Err_Style.RESET_ALL) + record.msg
|
Err_Style.RESET_ALL) + record.msg
|
||||||
return super(LevelDifferentiatingFormatter, self).format(record)
|
return super(LevelDifferentiatingFormatter, self).format(record)
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger('p4a')
|
logger = logging.getLogger('p4a')
|
||||||
if not hasattr(logger, 'touched'): # Necessary as importlib reloads
|
if not hasattr(logger, 'touched'): # Necessary as importlib reloads
|
||||||
# this, which would add a second
|
# this, which would add a second
|
||||||
|
@ -72,6 +72,7 @@ class colorama_shim(object):
|
||||||
def enable(self, enable):
|
def enable(self, enable):
|
||||||
self._enabled = enable
|
self._enabled = enable
|
||||||
|
|
||||||
|
|
||||||
Out_Style = colorama_shim(Colo_Style)
|
Out_Style = colorama_shim(Colo_Style)
|
||||||
Out_Fore = colorama_shim(Colo_Fore)
|
Out_Fore = colorama_shim(Colo_Fore)
|
||||||
Err_Style = colorama_shim(Colo_Style)
|
Err_Style = colorama_shim(Colo_Style)
|
||||||
|
@ -173,6 +174,8 @@ def shprint(command, *args, **kwargs):
|
||||||
msg_width = columns - len(msg_hdr) - 1
|
msg_width = columns - len(msg_hdr) - 1
|
||||||
output = command(*args, **kwargs)
|
output = command(*args, **kwargs)
|
||||||
for line in output:
|
for line in output:
|
||||||
|
if isinstance(line, bytes):
|
||||||
|
line = line.decode('utf-8', errors='replace')
|
||||||
if logger.level > logging.DEBUG:
|
if logger.level > logging.DEBUG:
|
||||||
msg = line.replace(
|
msg = line.replace(
|
||||||
'\n', ' ').replace(
|
'\n', ' ').replace(
|
||||||
|
|
|
@ -18,6 +18,7 @@ def is_platform(platform):
|
||||||
return uname()[0] == platform
|
return uname()[0] == platform
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
is_linux = is_platform('Linux')
|
is_linux = is_platform('Linux')
|
||||||
is_darwin = is_platform('Darwin')
|
is_darwin = is_platform('Darwin')
|
||||||
|
|
||||||
|
@ -30,31 +31,31 @@ def is_arch(xarch):
|
||||||
|
|
||||||
def is_api_gt(apiver):
|
def is_api_gt(apiver):
|
||||||
def is_x(recipe, **kwargs):
|
def is_x(recipe, **kwargs):
|
||||||
return recipe.ctx.android_min_api > apiver
|
return recipe.ctx.android_api > apiver
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
def is_api_gte(apiver):
|
def is_api_gte(apiver):
|
||||||
def is_x(recipe, **kwargs):
|
def is_x(recipe, **kwargs):
|
||||||
return recipe.ctx.android_min_api >= apiver
|
return recipe.ctx.android_api >= apiver
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
def is_api_lt(apiver):
|
def is_api_lt(apiver):
|
||||||
def is_x(recipe, **kwargs):
|
def is_x(recipe, **kwargs):
|
||||||
return recipe.ctx.android_min_api < apiver
|
return recipe.ctx.android_api < apiver
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
def is_api_lte(apiver):
|
def is_api_lte(apiver):
|
||||||
def is_x(recipe, **kwargs):
|
def is_x(recipe, **kwargs):
|
||||||
return recipe.ctx.android_min_api <= apiver
|
return recipe.ctx.android_api <= apiver
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
def is_api(apiver):
|
def is_api(apiver):
|
||||||
def is_x(recipe, **kwargs):
|
def is_x(recipe, **kwargs):
|
||||||
return recipe.ctx.android_min_api == apiver
|
return recipe.ctx.android_api == apiver
|
||||||
return is_x
|
return is_x
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from os.path import join, dirname, isdir, exists, isfile, split, realpath, basename
|
from os.path import basename, dirname, exists, isdir, isfile, join, realpath
|
||||||
import importlib
|
import importlib
|
||||||
import zipfile
|
|
||||||
import glob
|
import glob
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from six import PY2, with_metaclass
|
from six import PY2, with_metaclass
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from re import match
|
||||||
|
|
||||||
import sh
|
import sh
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -20,7 +20,6 @@ from pythonforandroid.logger import (logger, info, warning, error, debug, shprin
|
||||||
from pythonforandroid.util import (urlretrieve, current_directory, ensure_dir)
|
from pythonforandroid.util import (urlretrieve, current_directory, ensure_dir)
|
||||||
|
|
||||||
# this import is necessary to keep imp.load_source from complaining :)
|
# this import is necessary to keep imp.load_source from complaining :)
|
||||||
import pythonforandroid.recipes
|
|
||||||
|
|
||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
|
@ -149,7 +148,7 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
|
|
||||||
urlretrieve(url, target, report_hook)
|
urlretrieve(url, target, report_hook)
|
||||||
return target
|
return target
|
||||||
elif parsed_url.scheme in ('git', 'git+ssh', 'git+http', 'git+https'):
|
elif parsed_url.scheme in ('git', 'git+file', 'git+ssh', 'git+http', 'git+https'):
|
||||||
if isdir(target):
|
if isdir(target):
|
||||||
with current_directory(target):
|
with current_directory(target):
|
||||||
shprint(sh.git, 'fetch', '--tags')
|
shprint(sh.git, 'fetch', '--tags')
|
||||||
|
@ -168,43 +167,6 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
shprint(sh.git, 'submodule', 'update', '--recursive')
|
shprint(sh.git, 'submodule', 'update', '--recursive')
|
||||||
return target
|
return target
|
||||||
|
|
||||||
def extract_source(self, source, cwd):
|
|
||||||
"""
|
|
||||||
(internal) Extract the `source` into the directory `cwd`.
|
|
||||||
"""
|
|
||||||
if not source:
|
|
||||||
return
|
|
||||||
if isfile(source):
|
|
||||||
info("Extract {} into {}".format(source, cwd))
|
|
||||||
|
|
||||||
if source.endswith(".tgz") or source.endswith(".tar.gz"):
|
|
||||||
shprint(sh.tar, "-C", cwd, "-xvzf", source)
|
|
||||||
|
|
||||||
elif source.endswith(".tbz2") or source.endswith(".tar.bz2"):
|
|
||||||
shprint(sh.tar, "-C", cwd, "-xvjf", source)
|
|
||||||
|
|
||||||
elif source.endswith(".zip"):
|
|
||||||
zf = zipfile.ZipFile(source)
|
|
||||||
zf.extractall(path=cwd)
|
|
||||||
zf.close()
|
|
||||||
|
|
||||||
else:
|
|
||||||
warning(
|
|
||||||
"Error: cannot extract, unrecognized extension for {}"
|
|
||||||
.format(source))
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
elif isdir(source):
|
|
||||||
info("Copying {} into {}".format(source, cwd))
|
|
||||||
|
|
||||||
shprint(sh.cp, '-a', source, cwd)
|
|
||||||
|
|
||||||
else:
|
|
||||||
warning(
|
|
||||||
"Error: cannot extract or copy, unrecognized path {}"
|
|
||||||
.format(source))
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
# def get_archive_rootdir(self, filename):
|
# def get_archive_rootdir(self, filename):
|
||||||
# if filename.endswith(".tgz") or filename.endswith(".tar.gz") or \
|
# if filename.endswith(".tgz") or filename.endswith(".tar.gz") or \
|
||||||
# filename.endswith(".tbz2") or filename.endswith(".tar.bz2"):
|
# filename.endswith(".tbz2") or filename.endswith(".tar.bz2"):
|
||||||
|
@ -225,19 +187,19 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
build directory.
|
build directory.
|
||||||
"""
|
"""
|
||||||
info("Applying patch {}".format(filename))
|
info("Applying patch {}".format(filename))
|
||||||
filename = join(self.recipe_dir, filename)
|
filename = join(self.get_recipe_dir(), filename)
|
||||||
shprint(sh.patch, "-t", "-d", self.get_build_dir(arch), "-p1",
|
shprint(sh.patch, "-t", "-d", self.get_build_dir(arch), "-p1",
|
||||||
"-i", filename, _tail=10)
|
"-i", filename, _tail=10)
|
||||||
|
|
||||||
def copy_file(self, filename, dest):
|
def copy_file(self, filename, dest):
|
||||||
info("Copy {} to {}".format(filename, dest))
|
info("Copy {} to {}".format(filename, dest))
|
||||||
filename = join(self.recipe_dir, filename)
|
filename = join(self.get_recipe_dir(), filename)
|
||||||
dest = join(self.build_dir, dest)
|
dest = join(self.build_dir, dest)
|
||||||
shutil.copy(filename, dest)
|
shutil.copy(filename, dest)
|
||||||
|
|
||||||
def append_file(self, filename, dest):
|
def append_file(self, filename, dest):
|
||||||
info("Append {} to {}".format(filename, dest))
|
info("Append {} to {}".format(filename, dest))
|
||||||
filename = join(self.recipe_dir, filename)
|
filename = join(self.get_recipe_dir(), filename)
|
||||||
dest = join(self.build_dir, dest)
|
dest = join(self.build_dir, dest)
|
||||||
with open(filename, "rb") as fd:
|
with open(filename, "rb") as fd:
|
||||||
data = fd.read()
|
data = fd.read()
|
||||||
|
@ -329,7 +291,14 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
return join(self.get_build_container_dir(arch), self.name)
|
return join(self.get_build_container_dir(arch), self.name)
|
||||||
|
|
||||||
def get_recipe_dir(self):
|
def get_recipe_dir(self):
|
||||||
# AND: Redundant, an equivalent property is already set by get_recipe
|
"""
|
||||||
|
Returns the local recipe directory or defaults to the core recipe
|
||||||
|
directory.
|
||||||
|
"""
|
||||||
|
if self.ctx.local_recipes is not None:
|
||||||
|
local_recipe_dir = join(self.ctx.local_recipes, self.name)
|
||||||
|
if exists(local_recipe_dir):
|
||||||
|
return local_recipe_dir
|
||||||
return join(self.ctx.root_dir, 'recipes', self.name)
|
return join(self.ctx.root_dir, 'recipes', self.name)
|
||||||
|
|
||||||
# Public Recipe API to be subclassed if needed
|
# Public Recipe API to be subclassed if needed
|
||||||
|
@ -349,6 +318,16 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
return
|
return
|
||||||
|
|
||||||
url = self.versioned_url
|
url = self.versioned_url
|
||||||
|
ma = match(u'^(.+)#md5=([0-9a-f]{32})$', url)
|
||||||
|
if ma: # fragmented URL?
|
||||||
|
if self.md5sum:
|
||||||
|
raise ValueError(
|
||||||
|
('Received md5sum from both the {} recipe '
|
||||||
|
'and its url').format(self.name))
|
||||||
|
url = ma.group(1)
|
||||||
|
expected_md5 = ma.group(2)
|
||||||
|
else:
|
||||||
|
expected_md5 = self.md5sum
|
||||||
|
|
||||||
shprint(sh.mkdir, '-p', join(self.ctx.packages_path, self.name))
|
shprint(sh.mkdir, '-p', join(self.ctx.packages_path, self.name))
|
||||||
|
|
||||||
|
@ -356,44 +335,41 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
filename = shprint(sh.basename, url).stdout[:-1].decode('utf-8')
|
filename = shprint(sh.basename, url).stdout[:-1].decode('utf-8')
|
||||||
|
|
||||||
do_download = True
|
do_download = True
|
||||||
|
|
||||||
marker_filename = '.mark-{}'.format(filename)
|
marker_filename = '.mark-{}'.format(filename)
|
||||||
if exists(filename) and isfile(filename):
|
if exists(filename) and isfile(filename):
|
||||||
if not exists(marker_filename):
|
if not exists(marker_filename):
|
||||||
shprint(sh.rm, filename)
|
shprint(sh.rm, filename)
|
||||||
elif self.md5sum:
|
elif expected_md5:
|
||||||
current_md5 = md5sum(filename)
|
current_md5 = md5sum(filename)
|
||||||
if current_md5 == self.md5sum:
|
if current_md5 != expected_md5:
|
||||||
debug('Checked md5sum: downloaded expected content!')
|
|
||||||
do_download = False
|
|
||||||
else:
|
|
||||||
info('Downloaded unexpected content...')
|
|
||||||
debug('* Generated md5sum: {}'.format(current_md5))
|
debug('* Generated md5sum: {}'.format(current_md5))
|
||||||
debug('* Expected md5sum: {}'.format(self.md5sum))
|
debug('* Expected md5sum: {}'.format(expected_md5))
|
||||||
|
raise ValueError(
|
||||||
|
('Generated md5sum does not match expected md5sum '
|
||||||
|
'for {} recipe').format(self.name))
|
||||||
|
do_download = False
|
||||||
else:
|
else:
|
||||||
do_download = False
|
do_download = False
|
||||||
info('{} download already cached, skipping'
|
|
||||||
.format(self.name))
|
|
||||||
|
|
||||||
# If we got this far, we will download
|
# If we got this far, we will download
|
||||||
if do_download:
|
if do_download:
|
||||||
debug('Downloading {} from {}'.format(self.name, url))
|
debug('Downloading {} from {}'.format(self.name, url))
|
||||||
|
|
||||||
shprint(sh.rm, '-f', marker_filename)
|
shprint(sh.rm, '-f', marker_filename)
|
||||||
self.download_file(url, filename)
|
self.download_file(self.versioned_url, filename)
|
||||||
shprint(sh.touch, marker_filename)
|
shprint(sh.touch, marker_filename)
|
||||||
|
|
||||||
if exists(filename) and isfile(filename) and self.md5sum:
|
if exists(filename) and isfile(filename) and expected_md5:
|
||||||
current_md5 = md5sum(filename)
|
current_md5 = md5sum(filename)
|
||||||
if self.md5sum is not None:
|
if expected_md5 is not None:
|
||||||
if current_md5 == self.md5sum:
|
if current_md5 != expected_md5:
|
||||||
debug('Checked md5sum: downloaded expected content!')
|
|
||||||
else:
|
|
||||||
info('Downloaded unexpected content...')
|
|
||||||
debug('* Generated md5sum: {}'.format(current_md5))
|
debug('* Generated md5sum: {}'.format(current_md5))
|
||||||
debug('* Expected md5sum: {}'.format(self.md5sum))
|
debug('* Expected md5sum: {}'.format(expected_md5))
|
||||||
exit(1)
|
raise ValueError(
|
||||||
|
('Generated md5sum does not match expected md5sum '
|
||||||
|
'for {} recipe').format(self.name))
|
||||||
|
else:
|
||||||
|
info('{} download already cached, skipping'.format(self.name))
|
||||||
|
|
||||||
def unpack(self, arch):
|
def unpack(self, arch):
|
||||||
info_main('Unpacking {} for {}'.format(self.name, arch))
|
info_main('Unpacking {} for {}'.format(self.name, arch))
|
||||||
|
@ -404,8 +380,6 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
if user_dir is not None:
|
if user_dir is not None:
|
||||||
info('P4A_{}_DIR exists, symlinking instead'.format(
|
info('P4A_{}_DIR exists, symlinking instead'.format(
|
||||||
self.name.lower()))
|
self.name.lower()))
|
||||||
# AND: Currently there's something wrong if I use ln, fix this
|
|
||||||
warning('Using cp -a instead of symlink...fix this!')
|
|
||||||
if exists(self.get_build_dir(arch)):
|
if exists(self.get_build_dir(arch)):
|
||||||
return
|
return
|
||||||
shprint(sh.rm, '-rf', build_dir)
|
shprint(sh.rm, '-rf', build_dir)
|
||||||
|
@ -421,11 +395,13 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
|
|
||||||
filename = shprint(
|
filename = shprint(
|
||||||
sh.basename, self.versioned_url).stdout[:-1].decode('utf-8')
|
sh.basename, self.versioned_url).stdout[:-1].decode('utf-8')
|
||||||
|
ma = match(u'^(.+)#md5=([0-9a-f]{32})$', filename)
|
||||||
|
if ma: # fragmented URL?
|
||||||
|
filename = ma.group(1)
|
||||||
|
|
||||||
with current_directory(build_dir):
|
with current_directory(build_dir):
|
||||||
directory_name = self.get_build_dir(arch)
|
directory_name = self.get_build_dir(arch)
|
||||||
|
|
||||||
# AND: Could use tito's get_archive_rootdir here
|
|
||||||
if not exists(directory_name) or not isdir(directory_name):
|
if not exists(directory_name) or not isdir(directory_name):
|
||||||
extraction_filename = join(
|
extraction_filename = join(
|
||||||
self.ctx.packages_path, self.name, filename)
|
self.ctx.packages_path, self.name, filename)
|
||||||
|
@ -638,7 +614,6 @@ class Recipe(with_metaclass(RecipeMeta)):
|
||||||
if len(logger.handlers) > 1:
|
if len(logger.handlers) > 1:
|
||||||
logger.removeHandler(logger.handlers[1])
|
logger.removeHandler(logger.handlers[1])
|
||||||
recipe = mod.recipe
|
recipe = mod.recipe
|
||||||
recipe.recipe_dir = dirname(recipe_file)
|
|
||||||
recipe.ctx = ctx
|
recipe.ctx = ctx
|
||||||
cls.recipes[name] = recipe
|
cls.recipes[name] = recipe
|
||||||
return recipe
|
return recipe
|
||||||
|
@ -755,6 +730,10 @@ class PythonRecipe(Recipe):
|
||||||
return join(
|
return join(
|
||||||
Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(),
|
Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(),
|
||||||
'hostpython')
|
'hostpython')
|
||||||
|
elif 'hostpython3crystax' in self.ctx.recipe_build_order:
|
||||||
|
return join(
|
||||||
|
Recipe.get_recipe('hostpython3crystax', self.ctx).get_build_dir(),
|
||||||
|
'hostpython')
|
||||||
else:
|
else:
|
||||||
python_recipe = self.ctx.python_recipe
|
python_recipe = self.ctx.python_recipe
|
||||||
return 'python{}'.format(python_recipe.version)
|
return 'python{}'.format(python_recipe.version)
|
||||||
|
@ -779,6 +758,34 @@ class PythonRecipe(Recipe):
|
||||||
env['PYTHONNOUSERSITE'] = '1'
|
env['PYTHONNOUSERSITE'] = '1'
|
||||||
|
|
||||||
if not self.call_hostpython_via_targetpython:
|
if not self.call_hostpython_via_targetpython:
|
||||||
|
# sets python headers/linkages...depending on python's recipe
|
||||||
|
python_version = self.ctx.python_recipe.version
|
||||||
|
python_short_version = '.'.join(python_version.split('.')[:2])
|
||||||
|
if 'python2' in self.ctx.recipe_build_order:
|
||||||
|
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
|
||||||
|
env['CFLAGS'] += ' -I' + env[
|
||||||
|
'PYTHON_ROOT'] + '/include/python2.7'
|
||||||
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
|
||||||
|
' -lpython2.7'
|
||||||
|
elif self.ctx.python_recipe.from_crystax:
|
||||||
|
ndk_dir_python = join(self.ctx.ndk_dir, 'sources',
|
||||||
|
'python', python_version)
|
||||||
|
env['CFLAGS'] += ' -I{} '.format(
|
||||||
|
join(ndk_dir_python, 'include',
|
||||||
|
'python'))
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(
|
||||||
|
join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
env['LDFLAGS'] += ' -lpython{}m'.format(python_short_version)
|
||||||
|
elif 'python3' in self.ctx.recipe_build_order:
|
||||||
|
# This headers are unused cause python3 recipe was removed
|
||||||
|
# TODO: should be reviewed when python3 recipe added
|
||||||
|
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
|
||||||
|
env['CFLAGS'] += ' -I' + env[
|
||||||
|
'PYTHON_ROOT'] + '/include/python{}m'.format(
|
||||||
|
python_short_version)
|
||||||
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
|
||||||
|
' -lpython{}m'.format(
|
||||||
|
python_short_version)
|
||||||
hppath = []
|
hppath = []
|
||||||
hppath.append(join(dirname(self.hostpython_location), 'Lib'))
|
hppath.append(join(dirname(self.hostpython_location), 'Lib'))
|
||||||
hppath.append(join(hppath[0], 'site-packages'))
|
hppath.append(join(hppath[0], 'site-packages'))
|
||||||
|
@ -819,28 +826,12 @@ class PythonRecipe(Recipe):
|
||||||
with current_directory(self.get_build_dir(arch.arch)):
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
hostpython = sh.Command(self.hostpython_location)
|
hostpython = sh.Command(self.hostpython_location)
|
||||||
|
|
||||||
|
|
||||||
if self.ctx.python_recipe.from_crystax:
|
if self.ctx.python_recipe.from_crystax:
|
||||||
# hppath = join(dirname(self.hostpython_location), 'Lib',
|
|
||||||
# 'site-packages')
|
|
||||||
hpenv = env.copy()
|
hpenv = env.copy()
|
||||||
# if 'PYTHONPATH' in hpenv:
|
|
||||||
# hpenv['PYTHONPATH'] = ':'.join([hppath] +
|
|
||||||
# hpenv['PYTHONPATH'].split(':'))
|
|
||||||
# else:
|
|
||||||
# hpenv['PYTHONPATH'] = hppath
|
|
||||||
# hpenv['PYTHONHOME'] = self.ctx.get_python_install_dir()
|
|
||||||
# shprint(hostpython, 'setup.py', 'build',
|
|
||||||
# _env=hpenv, *self.setup_extra_args)
|
|
||||||
shprint(hostpython, 'setup.py', 'install', '-O2',
|
shprint(hostpython, 'setup.py', 'install', '-O2',
|
||||||
'--root={}'.format(self.ctx.get_python_install_dir()),
|
'--root={}'.format(self.ctx.get_python_install_dir()),
|
||||||
'--install-lib=.',
|
'--install-lib=.',
|
||||||
# AND: will need to unhardcode the 3.5 when adding 2.7 (and other crystax supported versions)
|
|
||||||
_env=hpenv, *self.setup_extra_args)
|
_env=hpenv, *self.setup_extra_args)
|
||||||
# site_packages_dir = self.ctx.get_site_packages_dir()
|
|
||||||
# built_files = glob.glob(join('build', 'lib*', '*'))
|
|
||||||
# for filen in built_files:
|
|
||||||
# shprint(sh.cp, '-r', filen, join(site_packages_dir, split(filen)[-1]))
|
|
||||||
elif self.call_hostpython_via_targetpython:
|
elif self.call_hostpython_via_targetpython:
|
||||||
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
|
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
|
||||||
*self.setup_extra_args)
|
*self.setup_extra_args)
|
||||||
|
@ -857,7 +848,6 @@ class PythonRecipe(Recipe):
|
||||||
'--root={}'.format(self.ctx.get_python_install_dir()),
|
'--root={}'.format(self.ctx.get_python_install_dir()),
|
||||||
'--install-lib=lib/python2.7/site-packages',
|
'--install-lib=lib/python2.7/site-packages',
|
||||||
_env=hpenv, *self.setup_extra_args)
|
_env=hpenv, *self.setup_extra_args)
|
||||||
# AND: Hardcoded python2.7 needs fixing
|
|
||||||
|
|
||||||
# If asked, also install in the hostpython build dir
|
# If asked, also install in the hostpython build dir
|
||||||
if self.install_in_hostpython:
|
if self.install_in_hostpython:
|
||||||
|
@ -917,6 +907,7 @@ class CompiledComponentsPythonRecipe(PythonRecipe):
|
||||||
shprint(hostpython, 'setup.py', self.build_cmd, '-v', _env=env,
|
shprint(hostpython, 'setup.py', self.build_cmd, '-v', _env=env,
|
||||||
*self.setup_extra_args)
|
*self.setup_extra_args)
|
||||||
|
|
||||||
|
|
||||||
class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
|
class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
|
||||||
""" Extensions that require the cxx-stl """
|
""" Extensions that require the cxx-stl """
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
|
@ -926,39 +917,34 @@ class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
|
||||||
keys = dict(
|
keys = dict(
|
||||||
ctx=self.ctx,
|
ctx=self.ctx,
|
||||||
arch=arch,
|
arch=arch,
|
||||||
arch_noeabi=arch.arch.replace('eabi', ''),
|
arch_noeabi=arch.arch.replace('eabi', '')
|
||||||
pyroot=self.ctx.get_python_install_dir()
|
|
||||||
)
|
)
|
||||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||||
env['CFLAGS'] += " -I{pyroot}/include/python2.7 " \
|
env['CFLAGS'] += " -I{ctx.ndk_dir}/platforms/android-{ctx.android_api}/arch-{arch_noeabi}/usr/include" \
|
||||||
" -I{ctx.ndk_dir}/platforms/android-{ctx.android_min_api}/arch-{arch_noeabi}/usr/include" \
|
|
||||||
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/include" \
|
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/include" \
|
||||||
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/include".format(**keys)
|
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/include".format(**keys)
|
||||||
env['CXXFLAGS'] = env['CFLAGS'] + ' -frtti -fexceptions'
|
env['CXXFLAGS'] = env['CFLAGS'] + ' -frtti -fexceptions'
|
||||||
env['LDFLAGS'] += " -L{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}" \
|
env['LDFLAGS'] += " -L{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}" \
|
||||||
" -lpython2.7" \
|
|
||||||
" -lgnustl_shared".format(**keys)
|
" -lgnustl_shared".format(**keys)
|
||||||
|
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def build_compiled_components(self,arch):
|
def build_compiled_components(self, arch):
|
||||||
super(CppCompiledComponentsPythonRecipe, self).build_compiled_components(arch)
|
super(CppCompiledComponentsPythonRecipe, self).build_compiled_components(arch)
|
||||||
|
|
||||||
# Copy libgnustl_shared.so
|
# Copy libgnustl_shared.so
|
||||||
with current_directory(self.get_build_dir(arch.arch)):
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
sh.cp(
|
sh.cp(
|
||||||
"{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/libgnustl_shared.so".format(ctx=self.ctx,arch=arch),
|
"{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/libgnustl_shared.so".format(ctx=self.ctx, arch=arch),
|
||||||
self.ctx.get_libs_dir(arch.arch)
|
self.ctx.get_libs_dir(arch.arch)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CythonRecipe(PythonRecipe):
|
class CythonRecipe(PythonRecipe):
|
||||||
pre_build_ext = False
|
pre_build_ext = False
|
||||||
cythonize = True
|
cythonize = True
|
||||||
cython_args = []
|
cython_args = []
|
||||||
|
call_hostpython_via_targetpython = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(CythonRecipe, self).__init__(*args, **kwargs)
|
super(CythonRecipe, self).__init__(*args, **kwargs)
|
||||||
|
@ -1082,21 +1068,6 @@ class CythonRecipe(PythonRecipe):
|
||||||
env['LIBLINK_PATH'] = liblink_path
|
env['LIBLINK_PATH'] = liblink_path
|
||||||
ensure_dir(liblink_path)
|
ensure_dir(liblink_path)
|
||||||
|
|
||||||
if self.ctx.python_recipe.from_crystax:
|
|
||||||
env['CFLAGS'] = '-I{} '.format(
|
|
||||||
join(self.ctx.ndk_dir, 'sources', 'python',
|
|
||||||
self.ctx.python_recipe.version, 'include',
|
|
||||||
'python')) + env['CFLAGS']
|
|
||||||
|
|
||||||
# Temporarily hardcode the -lpython3.x as this does not
|
|
||||||
# get applied automatically in some environments. This
|
|
||||||
# will need generalising, along with the other hardcoded
|
|
||||||
# py3.5 references, to support other python3 or crystax
|
|
||||||
# python versions.
|
|
||||||
python3_version = self.ctx.python_recipe.version
|
|
||||||
python3_version = '.'.join(python3_version.split('.')[:2])
|
|
||||||
env['LDFLAGS'] = env['LDFLAGS'] + ' -lpython{}m'.format(python3_version)
|
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
|
||||||
name = 'cryptography'
|
name = 'cryptography'
|
||||||
version = '1.4'
|
version = '1.4'
|
||||||
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
|
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
|
||||||
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'enum34', 'ipaddress', 'cffi']
|
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'ipaddress', 'cffi']
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
|
|
||||||
def get_recipe_env(self, arch):
|
def get_recipe_env(self, arch):
|
||||||
|
|
|
@ -1,3 +1,83 @@
|
||||||
|
from pythonforandroid.recipe import CythonRecipe, IncludedFilesBehaviour
|
||||||
|
from pythonforandroid.util import current_directory
|
||||||
|
from pythonforandroid.patching import will_build
|
||||||
|
from pythonforandroid import logger
|
||||||
|
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
|
|
||||||
|
class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
|
||||||
|
# name = 'android'
|
||||||
|
version = None
|
||||||
|
url = None
|
||||||
|
|
||||||
|
src_filename = 'src'
|
||||||
|
|
||||||
|
depends = [('pygame', 'sdl2', 'genericndkbuild'), ('python2', 'python3crystax')]
|
||||||
|
|
||||||
|
config_env = {}
|
||||||
|
|
||||||
|
def get_recipe_env(self, arch):
|
||||||
|
env = super(AndroidRecipe, self).get_recipe_env(arch)
|
||||||
|
env.update(self.config_env)
|
||||||
|
return env
|
||||||
|
|
||||||
|
def prebuild_arch(self, arch):
|
||||||
|
super(AndroidRecipe, self).prebuild_arch(arch)
|
||||||
|
|
||||||
|
tpxi = 'DEF {} = {}\n'
|
||||||
|
th = '#define {} {}\n'
|
||||||
|
tpy = '{} = {}\n'
|
||||||
|
|
||||||
|
bootstrap = bootstrap_name = self.ctx.bootstrap.name
|
||||||
|
is_sdl2 = bootstrap_name in ('sdl2', 'sdl2python3', 'sdl2_gradle')
|
||||||
|
is_pygame = bootstrap_name in ('pygame',)
|
||||||
|
is_webview = bootstrap_name in ('webview',)
|
||||||
|
is_lbry = bootstrap_name in ('lbry',)
|
||||||
|
|
||||||
|
if is_sdl2 or is_webview or is_lbry:
|
||||||
|
if is_sdl2:
|
||||||
|
bootstrap = 'sdl2'
|
||||||
|
java_ns = 'org.kivy.android'
|
||||||
|
jni_ns = 'org/kivy/android'
|
||||||
|
elif is_pygame:
|
||||||
|
java_ns = 'org.renpy.android'
|
||||||
|
jni_ns = 'org/renpy/android'
|
||||||
|
else:
|
||||||
|
logger.error('unsupported bootstrap for android recipe: {}'.format(bootstrap_name))
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
config = {
|
||||||
|
'BOOTSTRAP': bootstrap,
|
||||||
|
'IS_SDL2': int(is_sdl2),
|
||||||
|
'IS_PYGAME': int(is_pygame),
|
||||||
|
'PY2': int(will_build('python2')(self)),
|
||||||
|
'JAVA_NAMESPACE': java_ns,
|
||||||
|
'JNI_NAMESPACE': jni_ns,
|
||||||
|
}
|
||||||
|
|
||||||
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
with open(join('android', 'config.pxi'), 'w') as fpxi:
|
||||||
|
with open(join('android', 'config.h'), 'w') as fh:
|
||||||
|
with open(join('android', 'config.py'), 'w') as fpy:
|
||||||
|
for key, value in config.items():
|
||||||
|
fpxi.write(tpxi.format(key, repr(value)))
|
||||||
|
fpy.write(tpy.format(key, repr(value)))
|
||||||
|
fh.write(th.format(key, value if isinstance(value, int)
|
||||||
|
else '"{}"'.format(value)))
|
||||||
|
self.config_env[key] = str(value)
|
||||||
|
|
||||||
|
if is_sdl2:
|
||||||
|
fh.write('JNIEnv *SDL_AndroidGetJNIEnv(void);\n')
|
||||||
|
fh.write('#define SDL_ANDROID_GetJNIEnv SDL_AndroidGetJNIEnv\n')
|
||||||
|
elif is_pygame:
|
||||||
|
fh.write('JNIEnv *SDL_ANDROID_GetJNIEnv(void);\n')
|
||||||
|
|
||||||
|
|
||||||
|
recipe = AndroidRecipe()
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
from pythonforandroid.recipe import CythonRecipe, Recipe, IncludedFilesBehaviour
|
from pythonforandroid.recipe import CythonRecipe, Recipe, IncludedFilesBehaviour
|
||||||
from pythonforandroid.util import current_directory
|
from pythonforandroid.util import current_directory
|
||||||
from pythonforandroid.patching import will_build
|
from pythonforandroid.patching import will_build
|
||||||
|
@ -83,3 +163,4 @@ class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
|
||||||
|
|
||||||
|
|
||||||
recipe = AndroidRecipe()
|
recipe = AndroidRecipe()
|
||||||
|
'''
|
|
@ -6,7 +6,7 @@ lib_dict = {
|
||||||
'pygame': ['sdl'],
|
'pygame': ['sdl'],
|
||||||
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
|
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
|
||||||
}
|
}
|
||||||
sdl_libs = lib_dict[os.environ['BOOTSTRAP']]
|
sdl_libs = lib_dict[os.environ['BOOTSTRAP']] if os.environ['BOOTSTRAP'] == 'sdl2' else []
|
||||||
|
|
||||||
renpy_sound = Extension('android._android_sound',
|
renpy_sound = Extension('android._android_sound',
|
||||||
['android/_android_sound.c', 'android/_android_sound_jni.c', ],
|
['android/_android_sound.c', 'android/_android_sound_jni.c', ],
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
|
|
||||||
from os.path import join
|
import os
|
||||||
|
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
|
||||||
|
|
||||||
|
|
||||||
class CffiRecipe(CompiledComponentsPythonRecipe):
|
class CffiRecipe(CompiledComponentsPythonRecipe):
|
||||||
name = 'cffi'
|
name = 'cffi'
|
||||||
version = '1.11.0'
|
version = '1.11.5'
|
||||||
#url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
|
||||||
url = 'https://pypi.python.org/packages/4e/32/4070bdf32812c89eb635c80880a5caa2e0189aa7999994c265577e5154f3/cffi-{version}.tar.gz'
|
|
||||||
|
|
||||||
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
|
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
|
||||||
|
|
||||||
|
@ -15,21 +15,43 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
|
||||||
# call_hostpython_via_targetpython = False
|
# call_hostpython_via_targetpython = False
|
||||||
install_in_hostpython = True
|
install_in_hostpython = True
|
||||||
|
|
||||||
|
def get_hostrecipe_env(self, arch=None):
|
||||||
|
# fixes missing ffi.h on some host systems (e.g. gentoo)
|
||||||
|
env = super(CffiRecipe, self).get_hostrecipe_env(arch)
|
||||||
|
libffi = self.get_recipe('libffi', self.ctx)
|
||||||
|
includes = libffi.get_include_dirs(arch)
|
||||||
|
env['FFI_INC'] = ",".join(includes)
|
||||||
|
return env
|
||||||
|
|
||||||
def get_recipe_env(self, arch=None):
|
def get_recipe_env(self, arch=None):
|
||||||
env = super(CffiRecipe, self).get_recipe_env(arch)
|
env = super(CffiRecipe, self).get_recipe_env(arch)
|
||||||
|
# sets linker to use the correct gcc (cross compiler)
|
||||||
|
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||||
libffi = self.get_recipe('libffi', self.ctx)
|
libffi = self.get_recipe('libffi', self.ctx)
|
||||||
includes = libffi.get_include_dirs(arch)
|
includes = libffi.get_include_dirs(arch)
|
||||||
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
|
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
|
||||||
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
|
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
|
||||||
self.ctx.get_libs_dir(arch.arch))
|
self.ctx.get_libs_dir(arch.arch))
|
||||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
|
||||||
env['PYTHONPATH'] = ':'.join([self.ctx.get_site_packages_dir(), env['BUILDLIB_PATH']])
|
|
||||||
|
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
|
||||||
|
|
||||||
|
# required for libc and libdl
|
||||||
|
ndk_dir = self.ctx.ndk_platform
|
||||||
|
ndk_lib_dir = os.path.join(ndk_dir, 'usr', 'lib')
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(ndk_lib_dir)
|
||||||
|
env['LDFLAGS'] += " --sysroot={}".format(self.ctx.ndk_platform)
|
||||||
|
env['PYTHONPATH'] = ':'.join([
|
||||||
|
self.ctx.get_site_packages_dir(),
|
||||||
|
env['BUILDLIB_PATH'],
|
||||||
|
])
|
||||||
|
if self.ctx.ndk == 'crystax':
|
||||||
|
# only keeps major.minor (discards patch)
|
||||||
|
python_version = self.ctx.python_recipe.version[0:3]
|
||||||
|
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
|
||||||
|
# until `pythonforandroid/archs.py` gets merged upstream:
|
||||||
|
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
|
||||||
|
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
diff -Naur cffi-1.4.2/setup.py b/setup.py
|
diff --git a/setup.py b/setup.py
|
||||||
--- cffi-1.4.2/setup.py 2015-12-21 12:09:47.000000000 -0600
|
index c1db368..57311c3 100644
|
||||||
+++ b/setup.py 2015-12-23 10:20:40.590622524 -0600
|
--- a/setup.py
|
||||||
@@ -5,8 +5,7 @@
|
+++ b/setup.py
|
||||||
|
@@ -5,8 +5,7 @@ import errno
|
||||||
|
|
||||||
sources = ['c/_cffi_backend.c']
|
sources = ['c/_cffi_backend.c']
|
||||||
libraries = ['ffi']
|
libraries = ['ffi']
|
||||||
-include_dirs = ['/usr/include/ffi',
|
-include_dirs = ['/usr/include/ffi',
|
||||||
- '/usr/include/libffi'] # may be changed by pkg-config
|
- '/usr/include/libffi'] # may be changed by pkg-config
|
||||||
+include_dirs = []
|
+include_dirs = os.environ['FFI_INC'].split(",") if 'FFI_INC' in os.environ else []
|
||||||
define_macros = []
|
define_macros = []
|
||||||
library_dirs = []
|
library_dirs = []
|
||||||
extra_compile_args = []
|
extra_compile_args = []
|
||||||
@@ -67,14 +66,7 @@
|
@@ -67,14 +66,7 @@ def ask_supports_thread():
|
||||||
sys.stderr.write("The above error message can be safely ignored\n")
|
sys.stderr.write("The above error message can be safely ignored\n")
|
||||||
|
|
||||||
def use_pkg_config():
|
def use_pkg_config():
|
||||||
|
|
42
recipes/coincurve/__init__.py
Normal file
42
recipes/coincurve/__init__.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import os
|
||||||
|
from pythonforandroid.recipe import PythonRecipe, CompiledComponentsPythonRecipe
|
||||||
|
|
||||||
|
|
||||||
|
class CoincurveRecipe(CompiledComponentsPythonRecipe):
|
||||||
|
version = '7.1.0'
|
||||||
|
url = 'https://github.com/ofek/coincurve/archive/{version}.tar.gz'
|
||||||
|
call_hostpython_via_targetpython = False
|
||||||
|
depends = [('python2', 'python3crystax'), 'setuptools',
|
||||||
|
'libffi', 'cffi', 'libsecp256k1']
|
||||||
|
patches = [
|
||||||
|
"cross_compile.patch", "drop_setup_requires.patch",
|
||||||
|
"find_lib.patch", "no-download.patch", "setup.py.patch"]
|
||||||
|
|
||||||
|
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
|
||||||
|
env = super(CoincurveRecipe, self).get_recipe_env(arch, with_flags_in_cc)
|
||||||
|
# sets linker to use the correct gcc (cross compiler)
|
||||||
|
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||||
|
libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx)
|
||||||
|
libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch)
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs'))
|
||||||
|
env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include')
|
||||||
|
# only keeps major.minor (discards patch)
|
||||||
|
python_version = self.ctx.python_recipe.version[0:3]
|
||||||
|
# required additional library and path for Crystax
|
||||||
|
if self.ctx.ndk == 'crystax':
|
||||||
|
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
|
||||||
|
# until `pythonforandroid/archs.py` gets merged upstream:
|
||||||
|
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
|
||||||
|
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
|
||||||
|
else:
|
||||||
|
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
|
||||||
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version)
|
||||||
|
env['LDFLAGS'] += " -lpython{}".format(python_version)
|
||||||
|
env['LDFLAGS'] += " -lsecp256k1"
|
||||||
|
return env
|
||||||
|
|
||||||
|
|
||||||
|
recipe = CoincurveRecipe()
|
||||||
|
|
12
recipes/coincurve/cross_compile.patch
Normal file
12
recipes/coincurve/cross_compile.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index c224fb2..bf925bd 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -182,6 +182,7 @@ class build_clib(_build_clib):
|
||||||
|
'--disable-dependency-tracking',
|
||||||
|
'--with-pic',
|
||||||
|
'--enable-module-recovery',
|
||||||
|
+ "--host=%s" % os.environ['TOOLCHAIN_PREFIX'],
|
||||||
|
'--disable-jni',
|
||||||
|
'--prefix',
|
||||||
|
os.path.abspath(self.build_clib),
|
12
recipes/coincurve/drop_setup_requires.patch
Normal file
12
recipes/coincurve/drop_setup_requires.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index c224fb2..466e789 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -250,7 +250,6 @@ else:
|
||||||
|
def has_c_libraries(self):
|
||||||
|
return not has_system_lib()
|
||||||
|
setup_kwargs = dict(
|
||||||
|
- setup_requires=['cffi>=1.3.0', 'pytest-runner>=2.6.2'],
|
||||||
|
ext_package='coincurve',
|
||||||
|
cffi_modules=['_cffi_build/build.py:ffi'],
|
||||||
|
cmdclass={
|
13
recipes/coincurve/find_lib.patch
Normal file
13
recipes/coincurve/find_lib.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/setup_support.py b/setup_support.py
|
||||||
|
index e7a4f2e..72f0c4d 100644
|
||||||
|
--- a/setup_support.py
|
||||||
|
+++ b/setup_support.py
|
||||||
|
@@ -68,6 +69,8 @@ def build_flags(library, type_, path):
|
||||||
|
|
||||||
|
|
||||||
|
def _find_lib():
|
||||||
|
+ # we're picking up the recipe one
|
||||||
|
+ return True
|
||||||
|
from cffi import FFI
|
||||||
|
ffi = FFI()
|
||||||
|
try:
|
13
recipes/coincurve/no-download.patch
Normal file
13
recipes/coincurve/no-download.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index c224fb2..d5f6d1a 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -51,6 +51,8 @@ if [int(i) for i in setuptools_version.split('.', 2)[:2]] < [3, 3]:
|
||||||
|
|
||||||
|
|
||||||
|
def download_library(command):
|
||||||
|
+ # we will use the custom libsecp256k1 recipe
|
||||||
|
+ return
|
||||||
|
if command.dry_run:
|
||||||
|
return
|
||||||
|
libdir = absolute('libsecp256k1')
|
22
recipes/coincurve/setup.py.patch
Normal file
22
recipes/coincurve/setup.py.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
From bf3a0684e9b0af29d9777f61d6e7e1d3cc0f2803 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kieran Prasch <kieranprasch@gmail.com>
|
||||||
|
Date: Thu, 19 Jul 2018 14:11:48 -0700
|
||||||
|
Subject: [PATCH] Exclude tests in setup.py
|
||||||
|
|
||||||
|
---
|
||||||
|
setup.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 0b579f1..0a793ed 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -277,7 +277,7 @@ def has_c_libraries(self):
|
||||||
|
install_requires=['asn1crypto', 'cffi>=1.3.0'],
|
||||||
|
tests_require=['pytest>=2.8.7'],
|
||||||
|
|
||||||
|
- packages=find_packages(exclude=('_cffi_build', '_cffi_build.*', 'libsecp256k1')),
|
||||||
|
+ packages=find_packages(exclude=('_cffi_build', '_cffi_build.*', 'libsecp256k1', 'tests')),
|
||||||
|
|
||||||
|
distclass=Distribution,
|
||||||
|
zip_safe=False,
|
|
@ -1,30 +1,37 @@
|
||||||
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
|
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
|
import os
|
||||||
|
|
||||||
class CryptographyRecipe(CompiledComponentsPythonRecipe):
|
class CryptographyRecipe(CompiledComponentsPythonRecipe):
|
||||||
name = 'cryptography'
|
name = 'cryptography'
|
||||||
version = '2.2.2'
|
version = '2.3.1'
|
||||||
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
|
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
|
||||||
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'enum34', 'ipaddress', 'cffi']
|
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'ipaddress', 'cffi']
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
|
patches = ['force-urandom.patch']
|
||||||
|
|
||||||
def get_recipe_env(self, arch):
|
def get_recipe_env(self, arch):
|
||||||
env = super(CryptographyRecipe, self).get_recipe_env(arch)
|
env = super(CryptographyRecipe, self).get_recipe_env(arch)
|
||||||
r = self.get_recipe('openssl', self.ctx)
|
r = self.get_recipe('openssl', self.ctx)
|
||||||
openssl_dir = r.get_build_dir(arch.arch)
|
openssl_dir = r.get_build_dir(arch.arch)
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
env['CFLAGS'] += ' -I' + join(openssl_dir, 'include') + ' -w'
|
||||||
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
|
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \
|
|
||||||
' -I' + join(openssl_dir, 'include') + \
|
|
||||||
' -I' + join(target_python, 'Modules/_ctypes/libffi_arm_wince')
|
|
||||||
# Set linker to use the correct gcc
|
# Set linker to use the correct gcc
|
||||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
|
env['LDFLAGS'] += ' -L' + openssl_dir + \
|
||||||
' -L' + openssl_dir + \
|
|
||||||
' -lpython2.7' + \
|
|
||||||
' -lssl' + r.version + \
|
' -lssl' + r.version + \
|
||||||
' -lcrypto' + r.version
|
' -lcrypto' + r.version
|
||||||
|
|
||||||
|
if self.ctx.ndk == 'crystax':
|
||||||
|
# only keeps major.minor (discards patch)
|
||||||
|
python_version = self.ctx.python_recipe.version[0:3]
|
||||||
|
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
|
||||||
|
# until `pythonforandroid/archs.py` gets merged upstream:
|
||||||
|
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
|
||||||
|
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) + ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
recipe = CryptographyRecipe()
|
recipe = CryptographyRecipe()
|
||||||
|
|
11
recipes/cryptography/force-urandom.patch
Normal file
11
recipes/cryptography/force-urandom.patch
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- x/src/_cffi_src/openssl/src/osrandom_engine.h 2018-09-25 23:19:08.303397032 +0100
|
||||||
|
+++ y/src/_cffi_src/openssl/src/osrandom_engine.h 2018-09-25 23:21:45.945980819 +0100
|
||||||
|
@@ -42,7 +42,7 @@
|
||||||
|
#define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_GETENTROPY
|
||||||
|
#elif defined(__linux__) && defined(SYS_getrandom)
|
||||||
|
/* Linux 3.4.17+ */
|
||||||
|
- #define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_GETRANDOM
|
||||||
|
+ #define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_DEV_URANDOM // force /dev/urandom
|
||||||
|
#else
|
||||||
|
/* Keep this as last entry, fall back to /dev/urandom */
|
||||||
|
#define CRYPTOGRAPHY_OSRANDOM_ENGINE CRYPTOGRAPHY_OSRANDOM_ENGINE_DEV_URANDOM
|
|
@ -27,10 +27,10 @@ class GmpyRecipe(CythonRecipe):
|
||||||
libgmp_build_dir = Recipe.get_recipe('libgmp', self.ctx).get_build_dir(arch.arch)
|
libgmp_build_dir = Recipe.get_recipe('libgmp', self.ctx).get_build_dir(arch.arch)
|
||||||
env['CFLAGS'] += ' -I%s' % (join(libgmp_build_dir, 'include'))
|
env['CFLAGS'] += ' -I%s' % (join(libgmp_build_dir, 'include'))
|
||||||
|
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
target_python = Recipe.get_recipe('python3crystax', self.ctx).get_build_dir(arch.arch)
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
|
@ -1,495 +0,0 @@
|
||||||
# -*- makefile -*-
|
|
||||||
# The file Setup is used by the makesetup script to construct the files
|
|
||||||
# Makefile and config.c, from Makefile.pre and config.c.in,
|
|
||||||
# respectively. The file Setup itself is initially copied from
|
|
||||||
# Setup.dist; once it exists it will not be overwritten, so you can edit
|
|
||||||
# Setup to your heart's content. Note that Makefile.pre is created
|
|
||||||
# from Makefile.pre.in by the toplevel configure script.
|
|
||||||
|
|
||||||
# (VPATH notes: Setup and Makefile.pre are in the build directory, as
|
|
||||||
# are Makefile and config.c; the *.in and *.dist files are in the source
|
|
||||||
# directory.)
|
|
||||||
|
|
||||||
# Each line in this file describes one or more optional modules.
|
|
||||||
# Modules enabled here will not be compiled by the setup.py script,
|
|
||||||
# so the file can be used to override setup.py's behavior.
|
|
||||||
|
|
||||||
# Lines have the following structure:
|
|
||||||
#
|
|
||||||
# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
|
|
||||||
#
|
|
||||||
# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files)
|
|
||||||
# <cpparg> is anything starting with -I, -D, -U or -C
|
|
||||||
# <library> is anything ending in .a or beginning with -l or -L
|
|
||||||
# <module> is anything else but should be a valid Python
|
|
||||||
# identifier (letters, digits, underscores, beginning with non-digit)
|
|
||||||
#
|
|
||||||
# (As the makesetup script changes, it may recognize some other
|
|
||||||
# arguments as well, e.g. *.so and *.sl as libraries. See the big
|
|
||||||
# case statement in the makesetup script.)
|
|
||||||
#
|
|
||||||
# Lines can also have the form
|
|
||||||
#
|
|
||||||
# <name> = <value>
|
|
||||||
#
|
|
||||||
# which defines a Make variable definition inserted into Makefile.in
|
|
||||||
#
|
|
||||||
# Finally, if a line contains just the word "*shared*" (without the
|
|
||||||
# quotes but with the stars), then the following modules will not be
|
|
||||||
# built statically. The build process works like this:
|
|
||||||
#
|
|
||||||
# 1. Build all modules that are declared as static in Modules/Setup,
|
|
||||||
# combine them into libpythonxy.a, combine that into python.
|
|
||||||
# 2. Build all modules that are listed as shared in Modules/Setup.
|
|
||||||
# 3. Invoke setup.py. That builds all modules that
|
|
||||||
# a) are not builtin, and
|
|
||||||
# b) are not listed in Modules/Setup, and
|
|
||||||
# c) can be build on the target
|
|
||||||
#
|
|
||||||
# Therefore, modules declared to be shared will not be
|
|
||||||
# included in the config.c file, nor in the list of objects to be
|
|
||||||
# added to the library archive, and their linker options won't be
|
|
||||||
# added to the linker options. Rules to create their .o files and
|
|
||||||
# their shared libraries will still be added to the Makefile, and
|
|
||||||
# their names will be collected in the Make variable SHAREDMODS. This
|
|
||||||
# is used to build modules as shared libraries. (They can be
|
|
||||||
# installed using "make sharedinstall", which is implied by the
|
|
||||||
# toplevel "make install" target.) (For compatibility,
|
|
||||||
# *noconfig* has the same effect as *shared*.)
|
|
||||||
#
|
|
||||||
# In addition, *static* explicitly declares the following modules to
|
|
||||||
# be static. Lines containing "*static*" and "*shared*" may thus
|
|
||||||
# alternate throughout this file.
|
|
||||||
|
|
||||||
# NOTE: As a standard policy, as many modules as can be supported by a
|
|
||||||
# platform should be present. The distribution comes with all modules
|
|
||||||
# enabled that are supported by most platforms and don't require you
|
|
||||||
# to ftp sources from elsewhere.
|
|
||||||
|
|
||||||
|
|
||||||
# Some special rules to define PYTHONPATH.
|
|
||||||
# Edit the definitions below to indicate which options you are using.
|
|
||||||
# Don't add any whitespace or comments!
|
|
||||||
|
|
||||||
# Directories where library files get installed.
|
|
||||||
# DESTLIB is for Python modules; MACHDESTLIB for shared libraries.
|
|
||||||
DESTLIB=$(LIBDEST)
|
|
||||||
MACHDESTLIB=$(BINLIBDEST)
|
|
||||||
|
|
||||||
# NOTE: all the paths are now relative to the prefix that is computed
|
|
||||||
# at run time!
|
|
||||||
|
|
||||||
# Standard path -- don't edit.
|
|
||||||
# No leading colon since this is the first entry.
|
|
||||||
# Empty since this is now just the runtime prefix.
|
|
||||||
DESTPATH=
|
|
||||||
|
|
||||||
# Site specific path components -- should begin with : if non-empty
|
|
||||||
SITEPATH=
|
|
||||||
|
|
||||||
# Standard path components for test modules
|
|
||||||
TESTPATH=
|
|
||||||
|
|
||||||
# Path components for machine- or system-dependent modules and shared libraries
|
|
||||||
MACHDEPPATH=:plat-$(PLATDIR)
|
|
||||||
EXTRAMACHDEPPATH=
|
|
||||||
|
|
||||||
# Path component for the Tkinter-related modules
|
|
||||||
# The TKPATH variable is always enabled, to save you the effort.
|
|
||||||
TKPATH=:lib-tk
|
|
||||||
|
|
||||||
# Path component for old modules.
|
|
||||||
OLDPATH=:lib-old
|
|
||||||
|
|
||||||
COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH)$(OLDPATH)
|
|
||||||
PYTHONPATH=$(COREPYTHONPATH)
|
|
||||||
|
|
||||||
|
|
||||||
# The modules listed here can't be built as shared libraries for
|
|
||||||
# various reasons; therefore they are listed here instead of in the
|
|
||||||
# normal order.
|
|
||||||
|
|
||||||
# This only contains the minimal set of modules required to run the
|
|
||||||
# setup.py script in the root of the Python source tree.
|
|
||||||
|
|
||||||
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
|
|
||||||
_weakref _weakref.c # weak referencess
|
|
||||||
|
|
||||||
# The zipimport module is always imported at startup. Having it as a
|
|
||||||
# builtin module avoids some bootstrapping problems and reduces overhead.
|
|
||||||
zipimport zipimport.c
|
|
||||||
|
|
||||||
# The rest of the modules listed in this file are all commented out by
|
|
||||||
# default. Usually they can be detected and built as dynamically
|
|
||||||
# loaded modules by the new setup.py script added in Python 2.1. If
|
|
||||||
# you're on a platform that doesn't support dynamic loading, want to
|
|
||||||
# compile modules statically into the Python binary, or need to
|
|
||||||
# specify some odd set of compiler switches, you can uncomment the
|
|
||||||
# appropriate lines below.
|
|
||||||
|
|
||||||
# ======================================================================
|
|
||||||
|
|
||||||
# The Python symtable module depends on .h files that setup.py doesn't track
|
|
||||||
_symtable symtablemodule.c
|
|
||||||
|
|
||||||
# The SGI specific GL module:
|
|
||||||
|
|
||||||
GLHACK=-Dclear=__GLclear
|
|
||||||
#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11
|
|
||||||
|
|
||||||
# Pure module. Cannot be linked dynamically.
|
|
||||||
# -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE
|
|
||||||
#WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE
|
|
||||||
#PURE_INCLS=-I/usr/local/include
|
|
||||||
#PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs
|
|
||||||
#pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS)
|
|
||||||
|
|
||||||
# Uncommenting the following line tells makesetup that all following
|
|
||||||
# modules are to be built as shared libraries (see above for more
|
|
||||||
# detail; also note that *static* reverses this effect):
|
|
||||||
|
|
||||||
#*shared*
|
|
||||||
|
|
||||||
# GNU readline. Unlike previous Python incarnations, GNU readline is
|
|
||||||
# now incorporated in an optional module, configured in the Setup file
|
|
||||||
# instead of by a configure script switch. You may have to insert a
|
|
||||||
# -L option pointing to the directory where libreadline.* lives,
|
|
||||||
# and you may have to change -ltermcap to -ltermlib or perhaps remove
|
|
||||||
# it, depending on your system -- see the GNU readline instructions.
|
|
||||||
# It's okay for this to be a shared library, too.
|
|
||||||
|
|
||||||
#readline readline.c -lreadline -ltermcap
|
|
||||||
|
|
||||||
# Modules that should always be present (non UNIX dependent):
|
|
||||||
|
|
||||||
array arraymodule.c # array objects
|
|
||||||
cmath cmathmodule.c _math.c # -lm # complex math library functions
|
|
||||||
math mathmodule.c _math.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
|
|
||||||
#_testcapi _testcapimodule.c # Python C API test module
|
|
||||||
_random _randommodule.c # Random number generator
|
|
||||||
_collections _collectionsmodule.c # Container types
|
|
||||||
_heapq _heapqmodule.c # Heapq type
|
|
||||||
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
|
|
||||||
#_pickle _pickle.c # pickle accelerator
|
|
||||||
datetime datetimemodule.c # date/time type
|
|
||||||
_bisect _bisectmodule.c # Bisection algorithms
|
|
||||||
|
|
||||||
unicodedata unicodedata.c # static Unicode character database
|
|
||||||
|
|
||||||
# access to ISO C locale support
|
|
||||||
#_locale _localemodule.c # -lintl
|
|
||||||
|
|
||||||
|
|
||||||
# Modules with some UNIX dependencies -- on by default:
|
|
||||||
# (If you have a really backward UNIX, select and socket may not be
|
|
||||||
# supported...)
|
|
||||||
|
|
||||||
fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
|
|
||||||
#spwd spwdmodule.c # spwd(3)
|
|
||||||
#grp grpmodule.c # grp(3)
|
|
||||||
select selectmodule.c # select(2); not on ancient System V
|
|
||||||
|
|
||||||
# Memory-mapped files (also works on Win32).
|
|
||||||
#mmap mmapmodule.c
|
|
||||||
|
|
||||||
# CSV file helper
|
|
||||||
#_csv _csv.c
|
|
||||||
|
|
||||||
# Socket module helper for socket(2)
|
|
||||||
_socket socketmodule.c
|
|
||||||
|
|
||||||
# Socket module helper for SSL support; you must comment out the other
|
|
||||||
# socket line above, and possibly edit the SSL variable:
|
|
||||||
#SSL=/usr/local/ssl
|
|
||||||
#_ssl _ssl.c \
|
|
||||||
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
|
|
||||||
# -L$(SSL)/lib -lssl -lcrypto
|
|
||||||
|
|
||||||
# The crypt module is now disabled by default because it breaks builds
|
|
||||||
# on many systems (where -lcrypt is needed), e.g. Linux (I believe).
|
|
||||||
#
|
|
||||||
# First, look at Setup.config; configure may have set this for you.
|
|
||||||
|
|
||||||
#crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
|
|
||||||
|
|
||||||
|
|
||||||
# Some more UNIX dependent modules -- off by default, since these
|
|
||||||
# are not supported by all UNIX systems:
|
|
||||||
|
|
||||||
#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
|
|
||||||
#termios termios.c # Steen Lumholt's termios module
|
|
||||||
#resource resource.c # Jeremy Hylton's rlimit interface
|
|
||||||
|
|
||||||
|
|
||||||
# Multimedia modules -- off by default.
|
|
||||||
# These don't work for 64-bit platforms!!!
|
|
||||||
# #993173 says audioop works on 64-bit platforms, though.
|
|
||||||
# These represent audio samples or images as strings:
|
|
||||||
|
|
||||||
#audioop audioop.c # Operations on audio samples
|
|
||||||
#imageop imageop.c # Operations on images
|
|
||||||
|
|
||||||
|
|
||||||
# Note that the _md5 and _sha modules are normally only built if the
|
|
||||||
# system does not have the OpenSSL libs containing an optimized version.
|
|
||||||
|
|
||||||
# The _md5 module implements the RSA Data Security, Inc. MD5
|
|
||||||
# Message-Digest Algorithm, described in RFC 1321. The necessary files
|
|
||||||
# md5.c and md5.h are included here.
|
|
||||||
|
|
||||||
_md5 md5module.c md5.c
|
|
||||||
|
|
||||||
|
|
||||||
# The _sha module implements the SHA checksum algorithms.
|
|
||||||
# (NIST's Secure Hash Algorithms.)
|
|
||||||
_sha shamodule.c
|
|
||||||
_sha256 sha256module.c
|
|
||||||
_sha512 sha512module.c
|
|
||||||
|
|
||||||
|
|
||||||
# SGI IRIX specific modules -- off by default.
|
|
||||||
|
|
||||||
# These module work on any SGI machine:
|
|
||||||
|
|
||||||
# *** gl must be enabled higher up in this file ***
|
|
||||||
#fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager
|
|
||||||
#sgi sgimodule.c # sgi.nap() and a few more
|
|
||||||
|
|
||||||
# This module requires the header file
|
|
||||||
# /usr/people/4Dgifts/iristools/include/izoom.h:
|
|
||||||
#imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities
|
|
||||||
|
|
||||||
|
|
||||||
# These modules require the Multimedia Development Option (I think):
|
|
||||||
|
|
||||||
#al almodule.c -laudio # Audio Library
|
|
||||||
#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library
|
|
||||||
#cl clmodule.c -lcl -lawareaudio # Compression Library
|
|
||||||
#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video
|
|
||||||
|
|
||||||
|
|
||||||
# The FORMS library, by Mark Overmars, implements user interface
|
|
||||||
# components such as dialogs and buttons using SGI's GL and FM
|
|
||||||
# libraries. You must ftp the FORMS library separately from
|
|
||||||
# ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a.
|
|
||||||
# NOTE: if you want to be able to use FORMS and curses simultaneously
|
|
||||||
# (or both link them statically into the same binary), you must
|
|
||||||
# compile all of FORMS with the cc option "-Dclear=__GLclear".
|
|
||||||
|
|
||||||
# The FORMS variable must point to the FORMS subdirectory of the forms
|
|
||||||
# toplevel directory:
|
|
||||||
|
|
||||||
#FORMS=/ufs/guido/src/forms/FORMS
|
|
||||||
#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl
|
|
||||||
|
|
||||||
|
|
||||||
# SunOS specific modules -- off by default:
|
|
||||||
|
|
||||||
#sunaudiodev sunaudiodev.c
|
|
||||||
|
|
||||||
|
|
||||||
# A Linux specific module -- off by default; this may also work on
|
|
||||||
# some *BSDs.
|
|
||||||
|
|
||||||
#linuxaudiodev linuxaudiodev.c
|
|
||||||
|
|
||||||
|
|
||||||
# George Neville-Neil's timing module:
|
|
||||||
|
|
||||||
#timing timingmodule.c
|
|
||||||
|
|
||||||
|
|
||||||
# The _tkinter module.
|
|
||||||
#
|
|
||||||
# The command for _tkinter is long and site specific. Please
|
|
||||||
# uncomment and/or edit those parts as indicated. If you don't have a
|
|
||||||
# specific extension (e.g. Tix or BLT), leave the corresponding line
|
|
||||||
# commented out. (Leave the trailing backslashes in! If you
|
|
||||||
# experience strange errors, you may want to join all uncommented
|
|
||||||
# lines and remove the backslashes -- the backslash interpretation is
|
|
||||||
# done by the shell's "read" command and it may not be implemented on
|
|
||||||
# every system.
|
|
||||||
|
|
||||||
# *** Always uncomment this (leave the leading underscore in!):
|
|
||||||
# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
|
|
||||||
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
|
|
||||||
# -L/usr/local/lib \
|
|
||||||
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
|
|
||||||
# -I/usr/local/include \
|
|
||||||
# *** Uncomment and edit to reflect where your X11 header files are:
|
|
||||||
# -I/usr/X11R6/include \
|
|
||||||
# *** Or uncomment this for Solaris:
|
|
||||||
# -I/usr/openwin/include \
|
|
||||||
# *** Uncomment and edit for Tix extension only:
|
|
||||||
# -DWITH_TIX -ltix8.1.8.2 \
|
|
||||||
# *** Uncomment and edit for BLT extension only:
|
|
||||||
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
|
|
||||||
# *** Uncomment and edit for PIL (TkImaging) extension only:
|
|
||||||
# (See http://www.pythonware.com/products/pil/ for more info)
|
|
||||||
# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
|
|
||||||
# *** Uncomment and edit for TOGL extension only:
|
|
||||||
# -DWITH_TOGL togl.c \
|
|
||||||
# *** Uncomment and edit to reflect your Tcl/Tk versions:
|
|
||||||
# -ltk8.2 -ltcl8.2 \
|
|
||||||
# *** Uncomment and edit to reflect where your X11 libraries are:
|
|
||||||
# -L/usr/X11R6/lib \
|
|
||||||
# *** Or uncomment this for Solaris:
|
|
||||||
# -L/usr/openwin/lib \
|
|
||||||
# *** Uncomment these for TOGL extension only:
|
|
||||||
# -lGL -lGLU -lXext -lXmu \
|
|
||||||
# *** Uncomment for AIX:
|
|
||||||
# -lld \
|
|
||||||
# *** Always uncomment this; X11 libraries to link with:
|
|
||||||
# -lX11
|
|
||||||
|
|
||||||
# Lance Ellinghaus's syslog module
|
|
||||||
#syslog syslogmodule.c # syslog daemon interface
|
|
||||||
|
|
||||||
|
|
||||||
# Curses support, requring the System V version of curses, often
|
|
||||||
# provided by the ncurses library. e.g. on Linux, link with -lncurses
|
|
||||||
# instead of -lcurses).
|
|
||||||
#
|
|
||||||
# First, look at Setup.config; configure may have set this for you.
|
|
||||||
|
|
||||||
#_curses _cursesmodule.c -lcurses -ltermcap
|
|
||||||
# Wrapper for the panel library that's part of ncurses and SYSV curses.
|
|
||||||
#_curses_panel _curses_panel.c -lpanel -lncurses
|
|
||||||
|
|
||||||
|
|
||||||
# Generic (SunOS / SVR4) dynamic loading module.
|
|
||||||
# This is not needed for dynamic loading of Python modules --
|
|
||||||
# it is a highly experimental and dangerous device for calling
|
|
||||||
# *arbitrary* C functions in *arbitrary* shared libraries:
|
|
||||||
|
|
||||||
#dl dlmodule.c
|
|
||||||
|
|
||||||
|
|
||||||
# Modules that provide persistent dictionary-like semantics. You will
|
|
||||||
# probably want to arrange for at least one of them to be available on
|
|
||||||
# your machine, though none are defined by default because of library
|
|
||||||
# dependencies. The Python module anydbm.py provides an
|
|
||||||
# implementation independent wrapper for these; dumbdbm.py provides
|
|
||||||
# similar functionality (but slower of course) implemented in Python.
|
|
||||||
|
|
||||||
# The standard Unix dbm module has been moved to Setup.config so that
|
|
||||||
# it will be compiled as a shared library by default. Compiling it as
|
|
||||||
# a built-in module causes conflicts with the pybsddb3 module since it
|
|
||||||
# creates a static dependency on an out-of-date version of db.so.
|
|
||||||
#
|
|
||||||
# First, look at Setup.config; configure may have set this for you.
|
|
||||||
|
|
||||||
#dbm dbmmodule.c # dbm(3) may require -lndbm or similar
|
|
||||||
|
|
||||||
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
|
||||||
#
|
|
||||||
# First, look at Setup.config; configure may have set this for you.
|
|
||||||
|
|
||||||
#gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
|
|
||||||
|
|
||||||
|
|
||||||
# Sleepycat Berkeley DB interface.
|
|
||||||
#
|
|
||||||
# This requires the Sleepycat DB code, see http://www.sleepycat.com/
|
|
||||||
# The earliest supported version of that library is 3.0, the latest
|
|
||||||
# supported version is 4.0 (4.1 is specifically not supported, as that
|
|
||||||
# changes the semantics of transactional databases). A list of available
|
|
||||||
# releases can be found at
|
|
||||||
#
|
|
||||||
# http://www.sleepycat.com/update/index.html
|
|
||||||
#
|
|
||||||
# Edit the variables DB and DBLIBVERto point to the db top directory
|
|
||||||
# and the subdirectory of PORT where you built it.
|
|
||||||
#DB=/usr/local/BerkeleyDB.4.0
|
|
||||||
#DBLIBVER=4.0
|
|
||||||
#DBINC=$(DB)/include
|
|
||||||
#DBLIB=$(DB)/lib
|
|
||||||
#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
|
|
||||||
|
|
||||||
# Historical Berkeley DB 1.85
|
|
||||||
#
|
|
||||||
# This module is deprecated; the 1.85 version of the Berkeley DB library has
|
|
||||||
# bugs that can cause data corruption. If you can, use later versions of the
|
|
||||||
# library instead, available from <http://www.sleepycat.com/>.
|
|
||||||
|
|
||||||
#DB=/depot/sundry/src/berkeley-db/db.1.85
|
|
||||||
#DBPORT=$(DB)/PORT/irix.5.3
|
|
||||||
#bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Helper module for various ascii-encoders
|
|
||||||
binascii binascii.c
|
|
||||||
|
|
||||||
# Fred Drake's interface to the Python parser
|
|
||||||
parser parsermodule.c
|
|
||||||
|
|
||||||
# cStringIO and cPickle
|
|
||||||
cStringIO cStringIO.c
|
|
||||||
cPickle cPickle.c
|
|
||||||
|
|
||||||
|
|
||||||
# Lee Busby's SIGFPE modules.
|
|
||||||
# The library to link fpectl with is platform specific.
|
|
||||||
# Choose *one* of the options below for fpectl:
|
|
||||||
|
|
||||||
# For SGI IRIX (tested on 5.3):
|
|
||||||
#fpectl fpectlmodule.c -lfpe
|
|
||||||
|
|
||||||
# For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2):
|
|
||||||
# (Without the compiler you don't have -lsunmath.)
|
|
||||||
#fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
|
|
||||||
|
|
||||||
# For other systems: see instructions in fpectlmodule.c.
|
|
||||||
#fpectl fpectlmodule.c ...
|
|
||||||
|
|
||||||
# Test module for fpectl. No extra libraries needed.
|
|
||||||
#fpetest fpetestmodule.c
|
|
||||||
|
|
||||||
# Andrew Kuchling's zlib module.
|
|
||||||
# This require zlib 1.1.3 (or later).
|
|
||||||
# See http://www.gzip.org/zlib/
|
|
||||||
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
|
|
||||||
|
|
||||||
# Interface to the Expat XML parser
|
|
||||||
#
|
|
||||||
# Expat was written by James Clark and is now maintained by a group of
|
|
||||||
# developers on SourceForge; see www.libexpat.org for more
|
|
||||||
# information. The pyexpat module was written by Paul Prescod after a
|
|
||||||
# prototype by Jack Jansen. Source of Expat 1.95.2 is included in
|
|
||||||
# Modules/expat/. Usage of a system shared libexpat.so/expat.dll is
|
|
||||||
# not advised.
|
|
||||||
#
|
|
||||||
# More information on Expat can be found at www.libexpat.org.
|
|
||||||
#
|
|
||||||
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
|
|
||||||
|
|
||||||
|
|
||||||
# Hye-Shik Chang's CJKCodecs
|
|
||||||
|
|
||||||
# multibytecodec is required for all the other CJK codec modules
|
|
||||||
#_multibytecodec cjkcodecs/multibytecodec.c
|
|
||||||
|
|
||||||
#_codecs_cn cjkcodecs/_codecs_cn.c
|
|
||||||
#_codecs_hk cjkcodecs/_codecs_hk.c
|
|
||||||
#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
|
|
||||||
#_codecs_jp cjkcodecs/_codecs_jp.c
|
|
||||||
#_codecs_kr cjkcodecs/_codecs_kr.c
|
|
||||||
#_codecs_tw cjkcodecs/_codecs_tw.c
|
|
||||||
|
|
||||||
# Example -- included for reference only:
|
|
||||||
# xx xxmodule.c
|
|
||||||
|
|
||||||
# Another example -- the 'xxsubtype' module shows C-level subtyping in action
|
|
||||||
xxsubtype xxsubtype.c
|
|
|
@ -1,60 +0,0 @@
|
||||||
|
|
||||||
from pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning
|
|
||||||
from os.path import join, exists
|
|
||||||
from os import environ
|
|
||||||
import sh
|
|
||||||
|
|
||||||
|
|
||||||
class Hostpython2Recipe(Recipe):
|
|
||||||
version = '2.7.13'
|
|
||||||
url = 'http://python.org/ftp/python/{version}/Python-{version}.tar.xz'
|
|
||||||
name = 'hostpython2'
|
|
||||||
|
|
||||||
conflicts = ['hostpython3']
|
|
||||||
|
|
||||||
def get_build_container_dir(self, arch=None):
|
|
||||||
choices = self.check_recipe_choices()
|
|
||||||
dir_name = '-'.join([self.name] + choices)
|
|
||||||
return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop')
|
|
||||||
|
|
||||||
def get_build_dir(self, arch=None):
|
|
||||||
return join(self.get_build_container_dir(), self.name)
|
|
||||||
|
|
||||||
def prebuild_arch(self, arch):
|
|
||||||
# Override hostpython Setup?
|
|
||||||
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
|
|
||||||
join(self.get_build_dir(), 'Modules', 'Setup'))
|
|
||||||
|
|
||||||
def build_arch(self, arch):
|
|
||||||
env = dict(environ)
|
|
||||||
with current_directory(self.get_build_dir()):
|
|
||||||
|
|
||||||
if exists('hostpython'):
|
|
||||||
info('hostpython already exists, skipping build')
|
|
||||||
self.ctx.hostpython = join(self.get_build_dir(),
|
|
||||||
'hostpython')
|
|
||||||
self.ctx.hostpgen = join(self.get_build_dir(),
|
|
||||||
'hostpgen')
|
|
||||||
return
|
|
||||||
|
|
||||||
configure = sh.Command('./configure')
|
|
||||||
|
|
||||||
shprint(configure, _env=env)
|
|
||||||
shprint(sh.make, '-j5', _env=env)
|
|
||||||
|
|
||||||
shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen')
|
|
||||||
|
|
||||||
if exists('python.exe'):
|
|
||||||
shprint(sh.mv, 'python.exe', 'hostpython')
|
|
||||||
elif exists('python'):
|
|
||||||
shprint(sh.mv, 'python', 'hostpython')
|
|
||||||
else:
|
|
||||||
warning('Unable to find the python executable after '
|
|
||||||
'hostpython build! Exiting.')
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
self.ctx.hostpython = join(self.get_build_dir(), 'hostpython')
|
|
||||||
self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen')
|
|
||||||
|
|
||||||
|
|
||||||
recipe = Hostpython2Recipe()
|
|
46
recipes/hostpython3crystax/__init__.py
Normal file
46
recipes/hostpython3crystax/__init__.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
from pythonforandroid.toolchain import Recipe, shprint
|
||||||
|
from os.path import join
|
||||||
|
import sh
|
||||||
|
|
||||||
|
|
||||||
|
class Hostpython3Recipe(Recipe):
|
||||||
|
version = 'auto' # the version is taken from the python3crystax recipe
|
||||||
|
name = 'hostpython3crystax'
|
||||||
|
|
||||||
|
conflicts = ['hostpython2']
|
||||||
|
|
||||||
|
def get_build_container_dir(self, arch=None):
|
||||||
|
choices = self.check_recipe_choices()
|
||||||
|
dir_name = '-'.join([self.name] + choices)
|
||||||
|
return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop')
|
||||||
|
|
||||||
|
# def prebuild_armeabi(self):
|
||||||
|
# # Override hostpython Setup?
|
||||||
|
# shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
|
||||||
|
# join(self.get_build_dir('armeabi'), 'Modules', 'Setup'))
|
||||||
|
|
||||||
|
def get_build_dir(self, arch=None):
|
||||||
|
return join(self.get_build_container_dir(), self.name)
|
||||||
|
|
||||||
|
def build_arch(self, arch):
|
||||||
|
"""
|
||||||
|
Creates expected build and symlinks system Python version.
|
||||||
|
"""
|
||||||
|
self.ctx.hostpython = '/usr/bin/false'
|
||||||
|
self.ctx.hostpgen = '/usr/bin/false'
|
||||||
|
# creates the sub buildir (used by other recipes)
|
||||||
|
# https://github.com/kivy/python-for-android/issues/1154
|
||||||
|
sub_build_dir = join(self.get_build_dir(), 'build')
|
||||||
|
shprint(sh.mkdir, '-p', sub_build_dir)
|
||||||
|
python3crystax = self.get_recipe('python3crystax', self.ctx)
|
||||||
|
system_python = sh.which("python" + python3crystax.version)
|
||||||
|
if system_python is None:
|
||||||
|
raise OSError(
|
||||||
|
('Trying to use python3crystax=={} but this Python version '
|
||||||
|
'is not installed locally.').format(python3crystax.version))
|
||||||
|
link_dest = join(self.get_build_dir(), 'hostpython')
|
||||||
|
shprint(sh.ln, '-sf', system_python, link_dest)
|
||||||
|
|
||||||
|
|
||||||
|
recipe = Hostpython3Recipe()
|
||||||
|
|
14
recipes/idna/__init__.py
Normal file
14
recipes/idna/__init__.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from pythonforandroid.recipe import PythonRecipe
|
||||||
|
|
||||||
|
|
||||||
|
class IdnaRecipe(PythonRecipe):
|
||||||
|
name = 'idna'
|
||||||
|
version = '2.6'
|
||||||
|
url = 'https://github.com/kjd/idna/archive/v{version}.tar.gz'
|
||||||
|
|
||||||
|
depends = [('python2', 'python3crystax'), 'setuptools']
|
||||||
|
|
||||||
|
call_hostpython_via_targetpython = False
|
||||||
|
|
||||||
|
|
||||||
|
recipe = IdnaRecipe()
|
|
@ -7,7 +7,7 @@ class IncrementalRecipe(PythonRecipe):
|
||||||
version = '17.5.0'
|
version = '17.5.0'
|
||||||
url = 'https://pypi.python.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-{version}.tar.gz'
|
||||||
|
|
||||||
depends = ['python2', 'setuptools']
|
depends = [('python2', 'python3crystax'), 'setuptools']
|
||||||
|
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
install_in_hostpython = True
|
install_in_hostpython = True
|
||||||
|
|
|
@ -6,9 +6,7 @@ class IpaddressRecipe(PythonRecipe):
|
||||||
version = '1.0.16'
|
version = '1.0.16'
|
||||||
url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz'
|
||||||
|
|
||||||
depends = ['python2']
|
depends = [('python2', 'python3crystax')]
|
||||||
|
|
||||||
call_hostpython_via_targetpython = False
|
|
||||||
|
|
||||||
|
|
||||||
recipe = IpaddressRecipe()
|
recipe = IpaddressRecipe()
|
3
recipes/libffi/Application.mk
Normal file
3
recipes/libffi/Application.mk
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
APP_OPTIM := release
|
||||||
|
APP_ABI := all # or armeabi
|
||||||
|
APP_MODULES := libffi
|
83
recipes/libffi/__init__.py
Normal file
83
recipes/libffi/__init__.py
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
from os.path import exists, join
|
||||||
|
from pythonforandroid.recipe import Recipe
|
||||||
|
from pythonforandroid.logger import info, shprint
|
||||||
|
from pythonforandroid.util import current_directory
|
||||||
|
import sh
|
||||||
|
|
||||||
|
|
||||||
|
class LibffiRecipe(Recipe):
|
||||||
|
name = 'libffi'
|
||||||
|
version = 'v3.2.1'
|
||||||
|
url = 'https://github.com/atgreen/libffi/archive/{version}.zip'
|
||||||
|
|
||||||
|
patches = ['remove-version-info.patch']
|
||||||
|
|
||||||
|
def get_host(self, arch):
|
||||||
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
host = None
|
||||||
|
with open('Makefile') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith('host = '):
|
||||||
|
host = line.strip()[7:]
|
||||||
|
break
|
||||||
|
|
||||||
|
if not host or not exists(host):
|
||||||
|
raise RuntimeError('failed to find build output! ({})'
|
||||||
|
.format(host))
|
||||||
|
|
||||||
|
return host
|
||||||
|
|
||||||
|
def should_build(self, arch):
|
||||||
|
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))
|
||||||
|
|
||||||
|
def build_arch(self, arch):
|
||||||
|
env = self.get_recipe_env(arch)
|
||||||
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
if not exists('configure'):
|
||||||
|
shprint(sh.Command('./autogen.sh'), _env=env)
|
||||||
|
shprint(sh.Command('autoreconf'), '-vif', _env=env)
|
||||||
|
shprint(sh.Command('./configure'),
|
||||||
|
'--host=' + arch.toolchain_prefix,
|
||||||
|
'--prefix=' + self.ctx.get_python_install_dir(),
|
||||||
|
'--enable-shared', _env=env)
|
||||||
|
#'--with-sysroot={}'.format(self.ctx.ndk_platform),
|
||||||
|
#'--target={}'.format(arch.toolchain_prefix),
|
||||||
|
|
||||||
|
# ndk 15 introduces unified headers required --sysroot and
|
||||||
|
# -isysroot for libraries and headers. libtool's head explodes
|
||||||
|
# trying to weave them into it's own magic. The result is a link
|
||||||
|
# failure tryng to link libc. We call make to compile the bits
|
||||||
|
# and manually link...
|
||||||
|
|
||||||
|
try:
|
||||||
|
shprint(sh.make, '-j5', 'libffi.la', _env=env)
|
||||||
|
except sh.ErrorReturnCode_2:
|
||||||
|
info("make libffi.la failed as expected")
|
||||||
|
cc = sh.Command(env['CC'].split()[0])
|
||||||
|
cflags = env['CC'].split()[1:]
|
||||||
|
|
||||||
|
cflags.extend(['-march=armv7-a', '-mfloat-abi=softfp', '-mfpu=vfp',
|
||||||
|
'-mthumb', '-shared', '-fPIC', '-DPIC',
|
||||||
|
'src/.libs/prep_cif.o', 'src/.libs/types.o',
|
||||||
|
'src/.libs/raw_api.o', 'src/.libs/java_raw_api.o',
|
||||||
|
'src/.libs/closures.o', 'src/arm/.libs/sysv.o',
|
||||||
|
'src/arm/.libs/ffi.o', ]
|
||||||
|
)
|
||||||
|
|
||||||
|
ldflags = env['LDFLAGS'].split()
|
||||||
|
cflags.extend(ldflags)
|
||||||
|
cflags.extend(['-Wl,-soname', '-Wl,libffi.so', '-o',
|
||||||
|
'.libs/libffi.so'])
|
||||||
|
|
||||||
|
with current_directory(self.get_host(arch)):
|
||||||
|
shprint(cc, *cflags, _env=env)
|
||||||
|
|
||||||
|
shprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch),
|
||||||
|
join(self.get_host(arch), '.libs', 'libffi.so'))
|
||||||
|
|
||||||
|
def get_include_dirs(self, arch):
|
||||||
|
return [join(self.get_build_dir(arch.arch), self.get_host(arch),
|
||||||
|
'include')]
|
||||||
|
|
||||||
|
|
||||||
|
recipe = LibffiRecipe()
|
35
recipes/libffi/disable-mips-check.patch
Normal file
35
recipes/libffi/disable-mips-check.patch
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
diff -Naur libffi/Android.mk b/Android.mk
|
||||||
|
--- libffi/Android.mk 2015-12-22 17:00:48.025478556 -0600
|
||||||
|
+++ b/Android.mk 2015-12-22 17:02:23.999249390 -0600
|
||||||
|
@@ -23,23 +23,20 @@
|
||||||
|
# Build rules for the target.
|
||||||
|
#
|
||||||
|
|
||||||
|
-# We only build ffi for mips.
|
||||||
|
-ifeq ($(TARGET_ARCH),mips)
|
||||||
|
|
||||||
|
- include $(CLEAR_VARS)
|
||||||
|
+include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
- ffi_arch := $(TARGET_ARCH)
|
||||||
|
- ffi_os := $(TARGET_OS)
|
||||||
|
+ffi_arch := $(TARGET_ARCH)
|
||||||
|
+ffi_os := $(TARGET_OS)
|
||||||
|
|
||||||
|
- # This include just keeps the nesting a bit saner.
|
||||||
|
- include $(LOCAL_PATH)/Libffi.mk
|
||||||
|
+# This include just keeps the nesting a bit saner.
|
||||||
|
+include $(LOCAL_PATH)/Libffi.mk
|
||||||
|
|
||||||
|
- LOCAL_MODULE_TAGS := optional
|
||||||
|
- LOCAL_MODULE := libffi
|
||||||
|
+LOCAL_MODULE_TAGS := optional
|
||||||
|
+LOCAL_MODULE := libffi
|
||||||
|
|
||||||
|
- include $(BUILD_SHARED_LIBRARY)
|
||||||
|
+include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
-endif
|
||||||
|
|
||||||
|
# Also include the rules for the test suite.
|
||||||
|
include external/libffi/testsuite/Android.mk
|
12
recipes/libffi/remove-version-info.patch
Normal file
12
recipes/libffi/remove-version-info.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff -Naur libffi/Makefile.am b/Makefile.am
|
||||||
|
--- libffi/Makefile.am 2014-11-12 06:00:59.000000000 -0600
|
||||||
|
+++ b/Makefile.am 2015-12-23 15:57:10.363148806 -0600
|
||||||
|
@@ -249,7 +249,7 @@
|
||||||
|
AM_CFLAGS += -DFFI_DEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
|
-libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
|
||||||
|
+libffi_la_LDFLAGS = -no-undefined -avoid-version $(LTLDFLAGS) $(AM_LTLDFLAGS)
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
|
||||||
|
AM_CCASFLAGS = $(AM_CPPFLAGS)
|
|
@ -3,6 +3,7 @@ from os.path import exists, join, realpath
|
||||||
from os import uname
|
from os import uname
|
||||||
import glob
|
import glob
|
||||||
import sh
|
import sh
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class LibGMPRecipe(Recipe):
|
class LibGMPRecipe(Recipe):
|
||||||
|
@ -18,8 +19,20 @@ class LibGMPRecipe(Recipe):
|
||||||
env = super(LibGMPRecipe, self).get_recipe_env(arch)
|
env = super(LibGMPRecipe, self).get_recipe_env(arch)
|
||||||
env['LIBGMP_LDFLAGS'] = '-avoid-version'
|
env['LIBGMP_LDFLAGS'] = '-avoid-version'
|
||||||
|
|
||||||
return env
|
ndk_dir = self.ctx.ndk_platform
|
||||||
|
ndk_lib_dir = os.path.join(ndk_dir, 'usr', 'lib')
|
||||||
|
if self.ctx.ndk == 'crystax':
|
||||||
|
crystax_lib_dir = os.path.join(self.ctx.ndk_dir, 'sources/crystax/libs', arch.arch)
|
||||||
|
env['CFLAGS'] = '{} -L{} -L{}'.format(env.get('CFLAGS'), crystax_lib_dir, ndk_lib_dir);
|
||||||
|
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(ndk_lib_dir)
|
||||||
|
env['LDFLAGS'] += " --sysroot={}".format(self.ctx.ndk_platform)
|
||||||
|
env['PYTHONPATH'] = ':'.join([
|
||||||
|
self.ctx.get_site_packages_dir(),
|
||||||
|
env['BUILDLIB_PATH'],
|
||||||
|
])
|
||||||
|
|
||||||
|
return env
|
||||||
|
|
||||||
def build_arch(self, arch):
|
def build_arch(self, arch):
|
||||||
with current_directory(self.get_build_dir(arch.arch)):
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
|
33
recipes/libsecp256k1/__init__.py
Normal file
33
recipes/libsecp256k1/__init__.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
from pythonforandroid.toolchain import shprint, current_directory
|
||||||
|
from pythonforandroid.recipe import Recipe
|
||||||
|
from multiprocessing import cpu_count
|
||||||
|
from os.path import exists
|
||||||
|
import sh
|
||||||
|
|
||||||
|
|
||||||
|
class LibSecp256k1Recipe(Recipe):
|
||||||
|
|
||||||
|
version = 'b0452e6'
|
||||||
|
url = 'https://github.com/bitcoin-core/secp256k1/archive/{version}.zip'
|
||||||
|
|
||||||
|
def build_arch(self, arch):
|
||||||
|
super(LibSecp256k1Recipe, self).build_arch(arch)
|
||||||
|
env = self.get_recipe_env(arch)
|
||||||
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
if not exists('configure'):
|
||||||
|
shprint(sh.Command('./autogen.sh'), _env=env)
|
||||||
|
shprint(
|
||||||
|
sh.Command('./configure'),
|
||||||
|
'--host=' + arch.toolchain_prefix,
|
||||||
|
'--prefix=' + self.ctx.get_python_install_dir(),
|
||||||
|
'--enable-shared',
|
||||||
|
'--enable-module-recovery',
|
||||||
|
'--enable-experimental',
|
||||||
|
'--enable-module-ecdh',
|
||||||
|
_env=env)
|
||||||
|
shprint(sh.make, '-j' + str(cpu_count()), _env=env)
|
||||||
|
libs = ['.libs/libsecp256k1.so']
|
||||||
|
self.install_libs(arch, *libs)
|
||||||
|
|
||||||
|
|
||||||
|
recipe = LibSecp256k1Recipe()
|
|
@ -24,8 +24,8 @@ class MiniupnpcRecipe(CythonRecipe):
|
||||||
|
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,31 @@
|
||||||
import glob
|
import glob
|
||||||
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, Recipe
|
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, Recipe
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
import os
|
||||||
import sh
|
import sh
|
||||||
|
|
||||||
|
|
||||||
class NetifacesRecipe(CompiledComponentsPythonRecipe):
|
class NetifacesRecipe(CompiledComponentsPythonRecipe):
|
||||||
version = '0.10.7'
|
version = '0.10.7'
|
||||||
url = 'https://files.pythonhosted.org/packages/81/39/4e9a026265ba944ddf1fea176dbb29e0fe50c43717ba4fcf3646d099fe38/netifaces-{version}.tar.gz'
|
url = 'https://files.pythonhosted.org/packages/81/39/4e9a026265ba944ddf1fea176dbb29e0fe50c43717ba4fcf3646d099fe38/netifaces-{version}.tar.gz'
|
||||||
depends = ['python2', 'setuptools']
|
depends = [('python2', 'python3crystax'), 'setuptools']
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
|
patches = ['socket-ioctls.patch']
|
||||||
|
|
||||||
def get_recipe_env(self, arch):
|
def get_recipe_env(self, arch):
|
||||||
env = super(NetifacesRecipe, self).get_recipe_env(arch)
|
env = super(NetifacesRecipe, self).get_recipe_env(arch)
|
||||||
|
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
|
||||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
if self.ctx.ndk == 'crystax':
|
||||||
|
# only keeps major.minor (discards patch)
|
||||||
|
python_version = self.ctx.python_recipe.version[0:3]
|
||||||
|
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
|
||||||
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
|
||||||
|
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
|
||||||
|
# until `pythonforandroid/archs.py` gets merged upstream:
|
||||||
|
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
|
||||||
|
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
29
recipes/netifaces/socket-ioctls.patch
Normal file
29
recipes/netifaces/socket-ioctls.patch
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
--- a/netifaces.c 2018-09-25 21:26:48.238476102 +0100
|
||||||
|
+++ b/netifaces.c 2018-09-25 21:55:14.201995669 +0100
|
||||||
|
@@ -22,6 +22,10 @@
|
||||||
|
obj = Py_InitModule3((name), (methods), (doc));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef HAVE_SOCKET_IOCTLS
|
||||||
|
+#define HAVE_SOCKET_IOCTLS 1
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifndef WIN32
|
||||||
|
|
||||||
|
# include <sys/types.h>
|
||||||
|
@@ -178,12 +182,12 @@
|
||||||
|
# include <ifaddrs.h>
|
||||||
|
# endif /* HAVE_GETIFADDRS */
|
||||||
|
|
||||||
|
-# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF)
|
||||||
|
+//# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF)
|
||||||
|
/* If the platform doesn't define, what we need, barf. If you're seeing this,
|
||||||
|
it means you need to write suitable code to retrieve interface information
|
||||||
|
on your system. */
|
||||||
|
-# error You need to add code for your platform.
|
||||||
|
-# endif
|
||||||
|
+//# error You need to add code for your platform.
|
||||||
|
+//# endif
|
||||||
|
|
||||||
|
#else /* defined(WIN32) */
|
||||||
|
|
|
@ -57,7 +57,7 @@ class OpenSSLRecipe(Recipe):
|
||||||
break
|
break
|
||||||
shprint(sh.make, 'clean', _env=env)
|
shprint(sh.make, 'clean', _env=env)
|
||||||
|
|
||||||
self.install_libs(arch, 'libssl' + self.version + '.so',
|
self.install_libs(arch, 'libssl.a', 'libssl' + self.version + '.so',
|
||||||
'libcrypto' + self.version + '.so')
|
'libcrypto.a', 'libcrypto' + self.version + '.so')
|
||||||
|
|
||||||
recipe = OpenSSLRecipe()
|
recipe = OpenSSLRecipe()
|
||||||
|
|
|
@ -5,8 +5,7 @@ from pythonforandroid.toolchain import PythonRecipe
|
||||||
class PyASN1Recipe(PythonRecipe):
|
class PyASN1Recipe(PythonRecipe):
|
||||||
version = '0.4.2'
|
version = '0.4.2'
|
||||||
url = 'https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz'
|
||||||
depends = ['python2']
|
depends = [('python2', 'python3crystax')]
|
||||||
|
|
||||||
call_hostpython_via_targetpython = False
|
|
||||||
|
|
||||||
recipe = PyASN1Recipe()
|
recipe = PyASN1Recipe()
|
||||||
|
|
|
@ -18,10 +18,10 @@ class PyjniusRecipe(CythonRecipe):
|
||||||
|
|
||||||
def get_recipe_env(self, arch):
|
def get_recipe_env(self, arch):
|
||||||
env = super(PyjniusRecipe, self).get_recipe_env(arch)
|
env = super(PyjniusRecipe, self).get_recipe_env(arch)
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
target_python = Recipe.get_recipe('python3crystax', self.ctx).get_build_dir(arch.arch)
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
13
recipes/pyopenssl/__init__.py
Normal file
13
recipes/pyopenssl/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from pythonforandroid.recipe import PythonRecipe
|
||||||
|
|
||||||
|
|
||||||
|
class PyOpenSSLRecipe(PythonRecipe):
|
||||||
|
version = '17.4.0'
|
||||||
|
url = 'https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-{version}.tar.gz'
|
||||||
|
depends = [('python2', 'python3crystax'), 'openssl', 'setuptools']
|
||||||
|
site_packages_name = 'OpenSSL'
|
||||||
|
|
||||||
|
call_hostpython_via_targetpython = False
|
||||||
|
|
||||||
|
|
||||||
|
recipe = PyOpenSSLRecipe()
|
|
@ -1,4 +0,0 @@
|
||||||
SSL=
|
|
||||||
_ssl _ssl.c \
|
|
||||||
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
|
|
||||||
-L$(SSL) -lssl$(OPENSSL_VERSION) -lcrypto$(OPENSSL_VERSION)
|
|
|
@ -1,203 +0,0 @@
|
||||||
|
|
||||||
from pythonforandroid.recipe import TargetPythonRecipe, Recipe
|
|
||||||
from pythonforandroid.toolchain import shprint, current_directory, info
|
|
||||||
from pythonforandroid.patching import (is_linux, is_darwin, is_api_gt,
|
|
||||||
check_all, is_api_lt, is_ndk)
|
|
||||||
from os.path import exists, join, realpath
|
|
||||||
import sh
|
|
||||||
|
|
||||||
|
|
||||||
class Python2Recipe(TargetPythonRecipe):
|
|
||||||
version = "2.7.13"
|
|
||||||
url = 'http://python.org/ftp/python/{version}/Python-{version}.tar.xz'
|
|
||||||
name = 'python2'
|
|
||||||
|
|
||||||
depends = ['hostpython2']
|
|
||||||
conflicts = ['python3crystax', 'python3']
|
|
||||||
opt_depends = ['openssl','sqlite3']
|
|
||||||
|
|
||||||
patches = [ # 2.7.13-specific patches
|
|
||||||
'patches/Python-{version}-xcompile.patch',
|
|
||||||
'patches/Python-{version}-ctypes-disable-wchar.patch',
|
|
||||||
'patches/Python-{version}-ctypes-libffi-fix-configure.patch',
|
|
||||||
'patches/ffi-config.sub-{version}.patch',
|
|
||||||
# 'patches/fix-locale-{version}.patch',
|
|
||||||
'patches/fix-platform-{version}.patch',
|
|
||||||
'patches/fix-platform-processor.patch',
|
|
||||||
'patches/fix-pwdmodule.patch',
|
|
||||||
'patches/modules-locales-{version}.patch',
|
|
||||||
|
|
||||||
# Old 2.7.2 patches
|
|
||||||
'patches/ctypes-find-library.patch',
|
|
||||||
'patches/custom-loader.patch',
|
|
||||||
'patches/disable-modules.patch',
|
|
||||||
'patches/fix-dlfcn.patch',
|
|
||||||
'patches/fix-dynamic-lookup.patch',
|
|
||||||
'patches/fix-filesystemdefaultencoding.patch',
|
|
||||||
'patches/fix-gethostbyaddr.patch',
|
|
||||||
'patches/fix-termios.patch' ]
|
|
||||||
|
|
||||||
from_crystax = False
|
|
||||||
|
|
||||||
def build_arch(self, arch):
|
|
||||||
|
|
||||||
if not exists(join(self.get_build_dir(arch.arch), 'libpython2.7.so')):
|
|
||||||
self.do_python_build(arch)
|
|
||||||
|
|
||||||
if not exists(self.ctx.get_python_install_dir()):
|
|
||||||
shprint(sh.cp, '-a', join(self.get_build_dir(arch.arch), 'python-install'),
|
|
||||||
self.ctx.get_python_install_dir())
|
|
||||||
|
|
||||||
# This should be safe to run every time
|
|
||||||
info('Copying hostpython binary to targetpython folder')
|
|
||||||
shprint(sh.cp, self.ctx.hostpython,
|
|
||||||
join(self.ctx.get_python_install_dir(), 'bin', 'python.host'))
|
|
||||||
self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host')
|
|
||||||
|
|
||||||
if not exists(join(self.ctx.get_libs_dir(arch.arch), 'libpython2.7.so')):
|
|
||||||
shprint(sh.cp, join(self.get_build_dir(arch.arch), 'libpython2.7.so'), self.ctx.get_libs_dir(arch.arch))
|
|
||||||
|
|
||||||
|
|
||||||
# # if exists(join(self.get_build_dir(arch.arch), 'libpython2.7.so')):
|
|
||||||
# if exists(join(self.ctx.libs_dir, 'libpython2.7.so')):
|
|
||||||
# info('libpython2.7.so already exists, skipping python build.')
|
|
||||||
# if not exists(join(self.ctx.get_python_install_dir(), 'libpython2.7.so')):
|
|
||||||
# info('Copying python-install to dist-dependent location')
|
|
||||||
# shprint(sh.cp, '-a', 'python-install', self.ctx.get_python_install_dir())
|
|
||||||
# self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host')
|
|
||||||
|
|
||||||
# return
|
|
||||||
|
|
||||||
def do_python_build(self, arch):
|
|
||||||
shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch))
|
|
||||||
shprint(sh.cp, self.ctx.hostpgen, join(self.get_build_dir(arch.arch), 'Parser'))
|
|
||||||
hostpython = join(self.get_build_dir(arch.arch), 'hostpython')
|
|
||||||
hostpgen = join(self.get_build_dir(arch.arch), 'hostpython')
|
|
||||||
|
|
||||||
with current_directory(self.get_build_dir(arch.arch)):
|
|
||||||
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
|
|
||||||
shprint(sh.cp, join(hostpython_recipe.get_recipe_dir(), 'Setup'), 'Modules')
|
|
||||||
env = arch.get_env()
|
|
||||||
|
|
||||||
# AND: Should probably move these to get_recipe_env for
|
|
||||||
# neatness, but the whole recipe needs tidying along these
|
|
||||||
# lines
|
|
||||||
env['HOSTARCH'] = 'arm-linux-androideabi'
|
|
||||||
env['BUILDARCH'] = shprint(sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0]
|
|
||||||
env['CFLAGS'] = ' '.join([env['CFLAGS'], '-DNO_MALLINFO'])
|
|
||||||
env['LDFLAGS'] += ' -Wl,--allow-multiple-definition'
|
|
||||||
|
|
||||||
# TODO need to add a should_build that checks if optional
|
|
||||||
# dependencies have changed (possibly in a generic way)
|
|
||||||
if 'openssl' in self.ctx.recipe_build_order:
|
|
||||||
r = Recipe.get_recipe('openssl', self.ctx)
|
|
||||||
openssl_build_dir = r.get_build_dir(arch.arch)
|
|
||||||
setuplocal = join('Modules', 'Setup.local')
|
|
||||||
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup.local-ssl'), setuplocal)
|
|
||||||
#shprint(sh.cat, join(self.get_recipe_dir(), 'Setup.local-ssl'), '>>', setuplocal)
|
|
||||||
shprint(sh.sed, '-i.backup', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), setuplocal)
|
|
||||||
env['OPENSSL_VERSION'] = r.version
|
|
||||||
env['CFLAGS'] += ' -I%s' % join(openssl_build_dir, 'include')
|
|
||||||
env['LDFLAGS'] += ' -L%s' % openssl_build_dir
|
|
||||||
|
|
||||||
if 'sqlite3' in self.ctx.recipe_build_order:
|
|
||||||
# Include sqlite3 in python2 build
|
|
||||||
r = Recipe.get_recipe('sqlite3', self.ctx)
|
|
||||||
i = ' -I' + r.get_build_dir(arch.arch)
|
|
||||||
l = ' -L' + r.get_lib_dir(arch) + ' -lsqlite3'
|
|
||||||
# Insert or append to env
|
|
||||||
f = 'CPPFLAGS'
|
|
||||||
env[f] = env[f] + i if f in env else i
|
|
||||||
f = 'LDFLAGS'
|
|
||||||
env[f] = env[f] + l if f in env else l
|
|
||||||
|
|
||||||
|
|
||||||
with open('config.site', 'w') as fileh:
|
|
||||||
fileh.write('''
|
|
||||||
ac_cv_file__dev_ptmx=no
|
|
||||||
ac_cv_file__dev_ptc=no
|
|
||||||
ac_cv_have_long_long_format=yes
|
|
||||||
''')
|
|
||||||
|
|
||||||
configure = sh.Command('./configure')
|
|
||||||
# AND: OFLAG isn't actually set, should it be?
|
|
||||||
shprint(configure,
|
|
||||||
'CROSS_COMPILE_TARGET=yes',
|
|
||||||
'CONFIG_SITE=config.site',
|
|
||||||
'--host={}'.format(env['HOSTARCH']),
|
|
||||||
'--build={}'.format(env['BUILDARCH']),
|
|
||||||
'--prefix={}'.format(realpath('./python-install')),
|
|
||||||
'--enable-shared',
|
|
||||||
'--enable-ipv6',
|
|
||||||
'--disable-toolbox-glue',
|
|
||||||
'--disable-framework',
|
|
||||||
'--with-system-ffi',
|
|
||||||
_env=env)
|
|
||||||
|
|
||||||
# AND: tito left this comment in the original source. It's still true!
|
|
||||||
# FIXME, the first time, we got a error at:
|
|
||||||
# python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
|
|
||||||
# /home/tito/code/python-for-android/build/python/Python-2.7.2/python: 1: Syntax error: word unexpected (expecting ")")
|
|
||||||
# because at this time, python is arm, not x86. even that, why /usr/include/netinet/in.h is used ?
|
|
||||||
# check if we can avoid this part.
|
|
||||||
|
|
||||||
# Hardcoded, remove -I/usr/include/x86_64-linux-gnu from CCSHARED and CFLAGS
|
|
||||||
# to prevent overriding android arm sysroot includes
|
|
||||||
make = sh.Command(env['MAKE'].split(' ')[0])
|
|
||||||
print('First install (expected to fail...')
|
|
||||||
try:
|
|
||||||
shprint(make, '-j5', 'install', 'HOSTPYTHON={}'.format(hostpython),
|
|
||||||
'HOSTPGEN={}'.format(hostpgen),
|
|
||||||
'CROSS_COMPILE_TARGET=yes',
|
|
||||||
'INSTSONAME=libpython2.7.so',
|
|
||||||
_env=env)
|
|
||||||
except sh.ErrorReturnCode_2:
|
|
||||||
print('First python2 make failed. This is expected, trying again.')
|
|
||||||
|
|
||||||
print('Make compile...')
|
|
||||||
shprint(make, '-j5', 'HOSTPYTHON={}'.format(hostpython),
|
|
||||||
'HOSTPGEN={}'.format(hostpgen),
|
|
||||||
'CROSS_COMPILE_TARGET=yes',
|
|
||||||
'INSTSONAME=libpython2.7.so',
|
|
||||||
_env=env)
|
|
||||||
|
|
||||||
print('Second install (expected to work)')
|
|
||||||
shprint(sh.touch, 'python.exe', 'python')
|
|
||||||
# -k added to keep going (need to figure out the reason for make: *** [libinstall] Error 1)
|
|
||||||
shprint(make, '-j5', 'install', 'HOSTPYTHON={}'.format(hostpython),
|
|
||||||
'HOSTPGEN={}'.format(hostpgen),
|
|
||||||
'CROSS_COMPILE_TARGET=yes',
|
|
||||||
'INSTSONAME=libpython2.7.so',
|
|
||||||
_env=env)
|
|
||||||
|
|
||||||
if is_darwin():
|
|
||||||
shprint(sh.cp, join(self.get_recipe_dir(), 'patches', '_scproxy.py'),
|
|
||||||
join('python-install', 'Lib'))
|
|
||||||
shprint(sh.cp, join(self.get_recipe_dir(), 'patches', '_scproxy.py'),
|
|
||||||
join('python-install', 'lib', 'python2.7'))
|
|
||||||
|
|
||||||
# reduce python
|
|
||||||
for dir_name in ('test', join('json', 'tests'), 'lib-tk',
|
|
||||||
join('sqlite3', 'test'), join('unittest, test'),
|
|
||||||
join('lib2to3', 'tests'), join('bsddb', 'tests'),
|
|
||||||
join('distutils', 'tests'), join('email', 'test'),
|
|
||||||
'curses'):
|
|
||||||
shprint(sh.rm, '-rf', join('python-install',
|
|
||||||
'lib', 'python2.7', dir_name))
|
|
||||||
|
|
||||||
|
|
||||||
# info('Copying python-install to dist-dependent location')
|
|
||||||
# shprint(sh.cp, '-a', 'python-install', self.ctx.get_python_install_dir())
|
|
||||||
|
|
||||||
# print('Copying hostpython binary to targetpython folder')
|
|
||||||
# shprint(sh.cp, self.ctx.hostpython,
|
|
||||||
# join(self.ctx.get_python_install_dir(), 'bin', 'python.host'))
|
|
||||||
# self.ctx.hostpython = join(self.ctx.get_python_install_dir(), 'bin', 'python.host')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print('python2 build done, exiting for debug')
|
|
||||||
# exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
recipe = Python2Recipe()
|
|
|
@ -1,76 +0,0 @@
|
||||||
--- Python-2.7.9/Lib/ctypes/__init__.py.orig 2014-12-10 16:59:33.000000000 +0100
|
|
||||||
+++ Python-2.7.9/Lib/ctypes/__init__.py 2016-03-17 14:00:15.636079979 +0100
|
|
||||||
@@ -268,7 +268,7 @@
|
|
||||||
if _os.name in ("nt", "ce"):
|
|
||||||
_win_functype_cache.clear()
|
|
||||||
# _SimpleCData.c_wchar_p_from_param
|
|
||||||
- POINTER(c_wchar).from_param = c_wchar_p.from_param
|
|
||||||
+ # POINTER(c_wchar).from_param = c_wchar_p.from_param
|
|
||||||
# _SimpleCData.c_char_p_from_param
|
|
||||||
POINTER(c_char).from_param = c_char_p.from_param
|
|
||||||
_pointer_type_cache[None] = c_void_p
|
|
||||||
@@ -288,29 +288,34 @@
|
|
||||||
else:
|
|
||||||
set_conversion_mode("ascii", "strict")
|
|
||||||
|
|
||||||
- class c_wchar_p(_SimpleCData):
|
|
||||||
- _type_ = "Z"
|
|
||||||
-
|
|
||||||
- class c_wchar(_SimpleCData):
|
|
||||||
- _type_ = "u"
|
|
||||||
-
|
|
||||||
- def create_unicode_buffer(init, size=None):
|
|
||||||
- """create_unicode_buffer(aString) -> character array
|
|
||||||
- create_unicode_buffer(anInteger) -> character array
|
|
||||||
- create_unicode_buffer(aString, anInteger) -> character array
|
|
||||||
- """
|
|
||||||
- if isinstance(init, (str, unicode)):
|
|
||||||
- if size is None:
|
|
||||||
- size = len(init)+1
|
|
||||||
- buftype = c_wchar * size
|
|
||||||
- buf = buftype()
|
|
||||||
- buf.value = init
|
|
||||||
- return buf
|
|
||||||
- elif isinstance(init, (int, long)):
|
|
||||||
- buftype = c_wchar * init
|
|
||||||
- buf = buftype()
|
|
||||||
- return buf
|
|
||||||
- raise TypeError(init)
|
|
||||||
+# The wchar stuff causes a crash on Android (the bionic C library doesn't
|
|
||||||
+# implement wchar_t anyway)
|
|
||||||
+#
|
|
||||||
+# class c_wchar_p(_SimpleCData):
|
|
||||||
+# _type_ = "Z"
|
|
||||||
+#
|
|
||||||
+# class c_wchar(_SimpleCData):
|
|
||||||
+# _type_ = "u"
|
|
||||||
+#
|
|
||||||
+# POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param
|
|
||||||
+#
|
|
||||||
+# def create_unicode_buffer(init, size=None):
|
|
||||||
+# """create_unicode_buffer(aString) -> character array
|
|
||||||
+# create_unicode_buffer(anInteger) -> character array
|
|
||||||
+# create_unicode_buffer(aString, anInteger) -> character array
|
|
||||||
+# """
|
|
||||||
+# if isinstance(init, (str, unicode)):
|
|
||||||
+# if size is None:
|
|
||||||
+# size = len(init)+1
|
|
||||||
+# buftype = c_wchar * size
|
|
||||||
+# buf = buftype()
|
|
||||||
+# buf.value = init
|
|
||||||
+# return buf
|
|
||||||
+# elif isinstance(init, (int, long)):
|
|
||||||
+# buftype = c_wchar * init
|
|
||||||
+# buf = buftype()
|
|
||||||
+# return buf
|
|
||||||
+# raise TypeError(init)
|
|
||||||
|
|
||||||
# XXX Deprecated
|
|
||||||
def SetPointerType(pointer, cls):
|
|
||||||
@@ -552,4 +557,4 @@
|
|
||||||
elif sizeof(kind) == 8: c_uint64 = kind
|
|
||||||
del(kind)
|
|
||||||
|
|
||||||
-_reset_cache()
|
|
||||||
+_reset_cache()
|
|
||||||
\ No hay ningún carácter de nueva línea al final del fichero
|
|
|
@ -1,33 +0,0 @@
|
||||||
diff -pruN Python-2.7.9.orig//Modules/_ctypes/libffi/configure.ac Python-2.7.9/Modules/_ctypes/libffi/configure.ac
|
|
||||||
--- Python-2.7.9.orig//Modules/_ctypes/libffi/configure.ac 2009-04-28 22:01:18.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Modules/_ctypes/libffi/configure.ac 2010-04-20 22:46:02.000000000 +0200
|
|
||||||
@@ -409,7 +409,7 @@
|
|
||||||
|
|
||||||
AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
|
|
||||||
|
|
||||||
-AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
|
|
||||||
+AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile )
|
|
||||||
|
|
||||||
AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
|
|
||||||
|
|
||||||
diff -pruN Python-2.7.9.orig//Modules/_ctypes/libffi/Makefile.am Python-2.7.9/Modules/_ctypes/libffi/Makefile.am
|
|
||||||
--- Python-2.7.9.orig//Modules/_ctypes/libffi/Makefile.am 2008-03-04 21:09:11.000000000 +0100
|
|
||||||
+++ Python-2.7.9/Modules/_ctypes/libffi/Makefile.am 2010-04-20 22:54:03.000000000 +0200
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign subdir-objects
|
|
||||||
|
|
||||||
-SUBDIRS = include testsuite man
|
|
||||||
+SUBDIRS = include
|
|
||||||
|
|
||||||
EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
|
|
||||||
src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
|
|
||||||
@@ -34,8 +34,6 @@
|
|
||||||
libtool-version ChangeLog.libffi m4/libtool.m4 \
|
|
||||||
m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4
|
|
||||||
|
|
||||||
-info_TEXINFOS = doc/libffi.texi
|
|
||||||
-
|
|
||||||
## ################################################################
|
|
||||||
|
|
||||||
##
|
|
|
@ -1,237 +0,0 @@
|
||||||
--- Python-2.7.13/configure 2016-12-17 21:05:07.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/configure 2017-08-10 12:59:24.094953614 +0100
|
|
||||||
@@ -14927,7 +14927,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
|
|
||||||
--- Python-2.7.13/Makefile.pre.in 2016-12-17 21:05:06.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/Makefile.pre.in 2017-08-11 00:17:32.557907871 +0100
|
|
||||||
@@ -199,6 +199,7 @@
|
|
||||||
|
|
||||||
PYTHON= python$(EXE)
|
|
||||||
BUILDPYTHON= python$(BUILDEXE)
|
|
||||||
+HOSTPYTHON= ./$(BUILDPYTHON)
|
|
||||||
|
|
||||||
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
|
|
||||||
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
|
|
||||||
@@ -246,6 +247,8 @@
|
|
||||||
# Parser
|
|
||||||
PGEN= Parser/pgen$(EXE)
|
|
||||||
|
|
||||||
+HOSTPGEN= $(PGEN)
|
|
||||||
+
|
|
||||||
PSRCS= \
|
|
||||||
Parser/acceler.c \
|
|
||||||
Parser/grammar1.c \
|
|
||||||
@@ -314,7 +317,7 @@
|
|
||||||
|
|
||||||
OPCODETARGETS_H= \
|
|
||||||
$(srcdir)/Python/opcode_targets.h
|
|
||||||
-
|
|
||||||
+
|
|
||||||
OPCODETARGETGEN= \
|
|
||||||
$(srcdir)/Python/makeopcodetargets.py
|
|
||||||
|
|
||||||
@@ -544,8 +547,8 @@
|
|
||||||
*) quiet="";; \
|
|
||||||
esac; \
|
|
||||||
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
|
||||||
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
|
||||||
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
|
||||||
+ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
|
|
||||||
+ $(HOSTPYTHON) -E $(srcdir)/setup.py $$quiet build
|
|
||||||
|
|
||||||
# Build static library
|
|
||||||
# avoid long command lines, same as LIBRARY_OBJS
|
|
||||||
@@ -681,7 +684,7 @@
|
|
||||||
|
|
||||||
$(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
|
|
||||||
@$(MKDIR_P) Include
|
|
||||||
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
|
||||||
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
|
||||||
$(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
|
|
||||||
touch $(GRAMMAR_C)
|
|
||||||
|
|
||||||
@@ -1120,28 +1123,28 @@
|
|
||||||
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
|
|
||||||
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
|
|
||||||
fi
|
|
||||||
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -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) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -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) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -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) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -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) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
|
|
||||||
+ $(HOSTPYTHON) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
|
|
||||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
||||||
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
|
||||||
+ $(HOSTPYTHON) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
|
||||||
|
|
||||||
# Create the PLATDIR source directory, if one wasn't distributed..
|
|
||||||
$(srcdir)/Lib/$(PLATDIR):
|
|
||||||
@@ -1253,11 +1256,13 @@
|
|
||||||
# Install the dynamically loadable modules
|
|
||||||
# This goes into $(exec_prefix)
|
|
||||||
sharedinstall: sharedmods
|
|
||||||
- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
|
||||||
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
|
||||||
+ $(RUNSHARED) $(HOSTPYTHON) $(srcdir)/setup.py install \
|
|
||||||
+ --skip-build \
|
|
||||||
--prefix=$(prefix) \
|
|
||||||
- --install-scripts=$(BINDIR) \
|
|
||||||
- --install-platlib=$(DESTSHARED) \
|
|
||||||
- --root=$(DESTDIR)/
|
|
||||||
+ --install-scripts=$(DESTDIR)$(BINDIR) \
|
|
||||||
+ --install-platlib=$(DESTDIR)$(DESTSHARED) \
|
|
||||||
+ --root=/
|
|
||||||
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
|
|
||||||
|
|
||||||
# Here are a couple of targets for MacOSX again, to install a full
|
|
||||||
--- Python-2.7.13/setup.py 2016-12-17 21:05:07.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/setup.py 2017-08-11 00:05:55.922860254 +0100
|
|
||||||
@@ -17,7 +17,7 @@
|
|
||||||
from distutils.command.install_lib import install_lib
|
|
||||||
from distutils.spawn import find_executable
|
|
||||||
|
|
||||||
-cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
|
|
||||||
+cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ or ('PYTHONXCPREFIX' in os.environ)
|
|
||||||
|
|
||||||
def get_platform():
|
|
||||||
# cross build
|
|
||||||
@@ -175,6 +175,7 @@
|
|
||||||
def __init__(self, dist):
|
|
||||||
build_ext.__init__(self, dist)
|
|
||||||
self.failed = []
|
|
||||||
+ self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes'
|
|
||||||
|
|
||||||
def build_extensions(self):
|
|
||||||
|
|
||||||
@@ -310,6 +311,14 @@
|
|
||||||
(ext.name, sys.exc_info()[1]))
|
|
||||||
self.failed.append(ext.name)
|
|
||||||
return
|
|
||||||
+
|
|
||||||
+ # Import check will not work when cross-compiling.
|
|
||||||
+ if os.environ.has_key('PYTHONXCPREFIX'):
|
|
||||||
+ self.announce(
|
|
||||||
+ 'WARNING: skipping import 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:
|
|
||||||
@@ -341,7 +350,7 @@
|
|
||||||
self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
|
||||||
|
|
||||||
# Don't try to load extensions for cross builds
|
|
||||||
- if cross_compiling:
|
|
||||||
+ if cross_compiling or self.cross_compile:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
@@ -455,11 +464,9 @@
|
|
||||||
|
|
||||||
def detect_modules(self):
|
|
||||||
# Ensure that /usr/local is always used
|
|
||||||
- if not cross_compiling:
|
|
||||||
+ if not cross_compiling or not self.cross_compile:
|
|
||||||
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
|
||||||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
|
||||||
- if cross_compiling:
|
|
||||||
- self.add_gcc_paths()
|
|
||||||
self.add_multiarch_paths()
|
|
||||||
|
|
||||||
# Add paths specified in the environment variables LDFLAGS and
|
|
||||||
@@ -496,16 +503,17 @@
|
|
||||||
for directory in reversed(options.dirs):
|
|
||||||
add_dir_to_list(dir_list, directory)
|
|
||||||
|
|
||||||
- if os.path.normpath(sys.prefix) != '/usr' \
|
|
||||||
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
|
|
||||||
+ #if os.path.normpath(sys.prefix) != '/usr' \
|
|
||||||
+ # and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
|
|
||||||
+ # and not self.cross_compile:
|
|
||||||
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
|
|
||||||
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
|
|
||||||
# building a framework with different architectures than
|
|
||||||
# the one that is currently installed (issue #7473)
|
|
||||||
- add_dir_to_list(self.compiler.library_dirs,
|
|
||||||
- sysconfig.get_config_var("LIBDIR"))
|
|
||||||
- add_dir_to_list(self.compiler.include_dirs,
|
|
||||||
- sysconfig.get_config_var("INCLUDEDIR"))
|
|
||||||
+ #add_dir_to_list(self.compiler.library_dirs,
|
|
||||||
+ # sysconfig.get_config_var("LIBDIR"))
|
|
||||||
+ #add_dir_to_list(self.compiler.include_dirs,
|
|
||||||
+ # sysconfig.get_config_var("INCLUDEDIR"))
|
|
||||||
|
|
||||||
try:
|
|
||||||
have_unicode = unicode
|
|
||||||
@@ -517,7 +525,7 @@
|
|
||||||
# be assumed that no additional -I,-L directives are needed.
|
|
||||||
inc_dirs = self.compiler.include_dirs[:]
|
|
||||||
lib_dirs = self.compiler.library_dirs[:]
|
|
||||||
- if not cross_compiling:
|
|
||||||
+ if not cross_compiling or not self.cross_compile:
|
|
||||||
for d in (
|
|
||||||
'/usr/include',
|
|
||||||
):
|
|
||||||
@@ -526,7 +534,14 @@
|
|
||||||
'/lib64', '/usr/lib64',
|
|
||||||
'/lib', '/usr/lib',
|
|
||||||
):
|
|
||||||
- add_dir_to_list(lib_dirs, d)
|
|
||||||
+ add_dir_to_list(lib_dirs, d)
|
|
||||||
+ else:
|
|
||||||
+ cflags = os.environ.get('CFLAGS')
|
|
||||||
+ if cflags:
|
|
||||||
+ inc_dirs += [x[2:] for x in cflags.split() if x.startswith('-I')]
|
|
||||||
+ ldflags = os.environ.get('LDFLAGS')
|
|
||||||
+ if ldflags:
|
|
||||||
+ lib_dirs += [x[2:] for x in ldflags.split() if x.startswith('-L')]
|
|
||||||
exts = []
|
|
||||||
missing = []
|
|
||||||
|
|
||||||
@@ -2048,8 +2063,15 @@
|
|
||||||
|
|
||||||
# Pass empty CFLAGS because we'll just append the resulting
|
|
||||||
# CFLAGS to Python's; -g or -O2 is to be avoided.
|
|
||||||
- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
|
|
||||||
- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
|
|
||||||
+ if cross_compiling or self.cross_compile:
|
|
||||||
+ cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \
|
|
||||||
+ % (ffi_builddir, ffi_srcdir,
|
|
||||||
+ os.environ.get('HOSTARCH'),
|
|
||||||
+ os.environ.get('BUILDARCH'),
|
|
||||||
+ " ".join(config_args))
|
|
||||||
+ else:
|
|
||||||
+ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
|
|
||||||
+ % (ffi_builddir, ffi_srcdir, " ".join(config_args))
|
|
||||||
|
|
||||||
res = os.system(cmd)
|
|
||||||
if res or not os.path.exists(ffi_configfile):
|
|
|
@ -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 {}
|
|
|
@ -1,29 +0,0 @@
|
||||||
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|
||||||
index 52b3520..01b13a9 100644
|
|
||||||
--- a/Lib/ctypes/util.py
|
|
||||||
+++ b/Lib/ctypes/util.py
|
|
||||||
@@ -71,7 +71,23 @@ if os.name == "ce":
|
|
||||||
def find_library(name):
|
|
||||||
return name
|
|
||||||
|
|
||||||
-if os.name == "posix" and sys.platform == "darwin":
|
|
||||||
+# This patch overrides the find_library to look in the right places on
|
|
||||||
+# Android
|
|
||||||
+if True:
|
|
||||||
+ def find_library(name):
|
|
||||||
+ # Check the user app lib dir
|
|
||||||
+ app_root = os.path.abspath('./').split(os.path.sep)[0:4]
|
|
||||||
+ lib_search = os.path.sep.join(app_root) + os.path.sep + 'lib'
|
|
||||||
+ for filename in os.listdir(lib_search):
|
|
||||||
+ if filename.endswith('.so') and name in filename:
|
|
||||||
+ return lib_search + os.path.sep + filename
|
|
||||||
+ # Check the normal Android system libraries
|
|
||||||
+ for filename in os.listdir('/system/lib'):
|
|
||||||
+ if filename.endswith('.so') and name in filename:
|
|
||||||
+ return lib_search + os.path.sep + filename
|
|
||||||
+ return None
|
|
||||||
+
|
|
||||||
+elif os.name == "posix" and sys.platform == "darwin":
|
|
||||||
from ctypes.macholib.dyld import dyld_find as _dyld_find
|
|
||||||
def find_library(name):
|
|
||||||
possible = ['lib%s.dylib' % name,
|
|
|
@ -1,67 +0,0 @@
|
||||||
--- Python-2.7.9.orig/Python/dynload_shlib.c 2010-05-09 16:46:46.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Python/dynload_shlib.c 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -6,6 +6,7 @@
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
|
||||||
#include <sys/param.h>
|
|
||||||
@@ -75,6 +76,21 @@
|
|
||||||
char pathbuf[260];
|
|
||||||
int dlopenflags=0;
|
|
||||||
|
|
||||||
+ static void *libpymodules = NULL;
|
|
||||||
+ void *rv = NULL;
|
|
||||||
+
|
|
||||||
+ /* Ensure we have access to libpymodules. */
|
|
||||||
+ if (libpymodules == NULL) {
|
|
||||||
+ printf("ANDROID_APP_PATH = %s\n", getenv("ANDROID_APP_PATH"));
|
|
||||||
+ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_APP_PATH"));
|
|
||||||
+ libpymodules = dlopen(pathbuf, RTLD_NOW);
|
|
||||||
+
|
|
||||||
+ if (libpymodules == NULL) {
|
|
||||||
+ //abort();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
if (strchr(pathname, '/') == NULL) {
|
|
||||||
/* Prefix bare filename with "./" */
|
|
||||||
PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname);
|
|
||||||
@@ -84,6 +100,17 @@
|
|
||||||
PyOS_snprintf(funcname, sizeof(funcname),
|
|
||||||
LEAD_UNDERSCORE "init%.200s", shortname);
|
|
||||||
|
|
||||||
+
|
|
||||||
+ /* Read symbols that have been linked into the main binary. */
|
|
||||||
+
|
|
||||||
+ if (libpymodules) {
|
|
||||||
+ rv = dlsym(libpymodules, funcname);
|
|
||||||
+ if (rv != NULL) {
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
if (fp != NULL) {
|
|
||||||
int i;
|
|
||||||
struct stat statb;
|
|
||||||
--- Python-2.7.2.orig/Python/pythonrun.c 2010-10-29 05:45:34.000000000 +0200
|
|
||||||
+++ Python-2.7.2/Python/pythonrun.c 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -254,9 +254,13 @@
|
|
||||||
_PyGILState_Init(interp, tstate);
|
|
||||||
#endif /* WITH_THREAD */
|
|
||||||
|
|
||||||
+ /* For PGS4A, we don't want to call initsite, as we won't have the
|
|
||||||
+ library path set up until start.pyx finishes running. */
|
|
||||||
+#if 0
|
|
||||||
if (!Py_NoSiteFlag)
|
|
||||||
initsite(); /* Module site */
|
|
||||||
-
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') {
|
|
||||||
p = icodeset = codeset = strdup(p);
|
|
||||||
free_codeset = 1;
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-2.7.13/setup.py 2016-12-17 21:05:07.000000000 +0100
|
|
||||||
+++ Python-2.7.13/setup.py.disabled 2017-08-10 19:47:06.658219931 +0100
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
|
|
||||||
|
|
||||||
# This global variable is used to hold the list of modules to be disabled.
|
|
||||||
-disabled_module_list = []
|
|
||||||
+disabled_module_list = ['_bsddb','_curses','_curses_panel','_locale','_tkinter','bsddb185','bz2','crypt','dbm','dl','gdbm','imageop','linuxaudiodev','nis','ossaudiodev','readline','spwd','sunaudiodev']
|
|
||||||
|
|
||||||
def add_dir_to_list(dirlist, dir):
|
|
||||||
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,40 +0,0 @@
|
||||||
--- Python-2.7.2.orig/configure 2012-07-09 23:48:02.000000000 +0200
|
|
||||||
+++ Python-2.7.2/configure 2012-07-09 23:47:34.000000000 +0200
|
|
||||||
@@ -4927,7 +4927,7 @@
|
|
||||||
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
|
|
||||||
INSTSONAME="$LDLIBRARY".$SOVERSION
|
|
||||||
;;
|
|
||||||
- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
|
|
||||||
+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|Darwin*)
|
|
||||||
LDLIBRARY='libpython$(VERSION).so'
|
|
||||||
BLDLIBRARY='-L. -lpython$(VERSION)'
|
|
||||||
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
|
|
||||||
@@ -4960,7 +4960,7 @@
|
|
||||||
BLDLIBRARY='-L. -lpython$(VERSION)'
|
|
||||||
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
|
|
||||||
;;
|
|
||||||
- Darwin*)
|
|
||||||
+ DDarwin*)
|
|
||||||
LDLIBRARY='libpython$(VERSION).dylib'
|
|
||||||
BLDLIBRARY='-L. -lpython$(VERSION)'
|
|
||||||
RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
|
|
||||||
@@ -7625,6 +7625,9 @@
|
|
||||||
LDSHARED='ld -b'
|
|
||||||
fi ;;
|
|
||||||
OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
|
|
||||||
+ Darwin*|Linux*|GNU*|QNX*)
|
|
||||||
+ LDSHARED='$(CC) -shared'
|
|
||||||
+ LDCXXSHARED='$(CXX) -shared';;
|
|
||||||
Darwin/1.3*)
|
|
||||||
LDSHARED='$(CC) -bundle'
|
|
||||||
LDCXXSHARED='$(CXX) -bundle'
|
|
||||||
@@ -7680,9 +7683,6 @@
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
- Linux*|GNU*|QNX*)
|
|
||||||
- LDSHARED='$(CC) -shared'
|
|
||||||
- LDCXXSHARED='$(CXX) -shared';;
|
|
||||||
BSD/OS*/4*)
|
|
||||||
LDSHARED="gcc -shared"
|
|
||||||
LDCXXSHARED="g++ -shared";;
|
|
|
@ -1,24 +0,0 @@
|
||||||
--- Python-2.7.2.orig/Lib/distutils/command/build_ext.py 2011-06-11 17:46:24.000000000 +0200
|
|
||||||
+++ Python-2.7.2/Lib/distutils/command/build_ext.py 2012-08-01 18:32:13.000000000 +0200
|
|
||||||
@@ -236,7 +236,7 @@
|
|
||||||
# Python's library directory must be appended to library_dirs
|
|
||||||
sysconfig.get_config_var('Py_ENABLE_SHARED')
|
|
||||||
if ((sys.platform.startswith('linux') or sys.platform.startswith('gnu')
|
|
||||||
- or sys.platform.startswith('sunos'))
|
|
||||||
+ or sys.platform.startswith('sunos') or sys.platform.startswith('darwin'))
|
|
||||||
and sysconfig.get_config_var('Py_ENABLE_SHARED')):
|
|
||||||
if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
|
|
||||||
# building third party extensions
|
|
||||||
@@ -750,9 +750,9 @@
|
|
||||||
# extensions, it is a reference to the original list
|
|
||||||
return ext.libraries + [pythonlib, "m"] + extra
|
|
||||||
|
|
||||||
- elif sys.platform == 'darwin':
|
|
||||||
- # Don't use the default code below
|
|
||||||
- return ext.libraries
|
|
||||||
+ #elif sys.platform == 'darwin':
|
|
||||||
+ # # Don't use the default code below
|
|
||||||
+ # return ext.libraries
|
|
||||||
elif sys.platform[:3] == 'aix':
|
|
||||||
# Don't use the default code below
|
|
||||||
return ext.libraries
|
|
|
@ -1,26 +0,0 @@
|
||||||
diff -Naur Python-2.7.2.orig/Lib/plat-linux2/DLFCN.py Python-2.7.2/Lib/plat-linux2/DLFCN.py
|
|
||||||
--- Python-2.7.2.orig/Lib/plat-linux2/DLFCN.py 2011-06-11 17:46:24.000000000 +0200
|
|
||||||
+++ Python-2.7.2/Lib/plat-linux2/DLFCN.py 2013-07-29 16:34:45.318131844 +0200
|
|
||||||
@@ -74,10 +74,17 @@
|
|
||||||
# Included from gnu/stubs.h
|
|
||||||
|
|
||||||
# Included from bits/dlfcn.h
|
|
||||||
+# PATCHED FOR ANDROID (the only supported symbols are):
|
|
||||||
+# enum {
|
|
||||||
+# RTLD_NOW = 0,
|
|
||||||
+# RTLD_LAZY = 1,
|
|
||||||
+# RTLD_LOCAL = 0,
|
|
||||||
+# RTLD_GLOBAL = 2,
|
|
||||||
+# };
|
|
||||||
RTLD_LAZY = 0x00001
|
|
||||||
-RTLD_NOW = 0x00002
|
|
||||||
-RTLD_BINDING_MASK = 0x3
|
|
||||||
-RTLD_NOLOAD = 0x00004
|
|
||||||
-RTLD_GLOBAL = 0x00100
|
|
||||||
+RTLD_NOW = 0x00000
|
|
||||||
+RTLD_BINDING_MASK = 0x0
|
|
||||||
+RTLD_NOLOAD = 0x00000
|
|
||||||
+RTLD_GLOBAL = 0x00002
|
|
||||||
RTLD_LOCAL = 0
|
|
||||||
-RTLD_NODELETE = 0x01000
|
|
||||||
+RTLD_NODELETE = 0x00000
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-2.7.13/Makefile.pre.in 2016-12-17 21:05:06.000000000 +0100
|
|
||||||
+++ Python-2.7.13/Makefile.pre.in.dyn 2017-08-10 22:09:59.311219406 +0100
|
|
||||||
@@ -568,7 +568,7 @@
|
|
||||||
fi
|
|
||||||
|
|
||||||
libpython$(VERSION).dylib: $(LIBRARY_OBJS)
|
|
||||||
- $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
|
||||||
+ $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
|
||||||
|
|
||||||
|
|
||||||
libpython$(VERSION).sl: $(LIBRARY_OBJS)
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-2.7.13/Python/bltinmodule.c 2016-12-17 21:05:07.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/Python/bltinmodule.c 2017-08-10 22:14:26.490843018 +0100
|
|
||||||
@@ -22,7 +22,7 @@
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
const char *Py_FileSystemDefaultEncoding = "utf-8";
|
|
||||||
#else
|
|
||||||
-const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
|
|
||||||
+const char *Py_FileSystemDefaultEncoding = "utf-8"; /* use default */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Forward */
|
|
|
@ -1,12 +0,0 @@
|
||||||
--- Python-2.7.2/Modules/socketmodule.c.orig 2012-01-06 01:40:09.915694810 +0100
|
|
||||||
+++ Python-2.7.2/Modules/socketmodule.c 2012-01-06 01:40:36.967694486 +0100
|
|
||||||
@@ -146,6 +146,9 @@
|
|
||||||
On the other hand, not all Linux versions agree, so there the settings
|
|
||||||
computed by the configure script are needed! */
|
|
||||||
|
|
||||||
+/* Android hack, same reason are what is described above */
|
|
||||||
+#undef HAVE_GETHOSTBYNAME_R
|
|
||||||
+
|
|
||||||
#ifndef linux
|
|
||||||
# undef HAVE_GETHOSTBYNAME_R_3_ARG
|
|
||||||
# undef HAVE_GETHOSTBYNAME_R_5_ARG
|
|
|
@ -1,77 +0,0 @@
|
||||||
--- Python-2.7.9.orig/Modules/posixmodule.c 2010-11-26 18:35:50.000000000 +0100
|
|
||||||
+++ Python-2.7.9/Modules/posixmodule.c 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -3775,13 +3775,6 @@
|
|
||||||
slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */
|
|
||||||
if (slave_fd < 0)
|
|
||||||
return posix_error();
|
|
||||||
-#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC)
|
|
||||||
- ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
|
|
||||||
- ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
|
|
||||||
-#ifndef __hpux
|
|
||||||
- ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */
|
|
||||||
-#endif /* __hpux */
|
|
||||||
-#endif /* HAVE_CYGWIN */
|
|
||||||
#endif /* HAVE_OPENPTY */
|
|
||||||
|
|
||||||
return Py_BuildValue("(ii)", master_fd, slave_fd);
|
|
||||||
--- Python-2.7.9.orig/Objects/stringlib/formatter.h 2010-08-01 12:45:15.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Objects/stringlib/formatter.h 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -639,13 +639,7 @@
|
|
||||||
get_locale_info(int type, LocaleInfo *locale_info)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
- case LT_CURRENT_LOCALE: {
|
|
||||||
- struct lconv *locale_data = localeconv();
|
|
||||||
- locale_info->decimal_point = locale_data->decimal_point;
|
|
||||||
- locale_info->thousands_sep = locale_data->thousands_sep;
|
|
||||||
- locale_info->grouping = locale_data->grouping;
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
+ case LT_CURRENT_LOCALE:
|
|
||||||
case LT_DEFAULT_LOCALE:
|
|
||||||
locale_info->decimal_point = ".";
|
|
||||||
locale_info->thousands_sep = ",";
|
|
||||||
--- Python-2.7.9.orig/Objects/stringlib/localeutil.h 2009-04-22 15:29:05.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Objects/stringlib/localeutil.h 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -202,9 +202,8 @@
|
|
||||||
Py_ssize_t n_digits,
|
|
||||||
Py_ssize_t min_width)
|
|
||||||
{
|
|
||||||
- struct lconv *locale_data = localeconv();
|
|
||||||
- const char *grouping = locale_data->grouping;
|
|
||||||
- const char *thousands_sep = locale_data->thousands_sep;
|
|
||||||
+ const char *grouping = "\3\0";
|
|
||||||
+ const char *thousands_sep = ",";
|
|
||||||
|
|
||||||
return _Py_InsertThousandsGrouping(buffer, n_buffer, digits, n_digits,
|
|
||||||
min_width, grouping, thousands_sep);
|
|
||||||
--- Python-2.7.9.orig/Python/pystrtod.c 2010-05-09 16:46:46.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Python/pystrtod.c 2011-04-20 17:52:12.000000000 +0200
|
|
||||||
@@ -126,7 +126,6 @@
|
|
||||||
{
|
|
||||||
char *fail_pos;
|
|
||||||
double val = -1.0;
|
|
||||||
- struct lconv *locale_data;
|
|
||||||
const char *decimal_point;
|
|
||||||
size_t decimal_point_len;
|
|
||||||
const char *p, *decimal_point_pos;
|
|
||||||
@@ -138,8 +137,7 @@
|
|
||||||
|
|
||||||
fail_pos = NULL;
|
|
||||||
|
|
||||||
- locale_data = localeconv();
|
|
||||||
- decimal_point = locale_data->decimal_point;
|
|
||||||
+ decimal_point = ".";
|
|
||||||
decimal_point_len = strlen(decimal_point);
|
|
||||||
|
|
||||||
assert(decimal_point_len != 0);
|
|
||||||
@@ -375,8 +373,7 @@
|
|
||||||
Py_LOCAL_INLINE(void)
|
|
||||||
change_decimal_from_locale_to_dot(char* buffer)
|
|
||||||
{
|
|
||||||
- struct lconv *locale_data = localeconv();
|
|
||||||
- const char *decimal_point = locale_data->decimal_point;
|
|
||||||
+ const char *decimal_point = ".";
|
|
||||||
|
|
||||||
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
|
|
||||||
size_t decimal_point_len = strlen(decimal_point);
|
|
|
@ -1,32 +0,0 @@
|
||||||
--- Python-2.7.9/Python/getplatform.c.orig 2014-12-10 16:59:59.000000000 +0100
|
|
||||||
+++ Python-2.7.9/Python/getplatform.c 2015-05-03 19:17:58.071596232 +0200
|
|
||||||
@@ -1,12 +1,25 @@
|
|
||||||
|
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
-#ifndef PLATFORM
|
|
||||||
-#define PLATFORM "unknown"
|
|
||||||
-#endif
|
|
||||||
+#include <sys/utsname.h>
|
|
||||||
+#include <string.h>
|
|
||||||
|
|
||||||
const char *
|
|
||||||
Py_GetPlatform(void)
|
|
||||||
{
|
|
||||||
- return PLATFORM;
|
|
||||||
+ struct utsname u;
|
|
||||||
+ int i;
|
|
||||||
+ if ( uname(&u) < 0 )
|
|
||||||
+ return "unknown";
|
|
||||||
+
|
|
||||||
+ char xx[37];
|
|
||||||
+ memset(xx, 0, 37);
|
|
||||||
+ strcat (xx, u.sysname);
|
|
||||||
+ strcat (xx, "-");
|
|
||||||
+ strcat (xx, u.machine);
|
|
||||||
+
|
|
||||||
+ for (i=0; xx[i]; i++)
|
|
||||||
+ xx[i]=tolower(xx[i]);
|
|
||||||
+
|
|
||||||
+ return xx;
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
--- Python-2.7.13/Lib/platform.py 2016-12-17 21:05:06.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/Lib/platform.py 2017-08-13 00:46:39.161864994 +0100
|
|
||||||
@@ -1311,7 +1311,18 @@
|
|
||||||
e.g. NetBSD does this.
|
|
||||||
|
|
||||||
"""
|
|
||||||
- return uname()[5]
|
|
||||||
+ # Attempt to obtain the processor name from /proc/cpuinfo on Android
|
|
||||||
+ processor_name = uname()[5]
|
|
||||||
+ if (processor_name.strip() == ""):
|
|
||||||
+ cpuinfo = '/proc/cpuinfo'
|
|
||||||
+ if (os.path.exists(cpuinfo)):
|
|
||||||
+ lines = tuple(open(cpuinfo, 'r'))
|
|
||||||
+ for line in lines:
|
|
||||||
+ if (line.startswith('model name') and line.index(':') > -1):
|
|
||||||
+ processor_name = line[line.index(':') + 1:].strip()
|
|
||||||
+ break
|
|
||||||
+
|
|
||||||
+ return processor_name
|
|
||||||
|
|
||||||
### Various APIs for extracting information from sys.version
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
--- Python-2.7.13/Modules/pwdmodule.c 2016-12-17 21:05:07.000000000 +0100
|
|
||||||
+++ Python-2.7.13-modified/Modules/pwdmodule.c 2017-08-10 13:55:19.603089081 +0100
|
|
||||||
@@ -75,7 +75,7 @@
|
|
||||||
#endif
|
|
||||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromUid(p->pw_uid));
|
|
||||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromGid(p->pw_gid));
|
|
||||||
-#ifdef __VMS
|
|
||||||
+#if defined(__VMS) || defined(ANDROID)
|
|
||||||
SETS(setIndex++, "");
|
|
||||||
#else
|
|
||||||
SETS(setIndex++, p->pw_gecos);
|
|
|
@ -1,29 +0,0 @@
|
||||||
--- Python-2.7.2.orig/Modules/termios.c 2012-06-12 02:49:39.780162534 +0200
|
|
||||||
+++ Python-2.7.2/Modules/termios.c 2012-06-12 02:51:52.092157828 +0200
|
|
||||||
@@ -227,6 +227,7 @@
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if 0 // No tcdrain defined for Android.
|
|
||||||
PyDoc_STRVAR(termios_tcdrain__doc__,
|
|
||||||
"tcdrain(fd) -> None\n\
|
|
||||||
\n\
|
|
||||||
@@ -246,6 +247,7 @@
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
PyDoc_STRVAR(termios_tcflush__doc__,
|
|
||||||
"tcflush(fd, queue) -> None\n\
|
|
||||||
@@ -301,8 +303,10 @@
|
|
||||||
METH_VARARGS, termios_tcsetattr__doc__},
|
|
||||||
{"tcsendbreak", termios_tcsendbreak,
|
|
||||||
METH_VARARGS, termios_tcsendbreak__doc__},
|
|
||||||
+#if 0 // No tcdrain defined for Android.
|
|
||||||
{"tcdrain", termios_tcdrain,
|
|
||||||
METH_VARARGS, termios_tcdrain__doc__},
|
|
||||||
+#endif
|
|
||||||
{"tcflush", termios_tcflush,
|
|
||||||
METH_VARARGS, termios_tcflush__doc__},
|
|
||||||
{"tcflow", termios_tcflow,
|
|
|
@ -1,27 +0,0 @@
|
||||||
--- Python-2.7.9/Modules/_localemodule.c.orig 2013-05-12 05:32:50.000000000 +0200
|
|
||||||
+++ Python-2.7.9/Modules/_localemodule.c 2015-05-02 21:33:42.241092717 +0200
|
|
||||||
@@ -20,6 +20,8 @@ This software comes with no warranty. Us
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#define ANDROID
|
|
||||||
+
|
|
||||||
#ifdef HAVE_LANGINFO_H
|
|
||||||
#include <langinfo.h>
|
|
||||||
#endif
|
|
||||||
@@ -205,6 +207,7 @@ PyDoc_STRVAR(localeconv__doc__,
|
|
||||||
static PyObject*
|
|
||||||
PyLocale_localeconv(PyObject* self)
|
|
||||||
{
|
|
||||||
+ #ifndef ANDROID
|
|
||||||
PyObject* result;
|
|
||||||
struct lconv *l;
|
|
||||||
PyObject *x;
|
|
||||||
@@ -265,6 +268,7 @@ PyLocale_localeconv(PyObject* self)
|
|
||||||
failed:
|
|
||||||
Py_XDECREF(result);
|
|
||||||
Py_XDECREF(x);
|
|
||||||
+ #endif // ANDROID
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
258
recipes/python3crystax/__init__.py
Normal file
258
recipes/python3crystax/__init__.py
Normal file
|
@ -0,0 +1,258 @@
|
||||||
|
from pythonforandroid.recipe import TargetPythonRecipe
|
||||||
|
from pythonforandroid.toolchain import shprint, current_directory, ArchARM
|
||||||
|
from pythonforandroid.logger import info, error
|
||||||
|
from pythonforandroid.util import ensure_dir, temp_directory
|
||||||
|
from os.path import exists, join
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
import sh
|
||||||
|
from sh import Command
|
||||||
|
|
||||||
|
# This is the content of opensslconf.h taken from
|
||||||
|
# ndkdir/build/tools/build-target-openssl.sh
|
||||||
|
OPENSSLCONF = """#if defined(__ARM_ARCH_5TE__)
|
||||||
|
#include "opensslconf_armeabi.h"
|
||||||
|
#elif defined(__ARM_ARCH_7A__) && !defined(__ARM_PCS_VFP)
|
||||||
|
#include "opensslconf_armeabi_v7a.h"
|
||||||
|
#elif defined(__ARM_ARCH_7A__) && defined(__ARM_PCS_VFP)
|
||||||
|
#include "opensslconf_armeabi_v7a_hard.h"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#include "opensslconf_arm64_v8a.h"
|
||||||
|
#elif defined(__i386__)
|
||||||
|
#include "opensslconf_x86.h"
|
||||||
|
#elif defined(__x86_64__)
|
||||||
|
#include "opensslconf_x86_64.h"
|
||||||
|
#elif defined(__mips__) && !defined(__mips64)
|
||||||
|
#include "opensslconf_mips.h"
|
||||||
|
#elif defined(__mips__) && defined(__mips64)
|
||||||
|
#include "opensslconf_mips64.h"
|
||||||
|
#else
|
||||||
|
#error "Unsupported ABI"
|
||||||
|
#endif
|
||||||
|
"""
|
||||||
|
LATEST_FULL_VERSION = {
|
||||||
|
'3.5': '3.5.1',
|
||||||
|
'3.6': '3.6.6',
|
||||||
|
'3.7': '3.7.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
def realpath(fname):
|
||||||
|
"""
|
||||||
|
Own implementation of os.realpath which may be broken in some python versions
|
||||||
|
Returns: the absolute path o
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not os.path.islink(fname):
|
||||||
|
return os.path.abspath(fname)
|
||||||
|
|
||||||
|
abs_path = os.path.abspath(fname).split(os.sep)[:-1]
|
||||||
|
rel_path = os.readlink(fname)
|
||||||
|
|
||||||
|
if os.path.abspath(rel_path) == rel_path:
|
||||||
|
return rel_path
|
||||||
|
|
||||||
|
rel_path = rel_path.split(os.sep)
|
||||||
|
for folder in rel_path:
|
||||||
|
if folder == '..':
|
||||||
|
abs_path.pop()
|
||||||
|
else:
|
||||||
|
abs_path.append(folder)
|
||||||
|
return os.sep.join(abs_path)
|
||||||
|
|
||||||
|
class Python3Recipe(TargetPythonRecipe):
|
||||||
|
version = '3.6'
|
||||||
|
url = ''
|
||||||
|
name = 'python3crystax'
|
||||||
|
|
||||||
|
depends = ['hostpython3crystax']
|
||||||
|
conflicts = ['python2', 'python3']
|
||||||
|
|
||||||
|
from_crystax = True
|
||||||
|
|
||||||
|
def download_if_necessary(self):
|
||||||
|
if 'openssl' in self.ctx.recipe_build_order or self.version == '3.6':
|
||||||
|
full_version = LATEST_FULL_VERSION[self.version]
|
||||||
|
Python3Recipe.url = 'https://www.python.org/ftp/python/{0}.{1}.{2}/Python-{0}.{1}.{2}.tgz'.format(*full_version.split('.'))
|
||||||
|
super(Python3Recipe, self).download_if_necessary()
|
||||||
|
|
||||||
|
def get_dir_name(self):
|
||||||
|
name = super(Python3Recipe, self).get_dir_name()
|
||||||
|
name += '-version{}'.format(self.version)
|
||||||
|
return name
|
||||||
|
|
||||||
|
def copy_include_dir(self, source, target):
|
||||||
|
ensure_dir(target)
|
||||||
|
for fname in os.listdir(source):
|
||||||
|
sh.ln('-sf', realpath(join(source, fname)), join(target, fname))
|
||||||
|
|
||||||
|
def _patch_dev_defaults(self, fp, target_ver):
|
||||||
|
for line in fp:
|
||||||
|
if 'OPENSSL_VERSIONS=' in line:
|
||||||
|
versions = line.split('"')[1].split(' ')
|
||||||
|
if versions[0] == target_ver:
|
||||||
|
raise ValueError('Patch not needed')
|
||||||
|
|
||||||
|
if target_ver in versions:
|
||||||
|
versions.remove(target_ver)
|
||||||
|
|
||||||
|
versions.insert(0, target_ver)
|
||||||
|
|
||||||
|
yield 'OPENSSL_VERSIONS="{}"\n'.format(' '.join(versions))
|
||||||
|
else:
|
||||||
|
yield line
|
||||||
|
|
||||||
|
def patch_dev_defaults(self, ssl_recipe):
|
||||||
|
def_fname = join(self.ctx.ndk_dir, 'build', 'tools', 'dev-defaults.sh')
|
||||||
|
try:
|
||||||
|
with open(def_fname, 'r') as fp:
|
||||||
|
s = ''.join(self._patch_dev_defaults(fp,
|
||||||
|
str(ssl_recipe.version)))
|
||||||
|
with open(def_fname, 'w') as fp:
|
||||||
|
fp.write(s)
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def check_for_sslso(self, ssl_recipe, arch):
|
||||||
|
# type: (Recipe, str)
|
||||||
|
dynlib_dir = join(self.ctx.ndk_dir, 'sources', 'python', self.version,
|
||||||
|
'libs', arch.arch, 'modules')
|
||||||
|
|
||||||
|
if os.path.exists(join(dynlib_dir, '_ssl.so')):
|
||||||
|
return 10, 'Shared object exists in ndk'
|
||||||
|
|
||||||
|
# find out why _ssl.so is missing
|
||||||
|
|
||||||
|
source_dir = join(self.ctx.ndk_dir, 'sources', 'openssl', ssl_recipe.version)
|
||||||
|
if not os.path.exists(source_dir):
|
||||||
|
return 0, 'Openssl version not present'
|
||||||
|
|
||||||
|
# these two path checks are lifted straight from:
|
||||||
|
# crystax-ndk/build/tools/build-target-python.sh
|
||||||
|
if not os.path.exists(join(source_dir, 'Android.mk')):
|
||||||
|
return 1.1, 'Android.mk is missing in openssl source'
|
||||||
|
|
||||||
|
include_dir = join(source_dir, 'include','openssl')
|
||||||
|
if not os.path.exists(join(include_dir, 'opensslconf.h')):
|
||||||
|
return 1.2, 'Openssl include dir missing'
|
||||||
|
|
||||||
|
under_scored_arch = arch.arch.replace('-', '_')
|
||||||
|
if not os.path.lexists(join(include_dir,
|
||||||
|
'opensslconf_{}.h'.format(under_scored_arch))):
|
||||||
|
return 1.3, 'Opensslconf arch header missing from include'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# lastly a check to see whether shared objects for the correct arch
|
||||||
|
# is present in the ndk
|
||||||
|
if not os.path.exists(join(source_dir, 'libs', arch.arch)):
|
||||||
|
return 2, 'Openssl libs for this arch is missing in ndk'
|
||||||
|
|
||||||
|
return 5, 'Ready to recompile python'
|
||||||
|
|
||||||
|
def find_Android_mk(self):
|
||||||
|
openssl_dir = join(self.ctx.ndk_dir, 'sources', 'openssl')
|
||||||
|
for version in os.listdir(openssl_dir):
|
||||||
|
mk_path = join(openssl_dir, version, 'Android.mk')
|
||||||
|
if os.path.exists(mk_path):
|
||||||
|
return mk_path
|
||||||
|
|
||||||
|
def prebuild_arch(self, arch):
|
||||||
|
super(Python3Recipe, self).prebuild_arch(arch)
|
||||||
|
if self.version == '3.6':
|
||||||
|
Python3Recipe.patches = ['patch_python3.6.patch']
|
||||||
|
build_dir = self.get_build_dir(arch.arch)
|
||||||
|
shprint(sh.ln, '-sf',
|
||||||
|
realpath(join(build_dir, 'Lib/site-packages/README.txt')),
|
||||||
|
join(build_dir, 'Lib/site-packages/README'))
|
||||||
|
python_build_files = ['android.mk', 'config.c', 'interpreter.c']
|
||||||
|
ndk_build_tools_python_dir = join(self.ctx.ndk_dir, 'build', 'tools', 'build-target-python')
|
||||||
|
for python_build_file in python_build_files:
|
||||||
|
shprint(sh.cp, join(ndk_build_tools_python_dir, python_build_file+'.3.5'),
|
||||||
|
join(ndk_build_tools_python_dir, python_build_file+'.3.6'))
|
||||||
|
ndk_sources_python_dir = join(self.ctx.ndk_dir, 'sources', 'python')
|
||||||
|
if not os.path.exists(join(ndk_sources_python_dir, '3.6')):
|
||||||
|
os.mkdir(join(ndk_sources_python_dir, '3.6'))
|
||||||
|
sh.sed('s#3.5#3.6#',
|
||||||
|
join(ndk_sources_python_dir, '3.5/Android.mk'),
|
||||||
|
_out=join(ndk_sources_python_dir, '3.6/Android.mk'))
|
||||||
|
|
||||||
|
def build_arch(self, arch):
|
||||||
|
# If openssl is needed we may have to recompile cPython to get the
|
||||||
|
# ssl.py module working properly
|
||||||
|
if self.from_crystax and 'openssl' in self.ctx.recipe_build_order:
|
||||||
|
info('Openssl and crystax-python combination may require '
|
||||||
|
'recompilation of python...')
|
||||||
|
ssl_recipe = self.get_recipe('openssl', self.ctx)
|
||||||
|
stage, msg = self.check_for_sslso(ssl_recipe, arch)
|
||||||
|
stage = 0 if stage < 5 else stage
|
||||||
|
info(msg)
|
||||||
|
openssl_build_dir = ssl_recipe.get_build_dir(arch.arch)
|
||||||
|
openssl_ndk_dir = join(self.ctx.ndk_dir, 'sources', 'openssl',
|
||||||
|
ssl_recipe.version)
|
||||||
|
|
||||||
|
if stage < 2:
|
||||||
|
info('Copying openssl headers and Android.mk to ndk')
|
||||||
|
ensure_dir(openssl_ndk_dir)
|
||||||
|
if stage < 1.2:
|
||||||
|
# copy include folder and Android.mk to ndk
|
||||||
|
mk_path = self.find_Android_mk()
|
||||||
|
if mk_path is None:
|
||||||
|
raise IOError('Android.mk file could not be found in '
|
||||||
|
'any versions in ndk->sources->openssl')
|
||||||
|
shprint(sh.cp, mk_path, openssl_ndk_dir)
|
||||||
|
|
||||||
|
include_dir = join(openssl_build_dir, 'include')
|
||||||
|
if stage < 1.3:
|
||||||
|
ndk_include_dir = join(openssl_ndk_dir, 'include', 'openssl')
|
||||||
|
self.copy_include_dir(join(include_dir, 'openssl'), ndk_include_dir)
|
||||||
|
|
||||||
|
target_conf = join(openssl_ndk_dir, 'include', 'openssl',
|
||||||
|
'opensslconf.h')
|
||||||
|
shprint(sh.rm, '-f', target_conf)
|
||||||
|
# overwrite opensslconf.h
|
||||||
|
with open(target_conf, 'w') as fp:
|
||||||
|
fp.write(OPENSSLCONF)
|
||||||
|
|
||||||
|
if stage < 1.4:
|
||||||
|
# move current conf to arch specific conf in ndk
|
||||||
|
under_scored_arch = arch.arch.replace('-', '_')
|
||||||
|
shprint(sh.ln, '-sf',
|
||||||
|
realpath(join(include_dir, 'openssl', 'opensslconf.h')),
|
||||||
|
join(openssl_ndk_dir, 'include', 'openssl',
|
||||||
|
'opensslconf_{}.h'.format(under_scored_arch))
|
||||||
|
)
|
||||||
|
|
||||||
|
if stage < 3:
|
||||||
|
info('Copying openssl libs to ndk')
|
||||||
|
arch_ndk_lib = join(openssl_ndk_dir, 'libs', arch.arch)
|
||||||
|
ensure_dir(arch_ndk_lib)
|
||||||
|
shprint(sh.ln, '-sf',
|
||||||
|
realpath(join(openssl_build_dir, 'libcrypto{}.so'.format(ssl_recipe.version))),
|
||||||
|
join(openssl_build_dir, 'libcrypto.so'))
|
||||||
|
shprint(sh.ln, '-sf',
|
||||||
|
realpath(join(openssl_build_dir, 'libssl{}.so'.format(ssl_recipe.version))),
|
||||||
|
join(openssl_build_dir, 'libssl.so'))
|
||||||
|
libs = ['libcrypto.a', 'libcrypto.so', 'libssl.a', 'libssl.so']
|
||||||
|
cmd = [join(openssl_build_dir, lib) for lib in libs] + [arch_ndk_lib]
|
||||||
|
shprint(sh.cp, '-f', *cmd)
|
||||||
|
|
||||||
|
if stage < 10:
|
||||||
|
info('Recompiling python-crystax')
|
||||||
|
self.patch_dev_defaults(ssl_recipe)
|
||||||
|
build_script = join(self.ctx.ndk_dir, 'build', 'tools',
|
||||||
|
'build-target-python.sh')
|
||||||
|
|
||||||
|
shprint(Command(build_script),
|
||||||
|
'--ndk-dir={}'.format(self.ctx.ndk_dir),
|
||||||
|
'--abis={}'.format(arch.arch),
|
||||||
|
'-j5', '--verbose',
|
||||||
|
self.get_build_dir(arch.arch))
|
||||||
|
|
||||||
|
info('Extracting CrystaX python3 from NDK package')
|
||||||
|
dirn = self.ctx.get_python_install_dir()
|
||||||
|
ensure_dir(dirn)
|
||||||
|
self.ctx.hostpython = 'python{}'.format(self.version)
|
||||||
|
|
||||||
|
recipe = Python3Recipe()
|
89
recipes/python3crystax/patch_python3.6.patch
Normal file
89
recipes/python3crystax/patch_python3.6.patch
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c
|
||||||
|
--- a/Modules/expat/xmlparse.c
|
||||||
|
+++ b/Modules/expat/xmlparse.c
|
||||||
|
@@ -84,6 +84,8 @@
|
||||||
|
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#define XML_POOR_ENTROPY 1
|
||||||
|
+
|
||||||
|
#if !defined(HAVE_GETRANDOM) && !defined(HAVE_SYSCALL_GETRANDOM) \
|
||||||
|
&& !defined(HAVE_ARC4RANDOM_BUF) && !defined(HAVE_ARC4RANDOM) \
|
||||||
|
&& !defined(XML_DEV_URANDOM) \
|
||||||
|
diff --git a/Modules/getpath.c b/Modules/getpath.c
|
||||||
|
--- a/Modules/getpath.c
|
||||||
|
+++ b/Modules/getpath.c
|
||||||
|
@@ -101,8 +101,35 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
-#if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH)
|
||||||
|
-#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
|
||||||
|
+ /* These variables were set this way in old versions of Python, but
|
||||||
|
+ changed somewhere between 3.5.0 and 3.5.3. Here we just force
|
||||||
|
+ the old way again. A better solution would be to work out where
|
||||||
|
+ they should be defined, and make the CrystaX build scripts do
|
||||||
|
+ so. */
|
||||||
|
+
|
||||||
|
+/* #if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) */
|
||||||
|
+/* #error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" */
|
||||||
|
+/* #endif */
|
||||||
|
+
|
||||||
|
+#ifndef VERSION
|
||||||
|
+#define VERSION "2.1"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef VPATH
|
||||||
|
+#define VPATH "."
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef PREFIX
|
||||||
|
+# define PREFIX "/usr/local"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef EXEC_PREFIX
|
||||||
|
+#define EXEC_PREFIX PREFIX
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef PYTHONPATH
|
||||||
|
+#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
|
||||||
|
+ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LANDMARK
|
||||||
|
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
|
||||||
|
--- a/Modules/timemodule.c
|
||||||
|
+++ b/Modules/timemodule.c
|
||||||
|
@@ -358,18 +358,20 @@ time_gmtime(PyObject *self, PyObject *args)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifndef HAVE_TIMEGM
|
||||||
|
-static time_t
|
||||||
|
-timegm(struct tm *p)
|
||||||
|
-{
|
||||||
|
- /* XXX: the following implementation will not work for tm_year < 1970.
|
||||||
|
- but it is likely that platforms that don't have timegm do not support
|
||||||
|
- negative timestamps anyways. */
|
||||||
|
- return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 +
|
||||||
|
- (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 -
|
||||||
|
- ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400;
|
||||||
|
-}
|
||||||
|
-#endif
|
||||||
|
+/* In the Android build, HAVE_TIMEGM apparently should be defined but isn't. A better fix would be to work out why and fix that. */
|
||||||
|
+
|
||||||
|
+/* #ifndef HAVE_TIMEGM */
|
||||||
|
+/* static time_t */
|
||||||
|
+/* timegm(struct tm *p) */
|
||||||
|
+/* { */
|
||||||
|
+/* /\* XXX: the following implementation will not work for tm_year < 1970. */
|
||||||
|
+/* but it is likely that platforms that don't have timegm do not support */
|
||||||
|
+/* negative timestamps anyways. *\/ */
|
||||||
|
+/* return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 + */
|
||||||
|
+/* (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 - */
|
||||||
|
+/* ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400; */
|
||||||
|
+/* } */
|
||||||
|
+/* #endif */
|
||||||
|
|
||||||
|
PyDoc_STRVAR(gmtime_doc,
|
||||||
|
"gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,\n\
|
12
recipes/requests/__init__.py
Normal file
12
recipes/requests/__init__.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from pythonforandroid.recipe import PythonRecipe
|
||||||
|
|
||||||
|
|
||||||
|
class RequestsRecipe(PythonRecipe):
|
||||||
|
version = '2.13.0'
|
||||||
|
url = 'https://github.com/kennethreitz/requests/archive/v{version}.tar.gz'
|
||||||
|
depends = [('hostpython2', 'hostpython3crystax'), 'setuptools']
|
||||||
|
site_packages_name = 'requests'
|
||||||
|
call_hostpython_via_targetpython = False
|
||||||
|
|
||||||
|
|
||||||
|
recipe = RequestsRecipe()
|
|
@ -1,20 +1,11 @@
|
||||||
|
from pythonforandroid.recipe import PythonRecipe
|
||||||
from pythonforandroid.toolchain import (
|
|
||||||
PythonRecipe,
|
|
||||||
Recipe,
|
|
||||||
current_directory,
|
|
||||||
info,
|
|
||||||
shprint,
|
|
||||||
)
|
|
||||||
from os.path import join
|
|
||||||
import sh
|
|
||||||
|
|
||||||
|
|
||||||
class SetuptoolsRecipe(PythonRecipe):
|
class SetuptoolsRecipe(PythonRecipe):
|
||||||
version = '18.5'
|
version = '40.0.0'
|
||||||
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip'
|
||||||
|
|
||||||
depends = ['python2']
|
depends = [('python2', 'python3crystax')]
|
||||||
|
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
install_in_hostpython = True
|
install_in_hostpython = True
|
||||||
|
|
|
@ -6,6 +6,5 @@ class SixRecipe(PythonRecipe):
|
||||||
version = '1.9.0'
|
version = '1.9.0'
|
||||||
url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz'
|
url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz'
|
||||||
depends = [('python2', 'python3crystax')]
|
depends = [('python2', 'python3crystax')]
|
||||||
call_hostpython_via_targetpython = False
|
|
||||||
|
|
||||||
recipe = SixRecipe()
|
recipe = SixRecipe()
|
||||||
|
|
|
@ -12,10 +12,10 @@ import sh
|
||||||
|
|
||||||
|
|
||||||
class TwistedRecipe(CythonRecipe):
|
class TwistedRecipe(CythonRecipe):
|
||||||
version = '16.6.0'
|
version = '18.7.0'
|
||||||
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
|
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
|
||||||
|
|
||||||
depends = ['setuptools', 'zope_interface']
|
depends = ['setuptools', 'zope_interface', 'incremental', 'constantly']
|
||||||
|
|
||||||
call_hostpython_via_targetpython = False
|
call_hostpython_via_targetpython = False
|
||||||
install_in_hostpython = True
|
install_in_hostpython = True
|
||||||
|
@ -29,10 +29,10 @@ class TwistedRecipe(CythonRecipe):
|
||||||
env = super(TwistedRecipe, self).get_recipe_env(arch)
|
env = super(TwistedRecipe, self).get_recipe_env(arch)
|
||||||
|
|
||||||
# TODO: Move this and others to base Recipe class for Cython and CompiledComponent recipes
|
# TODO: Move this and others to base Recipe class for Cython and CompiledComponent recipes
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
target_python = Recipe.get_recipe('python3crystax', self.ctx).get_build_dir(arch.arch)
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
|
||||||
|
|
||||||
# We add BUILDLIB_PATH to PYTHONPATH so twisted can find _io.so
|
# We add BUILDLIB_PATH to PYTHONPATH so twisted can find _io.so
|
||||||
env['PYTHONPATH'] = ':'.join([
|
env['PYTHONPATH'] = ':'.join([
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
import glob
|
|
||||||
from pythonforandroid.toolchain import (
|
|
||||||
CythonRecipe,
|
|
||||||
Recipe,
|
|
||||||
current_directory,
|
|
||||||
info,
|
|
||||||
shprint,
|
|
||||||
)
|
|
||||||
from os.path import join
|
|
||||||
import sh
|
|
||||||
|
|
||||||
|
|
||||||
class UnqliteRecipe(CythonRecipe):
|
|
||||||
version = '0.6.0'
|
|
||||||
url = 'https://pypi.python.org/packages/cb/4e/e1f64a3d0f6462167805940b4c72f47bafc1129e363fc4c0f79a1cdc5dd1/unqlite-{version}.tar.gz'
|
|
||||||
depends = ['python2', 'setuptools']
|
|
||||||
call_hostpython_via_targetpython = False
|
|
||||||
|
|
||||||
patches = ['setup.patch']
|
|
||||||
|
|
||||||
def get_recipe_env(self, arch):
|
|
||||||
env = super(UnqliteRecipe, self).get_recipe_env(arch)
|
|
||||||
|
|
||||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
|
||||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
|
||||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
|
||||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
|
||||||
|
|
||||||
return env
|
|
||||||
|
|
||||||
|
|
||||||
recipe = UnqliteRecipe()
|
|
|
@ -1,26 +0,0 @@
|
||||||
--- a/setup.py 2016-08-22 19:45:52.000000000 +0100
|
|
||||||
+++ b/setup.py 2017-09-16 01:35:36.675202502 +0100
|
|
||||||
@@ -1,11 +1,7 @@
|
|
||||||
import glob
|
|
||||||
-from distutils.core import setup, Extension
|
|
||||||
-
|
|
||||||
-try:
|
|
||||||
- from Cython.Build import cythonize
|
|
||||||
-except ImportError:
|
|
||||||
- raise RuntimeError('Cython must be installed to build unqlite-python.')
|
|
||||||
-
|
|
||||||
+from setuptools import setup
|
|
||||||
+from setuptools.extension import Extension
|
|
||||||
+from setuptools.command.build_ext import build_ext
|
|
||||||
|
|
||||||
python_source = 'unqlite.pyx'
|
|
||||||
library_source = glob.glob('src/*.c')
|
|
||||||
@@ -45,5 +41,7 @@
|
|
||||||
'Topic :: Database :: Database Engines/Servers',
|
|
||||||
'Topic :: Software Development :: Embedded Systems',
|
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules'],
|
|
||||||
- ext_modules=cythonize(unqlite_extension)
|
|
||||||
+ cmdclass = {'build_ext': build_ext},
|
|
||||||
+ ext_modules=[unqlite_extension]
|
|
||||||
)
|
|
||||||
+
|
|
21
recipes/zope_interface/__init__.py
Normal file
21
recipes/zope_interface/__init__.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
from pythonforandroid.recipe import PythonRecipe
|
||||||
|
from pythonforandroid.toolchain import current_directory
|
||||||
|
import sh
|
||||||
|
|
||||||
|
|
||||||
|
class ZopeInterfaceRecipe(PythonRecipe):
|
||||||
|
name = 'zope_interface'
|
||||||
|
version = '4.2.0'
|
||||||
|
url = 'https://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz'
|
||||||
|
site_packages_name = 'zope.interface'
|
||||||
|
|
||||||
|
depends = [('python2', 'python3crystax')]
|
||||||
|
patches = ['no_tests.patch']
|
||||||
|
|
||||||
|
def prebuild_arch(self, arch):
|
||||||
|
super(ZopeInterfaceRecipe, self).prebuild_arch(arch)
|
||||||
|
with current_directory(self.get_build_dir(arch.arch)):
|
||||||
|
sh.rm('-rf', 'src/zope/interface/tests', 'src/zope/interface/common/tests')
|
||||||
|
|
||||||
|
|
||||||
|
recipe = ZopeInterfaceRecipe()
|
13
recipes/zope_interface/no_tests.patch
Normal file
13
recipes/zope_interface/no_tests.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
--- a/setup.py 2016-06-10 14:56:35.000000000 +0100
|
||||||
|
+++ b/setup.py 2018-09-29 09:28:25.676203522 +0100
|
||||||
|
@@ -139,9 +139,8 @@
|
||||||
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
|
],
|
||||||
|
|
||||||
|
- packages = ['zope', 'zope.interface', 'zope.interface.tests'],
|
||||||
|
+ packages = ['zope', 'zope.interface'],
|
||||||
|
package_dir = {'': 'src'},
|
||||||
|
cmdclass = {'build_ext': optional_build_ext,
|
||||||
|
},
|
||||||
|
- test_suite = 'zope.interface.tests',
|
||||||
|
**extra)
|
10
recipes/zope_interface/setuptools.patch
Normal file
10
recipes/zope_interface/setuptools.patch
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--- a/setup.py 2016-12-14 00:02:45.000000000 +0100
|
||||||
|
+++ b/setup.py 2018-09-29 00:14:20.235641125 +0100
|
||||||
|
@@ -131,7 +131,6 @@
|
||||||
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
||||||
|
tests_require=tests_require,
|
||||||
|
- install_requires=['setuptools'],
|
||||||
|
extras_require={
|
||||||
|
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
|
||||||
|
'test': tests_require,
|
921
scripts/build-target-python.sh
Executable file
921
scripts/build-target-python.sh
Executable file
|
@ -0,0 +1,921 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2011-2015 CrystaX.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
# provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY CrystaX ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CrystaX OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# The views and conclusions contained in the software and documentation are those of the
|
||||||
|
# authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
# or implied, of CrystaX.
|
||||||
|
|
||||||
|
# include common function and variable definitions
|
||||||
|
. `dirname $0`/prebuilt-common.sh
|
||||||
|
|
||||||
|
PROGRAM_PARAMETERS="<src-dir>"
|
||||||
|
|
||||||
|
PROGRAM_DESCRIPTION=\
|
||||||
|
"Rebuild python libraries for the CrystaX NDK.
|
||||||
|
|
||||||
|
This requires a temporary NDK installation containing
|
||||||
|
toolchain binaries for all target architectures.
|
||||||
|
|
||||||
|
By default, this will try with the current NDK directory, unless
|
||||||
|
you use the --ndk-dir=<path> option.
|
||||||
|
|
||||||
|
The output will be placed in appropriate sub-directories of
|
||||||
|
<ndk>/$PYTHON_SUBDIR, but you can override this with the --out-dir=<path>
|
||||||
|
option.
|
||||||
|
"
|
||||||
|
|
||||||
|
PACKAGE_DIR=
|
||||||
|
register_var_option "--package-dir=<path>" PACKAGE_DIR "Put prebuilt tarballs into <path>"
|
||||||
|
|
||||||
|
NDK_DIR=$ANDROID_NDK_ROOT
|
||||||
|
register_var_option "--ndk-dir=<path>" NDK_DIR "Specify NDK root path for the build"
|
||||||
|
|
||||||
|
BUILD_DIR=
|
||||||
|
OPTION_BUILD_DIR=
|
||||||
|
register_var_option "--build-dir=<path>" OPTION_BUILD_DIR "Specify temporary build dir"
|
||||||
|
|
||||||
|
ABIS=$PREBUILT_ABIS
|
||||||
|
register_var_option "--abis=<list>" ABIS "Specify list of target ABIs"
|
||||||
|
|
||||||
|
register_jobs_option
|
||||||
|
|
||||||
|
extract_parameters "$@"
|
||||||
|
|
||||||
|
PYTHON_SRCDIR=$(echo $PARAMETERS | sed 1q)
|
||||||
|
if [ -z "$PYTHON_SRCDIR" ]; then
|
||||||
|
echo "ERROR: Please provide the path to the python source tree. See --help"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$PYTHON_SRCDIR" ]; then
|
||||||
|
echo "ERROR: No such directory: '$PYTHON_SRCDIR'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PYTHON_SRCDIR=$(cd $PYTHON_SRCDIR && pwd)
|
||||||
|
|
||||||
|
PYTHON_MAJOR_VERSION=\
|
||||||
|
$(cat $PYTHON_SRCDIR/Include/patchlevel.h | sed -n 's/#define[ \t]*PY_MAJOR_VERSION[ \t]*\([0-9]*\).*/\1/p')
|
||||||
|
|
||||||
|
PYTHON_MINOR_VERSION=\
|
||||||
|
$(cat $PYTHON_SRCDIR/Include/patchlevel.h | sed -n 's/#define[ \t]*PY_MINOR_VERSION[ \t]*\([0-9]*\).*/\1/p')
|
||||||
|
|
||||||
|
if [ -z "$PYTHON_MAJOR_VERSION" ]; then
|
||||||
|
echo "ERROR: Can't detect python major version." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$PYTHON_MINOR_VERSION" ]; then
|
||||||
|
echo "ERROR: Can't detect python minor version." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PYTHON_ABI="$PYTHON_MAJOR_VERSION"'.'"$PYTHON_MINOR_VERSION"
|
||||||
|
PYTHON_DSTDIR=$NDK_DIR/$PYTHON_SUBDIR/$PYTHON_ABI
|
||||||
|
mkdir -p $PYTHON_DSTDIR
|
||||||
|
fail_panic "Can't create python destination directory: $PYTHON_DSTDIR"
|
||||||
|
|
||||||
|
PYTHON_BUILD_UTILS_DIR=$(cd $(dirname $0)/build-target-python && pwd)
|
||||||
|
if [ ! -d "$PYTHON_BUILD_UTILS_DIR" ]; then
|
||||||
|
echo "ERROR: No such directory: '$PYTHON_BUILD_UTILS_DIR'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PY_C_CONFIG_FILE="$PYTHON_BUILD_UTILS_DIR/config.c.$PYTHON_ABI"
|
||||||
|
if [ ! -f "$PY_C_CONFIG_FILE" ]; then
|
||||||
|
echo "ERROR: Build of python $PYTHON_ABI is not supported, no such file: $PY_C_CONFIG_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PY_C_INTERPRETER_FILE="$PYTHON_BUILD_UTILS_DIR/interpreter.c.$PYTHON_ABI"
|
||||||
|
if [ ! -f "$PY_C_INTERPRETER_FILE" ]; then
|
||||||
|
echo "ERROR: Build of python $PYTHON_ABI is not supported, no such file: $PY_C_INTERPRETER_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PY_ANDROID_MK_TEMPLATE_FILE="$PYTHON_BUILD_UTILS_DIR/android.mk.$PYTHON_ABI"
|
||||||
|
if [ ! -f "$PY_ANDROID_MK_TEMPLATE_FILE" ]; then
|
||||||
|
echo "ERROR: Build of python $PYTHON_ABI is not supported, no such file: $PY_ANDROID_MK_TEMPLATE_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ABIS=$(commas_to_spaces $ABIS)
|
||||||
|
|
||||||
|
if [ -z "$OPTION_BUILD_DIR" ]; then
|
||||||
|
BUILD_DIR=$NDK_TMPDIR/build-python
|
||||||
|
else
|
||||||
|
eval BUILD_DIR=$OPTION_BUILD_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "$BUILD_DIR"
|
||||||
|
mkdir -p "$BUILD_DIR"
|
||||||
|
fail_panic "Can't create build directory: $BUILD_DIR"
|
||||||
|
|
||||||
|
OPENSSL_HOME=''
|
||||||
|
if [ -n "$DEFAULT_OPENSSL_VERSION" ]; then
|
||||||
|
if [ -f "$NDK_DIR/$OPENSSL_SUBDIR/$DEFAULT_OPENSSL_VERSION/Android.mk" \
|
||||||
|
-a -f "$NDK_DIR/$OPENSSL_SUBDIR/$DEFAULT_OPENSSL_VERSION/include/openssl/opensslconf.h" ]; then
|
||||||
|
OPENSSL_HOME="openssl/$DEFAULT_OPENSSL_VERSION"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# $1: ABI
|
||||||
|
# $2: build directory
|
||||||
|
build_python_for_abi ()
|
||||||
|
{
|
||||||
|
local ABI="$1"
|
||||||
|
local BUILDDIR="$2"
|
||||||
|
local PYBIN_INSTALLDIR=$PYTHON_DSTDIR/libs/$ABI
|
||||||
|
local PYBIN_INSTALLDIR_MODULES="$PYBIN_INSTALLDIR/modules"
|
||||||
|
if [ -n "$OPENSSL_HOME" ]; then
|
||||||
|
log "Building python$PYTHON_ABI for $ABI (with OpenSSL-$DEFAULT_OPENSSL_VERSION)"
|
||||||
|
else
|
||||||
|
log "Building python$PYTHON_ABI for $ABI (without OpenSSL support)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 1: configure
|
||||||
|
local BUILDDIR_CONFIG="$BUILDDIR/config"
|
||||||
|
local BUILDDIR_CORE="$BUILDDIR/core"
|
||||||
|
local OBJDIR_CORE="$BUILDDIR_CORE/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p $BUILDDIR_CONFIG
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CONFIG"
|
||||||
|
run mkdir -p $BUILDDIR_CORE
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CORE"
|
||||||
|
|
||||||
|
local BUILD_ON_PLATFORM=$($PYTHON_SRCDIR/config.guess)
|
||||||
|
if [ -z "$BUILD_ON_PLATFORM" ]; then
|
||||||
|
echo "ERROR: Can't resolve platform being built python on." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ARCH
|
||||||
|
case $ABI in
|
||||||
|
armeabi*)
|
||||||
|
ARCH=arm
|
||||||
|
;;
|
||||||
|
arm64*)
|
||||||
|
ARCH=arm64
|
||||||
|
;;
|
||||||
|
x86|x86_64|mips|mips64)
|
||||||
|
ARCH=$ABI
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown ABI: '$ABI'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
local HOST
|
||||||
|
case $ABI in
|
||||||
|
armeabi*)
|
||||||
|
HOST=arm-linux-androideabi
|
||||||
|
;;
|
||||||
|
arm64*)
|
||||||
|
HOST=aarch64-linux-android
|
||||||
|
;;
|
||||||
|
x86)
|
||||||
|
HOST=i686-linux-android
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
HOST=x86_64-linux-android
|
||||||
|
;;
|
||||||
|
mips)
|
||||||
|
HOST=mipsel-linux-android
|
||||||
|
;;
|
||||||
|
mips64)
|
||||||
|
HOST=mips64el-linux-android
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown ABI: '$ABI'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
local APILEVEL
|
||||||
|
case $ABI in
|
||||||
|
armeabi*|x86|mips)
|
||||||
|
APILEVEL=21
|
||||||
|
;;
|
||||||
|
arm64*|x86_64|mips64)
|
||||||
|
APILEVEL=21
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown ABI: '$ABI'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
local TOOLCHAIN
|
||||||
|
case $ABI in
|
||||||
|
armeabi*)
|
||||||
|
TOOLCHAIN=arm-linux-androideabi
|
||||||
|
;;
|
||||||
|
x86)
|
||||||
|
TOOLCHAIN=x86
|
||||||
|
;;
|
||||||
|
mips)
|
||||||
|
TOOLCHAIN=mipsel-linux-android
|
||||||
|
;;
|
||||||
|
arm64-v8a)
|
||||||
|
TOOLCHAIN=aarch64-linux-android
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
TOOLCHAIN=x86_64
|
||||||
|
;;
|
||||||
|
mips64)
|
||||||
|
TOOLCHAIN=mips64el-linux-android
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown ABI: '$ABI'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $ABI in
|
||||||
|
armeabi)
|
||||||
|
CFLAGS="-march=armv5te -mtune=xscale -msoft-float"
|
||||||
|
;;
|
||||||
|
armeabi-v7a)
|
||||||
|
CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp"
|
||||||
|
;;
|
||||||
|
armeabi-v7a-hard)
|
||||||
|
CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mhard-float"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CFLAGS=""
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $ABI in
|
||||||
|
armeabi*)
|
||||||
|
CFLAGS="$CFLAGS -mthumb"
|
||||||
|
esac
|
||||||
|
|
||||||
|
local CFLAGS="$CFLAGS --sysroot=$NDK_DIR/platforms/android-$APILEVEL/arch-$ARCH"
|
||||||
|
|
||||||
|
local LDFLAGS=""
|
||||||
|
if [ "$ABI" = "armeabi-v7a-hard" ]; then
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--no-warn-mismatch"
|
||||||
|
fi
|
||||||
|
LDFLAGS="$LDFLAGS -L$NDK_DIR/sources/crystax/libs/$ABI --sysroot=$NDK_DIR/platforms/android-$APILEVEL/arch-$ARCH"
|
||||||
|
|
||||||
|
local TCPREFIX=$NDK_DIR/toolchains/${TOOLCHAIN}-4.9/prebuilt/$HOST_TAG
|
||||||
|
|
||||||
|
|
||||||
|
local CC=$TCPREFIX/bin/${HOST}-gcc
|
||||||
|
local CPP="$CC $CFLAGS -E"
|
||||||
|
local AR=$TCPREFIX/bin/${HOST}-ar
|
||||||
|
local RANLIB=$TCPREFIX/bin/${HOST}-ranlib
|
||||||
|
local READELF=$TCPREFIX/bin/${HOST}-readelf
|
||||||
|
local PYTHON_FOR_BUILD=$NDK_DIR/prebuilt/$HOST_TAG/bin/python
|
||||||
|
local CONFIG_SITE=$PYTHON_TOOLS_DIR/config.site
|
||||||
|
|
||||||
|
local CONFIG_SITE=$BUILDDIR_CONFIG/config.site
|
||||||
|
{
|
||||||
|
echo 'ac_cv_file__dev_ptmx=no'
|
||||||
|
echo 'ac_cv_file__dev_ptc=no'
|
||||||
|
echo 'ac_cv_func_gethostbyname_r=no'
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" == "3" ]; then
|
||||||
|
echo 'ac_cv_func_faccessat=no'
|
||||||
|
fi
|
||||||
|
} >$CONFIG_SITE
|
||||||
|
fail_panic "Can't create config.site wrapper"
|
||||||
|
|
||||||
|
local CONFIGURE_WRAPPER=$BUILDDIR_CONFIG/configure.sh
|
||||||
|
{
|
||||||
|
echo "#!/bin/bash -e"
|
||||||
|
echo ''
|
||||||
|
echo "export CC=\"$CC\""
|
||||||
|
echo "export CPP=\"$CPP\""
|
||||||
|
echo "export AR=\"$AR\""
|
||||||
|
echo "export CFLAGS=\"$CFLAGS\""
|
||||||
|
echo "export LDFLAGS=\"$LDFLAGS\""
|
||||||
|
echo "export RANLIB=\"$RANLIB\""
|
||||||
|
echo "export READELF=\"$READELF\""
|
||||||
|
echo "export PYTHON_FOR_BUILD=\"$PYTHON_FOR_BUILD\""
|
||||||
|
echo "export CONFIG_SITE=\"$CONFIG_SITE\""
|
||||||
|
echo ''
|
||||||
|
echo 'cd $(dirname $0)'
|
||||||
|
echo ''
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
echo "exec $PYTHON_SRCDIR/configure \\"
|
||||||
|
echo " --host=$HOST \\"
|
||||||
|
echo " --build=$BUILD_ON_PLATFORM \\"
|
||||||
|
echo " --prefix=$BUILDDIR_CONFIG/install \\"
|
||||||
|
echo " --enable-shared \\"
|
||||||
|
echo " --with-threads \\"
|
||||||
|
echo " --enable-ipv6 \\"
|
||||||
|
echo " --enable-unicode=ucs4 \\"
|
||||||
|
echo " --without-ensurepip"
|
||||||
|
else
|
||||||
|
echo "exec $PYTHON_SRCDIR/configure \\"
|
||||||
|
echo " --host=$HOST \\"
|
||||||
|
echo " --build=$BUILD_ON_PLATFORM \\"
|
||||||
|
echo " --prefix=$BUILDDIR_CONFIG/install \\"
|
||||||
|
echo " --enable-shared \\"
|
||||||
|
echo " --with-threads \\"
|
||||||
|
echo " --enable-ipv6 \\"
|
||||||
|
echo " --with-computed-gotos \\"
|
||||||
|
echo " --without-ensurepip"
|
||||||
|
fi
|
||||||
|
} >$CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't create configure wrapper"
|
||||||
|
|
||||||
|
chmod +x $CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't chmod +x configure wrapper"
|
||||||
|
|
||||||
|
run $CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't configure python$PYTHON_ABI for $ABI"
|
||||||
|
|
||||||
|
# Step 2: build python-core
|
||||||
|
run mkdir -p $BUILDDIR_CORE/jni
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CORE/jni"
|
||||||
|
|
||||||
|
run cp -p -T $PY_C_CONFIG_FILE "$BUILDDIR_CORE/jni/config.c" && \
|
||||||
|
cp -p -t "$BUILDDIR_CORE/jni" "$PYTHON_BUILD_UTILS_DIR/pyconfig.h"
|
||||||
|
fail_panic "Can't copy config.c pyconfig.h to $BUILDDIR_CORE/jni"
|
||||||
|
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
local PY_C_GETPATH="$PYTHON_BUILD_UTILS_DIR/getpath.c.$PYTHON_ABI"
|
||||||
|
run cp -p -T $PY_C_GETPATH "$BUILDDIR_CORE/jni/getpath.c"
|
||||||
|
fail_panic "Can't copy $PY_C_GETPATH to $BUILDDIR_CORE/jni"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local PYCONFIG_FOR_ABI="$BUILDDIR_CORE/jni/pyconfig_$(echo $ABI | tr '-' '_').h"
|
||||||
|
run cp -p -T $BUILDDIR_CONFIG/pyconfig.h $PYCONFIG_FOR_ABI
|
||||||
|
fail_panic "Can't copy $BUILDDIR_CONFIG/pyconfig.h to $PYCONFIG_FOR_ABI"
|
||||||
|
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"
|
||||||
|
else
|
||||||
|
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"'m'
|
||||||
|
local PYTHON_SOABI='cpython-'"$PYTHON_ABI"'m'
|
||||||
|
fi
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo "LOCAL_MODULE := $PYTHON_CORE_MODULE_NAME"
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include'
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
echo "LOCAL_CFLAGS := -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\""
|
||||||
|
else
|
||||||
|
echo "LOCAL_CFLAGS := -DSOABI=\\\"$PYTHON_SOABI\\\" -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\""
|
||||||
|
fi
|
||||||
|
echo 'LOCAL_LDLIBS := -lz'
|
||||||
|
cat $PY_ANDROID_MK_TEMPLATE_FILE
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
} >$BUILDDIR_CORE/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_CORE/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_CORE -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI core"
|
||||||
|
|
||||||
|
if [ "$PYTHON_HEADERS_INSTALLED" != "yes" ]; then
|
||||||
|
log "Install python$PYTHON_ABI headers into $PYTHON_DSTDIR"
|
||||||
|
run rm -Rf $PYTHON_DSTDIR/include
|
||||||
|
run mkdir -p $PYTHON_DSTDIR/include/python && \
|
||||||
|
run cp -p $PYTHON_BUILD_UTILS_DIR/pyconfig.h $PYTHON_SRCDIR/Include/*.h $PYTHON_DSTDIR/include/python
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI headers"
|
||||||
|
PYTHON_HEADERS_INSTALLED=yes
|
||||||
|
export PYTHON_HEADERS_INSTALLED
|
||||||
|
fi
|
||||||
|
log "Install $(basename $PYCONFIG_FOR_ABI) into $PYTHON_DSTDIR"
|
||||||
|
run cp -p $PYCONFIG_FOR_ABI $PYTHON_DSTDIR/include/python
|
||||||
|
fail_panic "Can't install $PYCONFIG_FOR_ABI"
|
||||||
|
|
||||||
|
run mkdir -p $PYBIN_INSTALLDIR
|
||||||
|
fail_panic "Can't create $PYBIN_INSTALLDIR"
|
||||||
|
run mkdir -p $PYBIN_INSTALLDIR_MODULES
|
||||||
|
fail_panic "Can't create directory: $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI core in $PYBIN_INSTALLDIR"
|
||||||
|
run cp -fpH $OBJDIR_CORE/lib$PYTHON_CORE_MODULE_NAME.so $PYBIN_INSTALLDIR
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI core in $PYBIN_INSTALLDIR"
|
||||||
|
|
||||||
|
# Step 3: build python-interpreter
|
||||||
|
local BUILDDIR_INTERPRETER="$BUILDDIR/interpreter"
|
||||||
|
local OBJDIR_INTERPRETER="$BUILDDIR_INTERPRETER/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p $BUILDDIR_INTERPRETER/jni
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_INTERPRETER/jni"
|
||||||
|
|
||||||
|
run cp -p -T $PY_C_INTERPRETER_FILE $BUILDDIR_INTERPRETER/jni/interpreter.c
|
||||||
|
fail_panic "Can't copy $PY_C_INTERPRETER_FILE to $BUILDDIR_INTERPRETER/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := python'
|
||||||
|
echo 'LOCAL_SRC_FILES := interpreter.c'
|
||||||
|
echo 'include $(BUILD_EXECUTABLE)'
|
||||||
|
} >$BUILDDIR_INTERPRETER/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_INTERPRETER/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_INTERPRETER -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI interpreter"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI interpreter in $PYBIN_INSTALLDIR"
|
||||||
|
run cp -fpH $OBJDIR_INTERPRETER/python $PYBIN_INSTALLDIR
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI interpreter in $PYBIN_INSTALLDIR"
|
||||||
|
|
||||||
|
# Step 4: build python stdlib
|
||||||
|
local PYSTDLIB_ZIPFILE="$PYBIN_INSTALLDIR/stdlib.zip"
|
||||||
|
log "Install python$PYTHON_ABI-$ABI stdlib as $PYSTDLIB_ZIPFILE"
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
run $PYTHON_FOR_BUILD $PYTHON_BUILD_UTILS_DIR/build_stdlib.py --py2 --pysrc-root $PYTHON_SRCDIR --output-zip $PYSTDLIB_ZIPFILE
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI stdlib"
|
||||||
|
else
|
||||||
|
run $PYTHON_FOR_BUILD $PYTHON_BUILD_UTILS_DIR/build_stdlib.py --pysrc-root $PYTHON_SRCDIR --output-zip $PYSTDLIB_ZIPFILE
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI stdlib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 5: site-packages
|
||||||
|
local SITE_README_SRCDIR="$PYTHON_SRCDIR/Lib/site-packages"
|
||||||
|
local SITE_README_DSTDIR="$PYBIN_INSTALLDIR/site-packages"
|
||||||
|
log "Install python$PYTHON_ABI-$ABI site-packages"
|
||||||
|
run mkdir -p $SITE_README_DSTDIR && cp -fpH $SITE_README_SRCDIR/README $SITE_README_DSTDIR
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI site-packages"
|
||||||
|
|
||||||
|
# Step 6: build python modules
|
||||||
|
# _ctypes
|
||||||
|
local BUILDDIR_CTYPES="$BUILDDIR/ctypes"
|
||||||
|
local OBJDIR_CTYPES="$BUILDDIR_CTYPES/obj/local/$ABI"
|
||||||
|
local BUILDDIR_CTYPES_CONFIG="$BUILDDIR_CTYPES/config"
|
||||||
|
run mkdir -p $BUILDDIR_CTYPES_CONFIG
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CTYPES_CONFIG"
|
||||||
|
|
||||||
|
local LIBFFI_CONFIGURE_WRAPPER=$BUILDDIR_CTYPES_CONFIG/configure.sh
|
||||||
|
{
|
||||||
|
echo "#!/bin/bash -e"
|
||||||
|
echo ''
|
||||||
|
echo "export CC=\"$CC\""
|
||||||
|
echo "export CFLAGS=\"$CFLAGS\""
|
||||||
|
echo "export LDFLAGS=\"$LDFLAGS\""
|
||||||
|
echo "export CPP=\"$CPP\""
|
||||||
|
echo "export AR=\"$AR\""
|
||||||
|
echo "export RANLIB=\"$RANLIB\""
|
||||||
|
echo ''
|
||||||
|
echo 'cd $(dirname $0)'
|
||||||
|
echo ''
|
||||||
|
echo "exec $PYTHON_SRCDIR/Modules/_ctypes/libffi/configure \\"
|
||||||
|
echo " --host=$HOST \\"
|
||||||
|
echo " --build=$BUILD_ON_PLATFORM \\"
|
||||||
|
echo " --prefix=$BUILDDIR_CTYPES_CONFIG/install \\"
|
||||||
|
} >$LIBFFI_CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't create configure wrapper for libffi"
|
||||||
|
|
||||||
|
chmod +x $LIBFFI_CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't chmod +x configure wrapper for libffi"
|
||||||
|
|
||||||
|
run $LIBFFI_CONFIGURE_WRAPPER
|
||||||
|
fail_panic "Can't configure libffi for $ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_CTYPES/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CTYPES/jni"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_CTYPES/jni/include"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_CTYPES/jni/include"
|
||||||
|
|
||||||
|
run cp -p $BUILDDIR_CTYPES_CONFIG/fficonfig.h $BUILDDIR_CTYPES_CONFIG/include/*.h $BUILDDIR_CTYPES/jni/include
|
||||||
|
fail_panic "Can't copy configured libffi headers"
|
||||||
|
|
||||||
|
local FFI_SRC_LIST
|
||||||
|
case $ABI in
|
||||||
|
x86)
|
||||||
|
FFI_SRC_LIST="src/x86/ffi.c src/x86/sysv.S src/x86/win32.S"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
FFI_SRC_LIST="src/x86/ffi64.c src/x86/unix64.S"
|
||||||
|
;;
|
||||||
|
armeabi*)
|
||||||
|
FFI_SRC_LIST="src/arm/ffi.c src/arm/sysv.S"
|
||||||
|
;;
|
||||||
|
arm64-v8a)
|
||||||
|
FFI_SRC_LIST="src/aarch64/ffi.c src/aarch64/sysv.S"
|
||||||
|
;;
|
||||||
|
mips)
|
||||||
|
FFI_SRC_LIST="src/mips/ffi.c src/mips/o32.S"
|
||||||
|
;;
|
||||||
|
mips64)
|
||||||
|
FFI_SRC_LIST="src/mips/ffi.c src/mips/o32.S src/mips/n32.S"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unknown ABI: '$ABI'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
FFI_SRC_LIST="$FFI_SRC_LIST src/prep_cif.c"
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _ctypes'
|
||||||
|
echo 'LOCAL_C_INCLUDES := $(LOCAL_PATH)/include'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
for ffi_src in $FFI_SRC_LIST; do
|
||||||
|
echo " \$(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/libffi/$ffi_src \\"
|
||||||
|
done
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/callbacks.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/callproc.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/cfield.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/malloc_closure.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/stgdict.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/_ctypes.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_CTYPES/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_CTYPES/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_CTYPES -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_ctypes'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_ctypes' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_CTYPES/lib_ctypes.so $PYBIN_INSTALLDIR_MODULES/_ctypes.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_ctypes' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
# _multiprocessing
|
||||||
|
local BUILDDIR_MULTIPROCESSING="$BUILDDIR/multiprocessing"
|
||||||
|
local OBJDIR_MULTIPROCESSING="$BUILDDIR_MULTIPROCESSING/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_MULTIPROCESSING/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_MULTIPROCESSING/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _multiprocessing'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_multiprocessing/socket_connection.c \'
|
||||||
|
fi
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_multiprocessing/multiprocessing.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_multiprocessing/semaphore.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_MULTIPROCESSING/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_MULTIPROCESSING/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_MULTIPROCESSING -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_multiprocessing'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_multiprocessing' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_MULTIPROCESSING/lib_multiprocessing.so $PYBIN_INSTALLDIR_MODULES/_multiprocessing.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_multiprocessing' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
# _socket
|
||||||
|
local BUILDDIR_SOCKET="$BUILDDIR/socket"
|
||||||
|
local OBJDIR_SOCKET="$BUILDDIR_SOCKET/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_SOCKET/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_SOCKET/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _socket'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/socketmodule.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_SOCKET/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_SOCKET/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_SOCKET -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_socket'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_socket' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_SOCKET/lib_socket.so $PYBIN_INSTALLDIR_MODULES/_socket.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_socket' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
#_ssl
|
||||||
|
if [ -n "$OPENSSL_HOME" ]; then
|
||||||
|
local BUILDDIR_SSL="$BUILDDIR/ssl"
|
||||||
|
local OBJDIR_SSL="$BUILDDIR_SSL/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_SSL/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_SSL/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _ssl'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_ssl.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared openssl_static opencrypto_static'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
echo "\$(call import-module,$OPENSSL_HOME)"
|
||||||
|
} >$BUILDDIR_SSL/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_SSL/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_SSL -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_ssl'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_ssl' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_SSL/lib_ssl.so $PYBIN_INSTALLDIR_MODULES/_ssl.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_ssl' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# _hashlib
|
||||||
|
if [ -n "$OPENSSL_HOME" ]; then
|
||||||
|
local BUILDDIR_HASHLIB="$BUILDDIR/hashlib"
|
||||||
|
local OBJDIR_HASHLIB="$BUILDDIR_HASHLIB/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_HASHLIB/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_HASHLIB/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _hashlib'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_hashopenssl.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared openssl_static opencrypto_static'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
echo "\$(call import-module,$OPENSSL_HOME)"
|
||||||
|
} >$BUILDDIR_HASHLIB/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_HASHLIB/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_HASHLIB -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_hashlib'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_hashlib' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_HASHLIB/lib_hashlib.so $PYBIN_INSTALLDIR_MODULES/_hashlib.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_hashlib' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# _blake2
|
||||||
|
if [ -n "$OPENSSL_HOME" ]; then
|
||||||
|
local BUILDDIR_BLAKE2="$BUILDDIR/blake2"
|
||||||
|
local OBJDIR_BLAKE2="$BUILDDIR_BLAKE2/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_BLAKE2/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_BLAKE2/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _blake2'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_blake2/blake2module.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_blake2/blake2b_impl.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_blake2/blake2s_impl.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
echo "\$(call import-module,$OPENSSL_HOME)"
|
||||||
|
} >$BUILDDIR_BLAKE2/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_BLAKE2/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_BLAKE2 -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_blake2'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_blake2' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_BLAKE2/lib_blake2.so $PYBIN_INSTALLDIR_MODULES/_blake2.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_blake2' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# _sha3
|
||||||
|
if [ -n "$OPENSSL_HOME" ]; then
|
||||||
|
local BUILDDIR_SHA3="$BUILDDIR/sha3"
|
||||||
|
local OBJDIR_SHA3="$BUILDDIR_SHA3/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_SHA3/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_SHA3/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _sha3'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sha3/sha3module.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
echo "\$(call import-module,$OPENSSL_HOME)"
|
||||||
|
} >$BUILDDIR_SHA3/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_SHA3/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_SHA3 -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_sha3'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_sha3' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_SHA3/lib_sha3.so $PYBIN_INSTALLDIR_MODULES/_sha3.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_sha3' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# _sqlite3
|
||||||
|
local BUILDDIR_SQLITE3="$BUILDDIR/sqlite3"
|
||||||
|
local OBJDIR_SQLITE3="$BUILDDIR_SQLITE3/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_SQLITE3/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_SQLITE3/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := _sqlite3'
|
||||||
|
echo 'LOCAL_CFLAGS := -DMODULE_NAME=\"sqlite3\"'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/cache.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/connection.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/cursor.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/microprotocols.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/module.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/prepare_protocol.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/row.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/statement.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_sqlite/util.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared sqlite3_static'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
echo '$(call import-module,sqlite/3)'
|
||||||
|
} >$BUILDDIR_SQLITE3/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_SQLITE3/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_SQLITE3 -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_sqlite3'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module '_sqlite3' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_SQLITE3/lib_sqlite3.so $PYBIN_INSTALLDIR_MODULES/_sqlite3.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_sqlite3' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
#pyexpat
|
||||||
|
local BUILDDIR_PYEXPAT="$BUILDDIR/pyexpat"
|
||||||
|
local OBJDIR_PYEXPAT="$BUILDDIR_PYEXPAT/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_PYEXPAT/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_PYEXPAT/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := pyexpat'
|
||||||
|
echo 'LOCAL_CFLAGS := -DHAVE_EXPAT_CONFIG_H -DXML_STATIC'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo "LOCAL_C_INCLUDES := \$(MY_PYTHON_SRC_ROOT)/Modules/expat"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmlparse.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmlrole.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmltok.c \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/pyexpat.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_PYEXPAT/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_PYEXPAT/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_PYEXPAT -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module 'pyexpat'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module 'pyexpat' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_PYEXPAT/libpyexpat.so $PYBIN_INSTALLDIR_MODULES/pyexpat.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module 'pyexpat' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
# select
|
||||||
|
local BUILDDIR_SELECT="$BUILDDIR/select"
|
||||||
|
local OBJDIR_SELECT="$BUILDDIR_SELECT/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_SELECT/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_SELECT/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := select'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/selectmodule.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_SELECT/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_SELECT/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_SELECT -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module 'select'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module 'select' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_SELECT/libselect.so $PYBIN_INSTALLDIR_MODULES/select.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module 'select' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
|
||||||
|
# unicodedata
|
||||||
|
local BUILDDIR_UNICODEDATA="$BUILDDIR/unicodedata"
|
||||||
|
local OBJDIR_UNICODEDATA="$BUILDDIR_UNICODEDATA/obj/local/$ABI"
|
||||||
|
|
||||||
|
run mkdir -p "$BUILDDIR_UNICODEDATA/jni"
|
||||||
|
fail_panic "Can't create directory: $BUILDDIR_UNICODEDATA/jni"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo 'LOCAL_PATH := $(call my-dir)'
|
||||||
|
echo 'include $(CLEAR_VARS)'
|
||||||
|
echo 'LOCAL_MODULE := unicodedata'
|
||||||
|
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
|
||||||
|
echo 'LOCAL_SRC_FILES := \'
|
||||||
|
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/unicodedata.c'
|
||||||
|
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
|
||||||
|
echo 'include $(BUILD_SHARED_LIBRARY)'
|
||||||
|
echo "\$(call import-module,python/$PYTHON_ABI)"
|
||||||
|
} >$BUILDDIR_UNICODEDATA/jni/Android.mk
|
||||||
|
fail_panic "Can't generate $BUILDDIR_UNICODEDATA/jni/Android.mk"
|
||||||
|
|
||||||
|
run $NDK_DIR/ndk-build -C $BUILDDIR_UNICODEDATA -j$NUM_JOBS APP_ABI=$ABI V=1
|
||||||
|
fail_panic "Can't build python$PYTHON_ABI-$ABI module 'unicodedata'"
|
||||||
|
|
||||||
|
log "Install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
run cp -p -T $OBJDIR_UNICODEDATA/libunicodedata.so $PYBIN_INSTALLDIR_MODULES/unicodedata.so
|
||||||
|
fail_panic "Can't install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$PACKAGE_DIR" ]; then
|
||||||
|
PACKAGE_NAME="python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}-headers.tar.xz"
|
||||||
|
echo "Look for: $PACKAGE_NAME"
|
||||||
|
try_cached_package "$PACKAGE_DIR" "$PACKAGE_NAME" no_exit
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
PYTHON_HEADERS_NEED_PACKAGE=no
|
||||||
|
else
|
||||||
|
PYTHON_HEADERS_NEED_PACKAGE=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
BUILT_ABIS=""
|
||||||
|
for ABI in $ABIS; do
|
||||||
|
DO_BUILD_PACKAGE="yes"
|
||||||
|
if [ -n "$PACKAGE_DIR" ]; then
|
||||||
|
PACKAGE_NAME="python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}-libs-${ABI}.tar.xz"
|
||||||
|
echo "Look for: $PACKAGE_NAME"
|
||||||
|
try_cached_package "$PACKAGE_DIR" "$PACKAGE_NAME" no_exit
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
if [ "$PYTHON_HEADERS_NEED_PACKAGE" = "yes" -a -z "$BUILT_ABIS" ]; then
|
||||||
|
BUILT_ABIS="$BUILT_ABIS $ABI"
|
||||||
|
else
|
||||||
|
DO_BUILD_PACKAGE="no"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
BUILT_ABIS="$BUILT_ABIS $ABI"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$DO_BUILD_PACKAGE" = "yes" ]; then
|
||||||
|
build_python_for_abi $ABI "$BUILD_DIR/$ABI"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$PACKAGE_DIR" ]; then
|
||||||
|
if [ "$PYTHON_HEADERS_NEED_PACKAGE" = "yes" ]; then
|
||||||
|
FILES="$PYTHON_SUBDIR/$PYTHON_ABI/include"
|
||||||
|
PACKAGE_NAME="python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}-headers.tar.xz"
|
||||||
|
PACKAGE="$PACKAGE_DIR/$PACKAGE_NAME"
|
||||||
|
dump "Packaging: $PACKAGE"
|
||||||
|
pack_archive "$PACKAGE" "$NDK_DIR" "$FILES"
|
||||||
|
fail_panic "Can't package python headers"
|
||||||
|
cache_package "$PACKAGE_DIR" "$PACKAGE_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ABI in $BUILT_ABIS; do
|
||||||
|
FILES="$PYTHON_SUBDIR/$PYTHON_ABI/libs/$ABI"
|
||||||
|
PACKAGE_NAME="python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}-libs-${ABI}.tar.xz"
|
||||||
|
PACKAGE="$PACKAGE_DIR/$PACKAGE_NAME"
|
||||||
|
dump "Packaging: $PACKAGE"
|
||||||
|
pack_archive "$PACKAGE" "$NDK_DIR" "$FILES"
|
||||||
|
fail_panic "Can't package python $ABI libs"
|
||||||
|
cache_package "$PACKAGE_DIR" "$PACKAGE_NAME"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$OPTION_BUILD_DIR" ]; then
|
||||||
|
log "Cleaning up..."
|
||||||
|
rm -rf $BUILD_DIR
|
||||||
|
else
|
||||||
|
log "Don't forget to cleanup: $BUILD_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Done!"
|
|
@ -20,6 +20,7 @@ lbrynet.androidhelpers.paths.android_app_external_storage_dir = lambda: lbrynet_
|
||||||
# Retrieve the Anroid keystore
|
# Retrieve the Anroid keystore
|
||||||
ks = lbrynet_utils.initKeyStore(service.getApplicationContext());
|
ks = lbrynet_utils.initKeyStore(service.getApplicationContext());
|
||||||
|
|
||||||
|
'''
|
||||||
import lbrynet.daemon.auth
|
import lbrynet.daemon.auth
|
||||||
from lbrynet.daemon.auth.util import APIKey, API_KEY_NAME
|
from lbrynet.daemon.auth.util import APIKey, API_KEY_NAME
|
||||||
|
|
||||||
|
@ -49,10 +50,10 @@ def initialize_api_key_file(key_path):
|
||||||
keys.update({new_api_key.name: new_api_key})
|
keys.update({new_api_key.name: new_api_key})
|
||||||
save_api_keys(keys, key_path)
|
save_api_keys(keys, key_path)
|
||||||
|
|
||||||
|
|
||||||
lbrynet.daemon.auth.util.load_api_keys = load_api_keys
|
lbrynet.daemon.auth.util.load_api_keys = load_api_keys
|
||||||
lbrynet.daemon.auth.util.save_api_keys = save_api_keys
|
lbrynet.daemon.auth.util.save_api_keys = save_api_keys
|
||||||
lbrynet.daemon.auth.util.initialize_api_key_file = initialize_api_key_file
|
lbrynet.daemon.auth.util.initialize_api_key_file = initialize_api_key_file
|
||||||
|
'''
|
||||||
|
|
||||||
# Keyring backend
|
# Keyring backend
|
||||||
class LbryAndroidKeyring(keyring.backend.KeyringBackend):
|
class LbryAndroidKeyring(keyring.backend.KeyringBackend):
|
||||||
|
@ -76,7 +77,6 @@ keyring.set_keyring(LbryAndroidKeyring())
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from jsonrpc.proxy import JSONRPCProxy
|
|
||||||
|
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
@ -128,7 +128,8 @@ def start():
|
||||||
# TODO: specify components, initialise auth
|
# TODO: specify components, initialise auth
|
||||||
conf.settings.update({
|
conf.settings.update({
|
||||||
'components_to_skip': [PEER_PROTOCOL_SERVER_COMPONENT, REFLECTOR_COMPONENT],
|
'components_to_skip': [PEER_PROTOCOL_SERVER_COMPONENT, REFLECTOR_COMPONENT],
|
||||||
'concurrent_announcers': 0
|
'concurrent_announcers': 0,
|
||||||
|
'use_upnp': False
|
||||||
})
|
})
|
||||||
|
|
||||||
log.info('Final Settings: %s', conf.settings.get_current_settings_dict())
|
log.info('Final Settings: %s', conf.settings.get_current_settings_dict())
|
||||||
|
|
Loading…
Reference in a new issue