Compare commits

..

30 commits

Author SHA1 Message Date
jessopb d9d8195764
Merge pull request #16 from lbryio/update_to_112
update to sdk 112
2022-11-23 15:03:41 -05:00
zeppi ff4e2e5c8d update to sdk 112 2022-11-23 12:06:06 -05:00
jessopb 4e4ac58ff6
Merge pull request #14 from lbryio/deploy-final-alpha
new build system, 111
2022-11-23 10:18:48 -05:00
zeppi 82191da51a only ci on master push 2022-11-23 10:16:06 -05:00
zeppi 23ad7350aa just build and deploy to sonotype - no auto uploads/releases 2022-11-23 09:45:25 -05:00
zeppi 1b00cfc372 new build system, 111
full build

wip

troubleshoot

fix env vars

fix?

fix???

unterminated quoted string..

troubleshoot aws upload

test?
2022-11-23 09:45:06 -05:00
jessopb 97a42e29b9
Create deploy.yml 2022-11-18 15:36:15 -05:00
Akinwale Ariwodola 23c183ee51 cffi==1.14.6 2021-08-22 11:58:03 +01:00
Akinwale Ariwodola 8c0115ccee experiment with Python optimisations 2021-08-22 10:24:14 +01:00
Akinwale Ariwodola 6689f1a3d0 don't copy Android.mk for openssl recipe if it already exists 2021-08-22 09:23:45 +01:00
Akinwale Ariwodola f29cc3ee72 enable sqlite3 options for performance improvements 2021-08-22 08:20:59 +01:00
Akinwale Ariwodola 9d94a8fed5 fix sqlite3 includes in python3 recipe 2021-08-22 08:04:55 +01:00
Akinwale Ariwodola e72071fc3f openssl==1.1.1k, sqlite3==3.36.0 2021-08-22 07:45:58 +01:00
Akinwale Ariwodola c84abccbfa fix netifaces recipe 2021-08-21 21:25:02 +01:00
Akinwale Ariwodola d175c8e896 restore netifaces recipe 2021-08-21 21:09:54 +01:00
Akinwale Ariwodola 8bbb5bb6a7 keyring==21.0.0. Remove netifaces. 2021-08-21 20:53:13 +01:00
Akinwale Ariwodola 440144b658 remove unused .gitsecret folder 2021-08-21 20:37:34 +01:00
Akinwale Ariwodola 82e3c4442a update Python 3.9 Dockerfile 2021-08-21 20:37:34 +01:00
Akinwale Ariwodola 46499d4fa3 update gitlab ci artifact names 2021-08-21 20:37:34 +01:00
Akinwale Ariwodola 12a30c60b2 fix gitlab ci 2021-08-21 20:37:33 +01:00
Akinwale Ariwodola 66997739ac skip buildozer sdkmanager update 2021-08-21 20:36:29 +01:00
Akinwale Ariwodola 53f11c2985 drop Python 2.7 support from Docker build 2021-08-21 18:41:22 +01:00
Akinwale Ariwodola 69266081e8 drop Python 2.7 support from Docker build 2021-08-21 16:36:38 +01:00
Akinwale Ariwodola 1b4b7bb9b9 define Py_BUILD_CORE for unicodedata module 2021-08-21 13:43:52 +01:00
Akinwale Ariwodola 8aa68d6d8e add _xxsubinterpreters module to Python config.c 2021-08-21 13:41:24 +01:00
Akinwale Ariwodola a4eadd32c8 add missing C files to makefile 2021-08-21 12:37:07 +01:00
Akinwale Ariwodola 593e036a1d remove unused recipes 2021-08-21 12:20:13 +01:00
Akinwale Ariwodola ec5a213a23 python3crystax recipe cleanup 2021-08-21 10:51:48 +01:00
Akinwale Ariwodola b09e468ffb
Python 3.9.6 (#11)
* build Python 3.9.6
* use Python 3.9 docker image
* fix pyjnius recipe
* remove unused dependencies from cryptography recipe
* fix PYTHON3_DLL_REL_PATH value
* add idna requirement
* Remove m abi flag from python lib (https://docs.python.org/3/whatsnew/3.8.html#build-and-c-api-changes)
* aiohttp==3.6.0
* Add base Dockerfiles for builds
2021-08-21 10:30:12 +01:00
Akinwale Ariwodola 304322858c sdk 0.102.0 2021-08-19 12:51:06 +01:00
53 changed files with 1665 additions and 231 deletions

117
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,117 @@
name: Publish Assets
on:
push:
branches: [master]
jobs:
build_arm64_aar:
runs-on: ubuntu-latest
container: lbry/android-base:python39
steps:
- name: checkout
uses: actions/checkout@v3
- name: hacky copy # docker image runs ~ as /root, but github actions uses ~=/github/home
run: |
cp -r /root/.buildozer ~/.buildozer/
- name: setup
run: |
export B_VERSION=$(cat $GITHUB_WORKSPACE/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
echo "NEXUS_SIGNING_KEYRING_FILE=$GITHUB_WORKSPACE/signing2.pgp" >> $GITHUB_ENV
echo "BUILD_VERSION=${B_VERSION}" >> $GITHUB_ENV
export PATH=/usr/bin:$PATH
wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
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
cp -f $GITHUB_WORKSPACE/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
cp -f $GITHUB_WORKSPACE/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
cp -f $GITHUB_WORKSPACE/scripts/build-binary.mk ~/.buildozer/android/crystax-ndk-10.3.2/build/core/build-binary.mk
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
cp -Rf $GITHUB_WORKSPACE/scripts/crystax-sources/sqlite ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
mv buildozer.spec.arm64.ci buildozer.spec
chmod u+x ./build-release.sh
- name: build release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
NEXUS_SIGNING_KEY_PASSWORD: ${{ secrets.NEXUS_SIGNING_KEY_PASSWORD }}
NEXUS_SIGNING_KEY_ID: ${{ secrets.NEXUS_SIGNING_KEY_ID }}
run: ./build-release.sh
# - name: debug bin
# run : ls -al ./bin
# - name: upload to build_lbry_io
# run : |
# pip install awscli
# export PR_NUMBER=${{ github.event.number }}
# export BUILD_APK_FILENAME__64=lbrysdk-${{ env.BUILD_VERSION }}-arm64-v8a-release.aar
# aws s3 cp ./bin/${BUILD_APK_FILENAME__64} s3://build.lbry.io/android/sdk-build-${PR_NUMBER}_commit-${{ github.sha }}/${BUILD_APK_FILENAME__64}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
# - name: github release
# if: startsWith(github.ref, 'refs/tags/v')
# run: |
# pip install githubrelease
# export GITHUB_TOKEN=${{ github.token }}
# githubrelease release lbryio/lbry-android-sdk create ${{ github.ref_name }} --publish bin/${BUILD_APK_FILENAME__64}
build_arm_aar:
runs-on: ubuntu-latest
container: lbry/android-base:python39
needs: [build_arm64_aar]
steps:
- name: checkout
uses: actions/checkout@v3
- name: hacky copy # docker image runs ~ as /root, but github actions uses ~=/github/home
run: |
cp -r /root/.buildozer ~/.buildozer/
- name: setup
run: |
export B_VERSION=$(cat $GITHUB_WORKSPACE/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
echo "BUILD_VERSION=${B_VERSION}" >> $GITHUB_ENV
echo "NEXUS_SIGNING_KEYRING_FILE=$GITHUB_WORKSPACE/signing2.pgp" >> $GITHUB_ENV
export PATH=/usr/bin:$PATH
wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
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
cp -f $GITHUB_WORKSPACE/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle.arm $GITHUB_WORKSPACE/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle
cp -f $GITHUB_WORKSPACE/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
cp -f $GITHUB_WORKSPACE/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
cp -f $GITHUB_WORKSPACE/scripts/build-binary.mk ~/.buildozer/android/crystax-ndk-10.3.2/build/core/build-binary.mk
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
cp -Rf $GITHUB_WORKSPACE/scripts/crystax-sources/sqlite ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
mv buildozer.spec.arm64.ci buildozer.spec
chmod u+x ./build-release.sh
- name: build release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
NEXUS_SIGNING_KEY_PASSWORD: ${{ secrets.NEXUS_SIGNING_KEY_PASSWORD }}
NEXUS_SIGNING_KEY_ID: ${{ secrets.NEXUS_SIGNING_KEY_ID }}
run: ./build-release.sh
# - name: upload to build_lbry_io
# run : |
# pip install awscli
# export PR_NUMBER=${{ github.event.number }}
# export BUILD_APK_FILENAME__32=lbrysdk-${{ env.BUILD_VERSION }}-armeabi-v7a-release.aar
# aws s3 cp bin/${BUILD_APK_FILENAME__32} s3://build.lbry.io/android/sdk-build-{$PR_NUMBER}_commit-${{ github.sha }}/${BUILD_APK_FILENAME__32}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
# - name: github upload binary
# if: startsWith(github.ref, 'refs/tags/v')
# uses: skx/github-action-publish-binaries@release-1.3
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BUILD_VERSION: ${{ env.BUILD_VERSION }}
# with:
# args: bin/${BUILD_APK_FILENAME__32}

1
.gitignore vendored
View file

@ -11,6 +11,7 @@ src/main/assets/index.android.bundle
src/main/assets/index.android.bundle.meta src/main/assets/index.android.bundle.meta
*.log *.log
.vagrant .vagrant
.vscode
lbry-android.keystore lbry-android.keystore
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json

View file

@ -6,12 +6,12 @@ stages:
build arm64 aar: build arm64 aar:
stage: build stage: build
image: lbry/android-base:latest image: lbry/android-base:python39
before_script: before_script:
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
artifacts: artifacts:
paths: paths:
- bin/lbrysdk-*-release__arm64.aar - bin/lbrysdk-*-arm64-v8a-release.aar
expire_in: 1 week expire_in: 1 week
script: script:
- export NEXUS_SIGNING_KEYRING_FILE=$CI_PROJECT_DIR/signing.pgp - export NEXUS_SIGNING_KEYRING_FILE=$CI_PROJECT_DIR/signing.pgp
@ -22,21 +22,23 @@ build arm64 aar:
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.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
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh - cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h - cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
- cp -f $CI_PROJECT_DIR/scripts/build-binary.mk ~/.buildozer/android/crystax-ndk-10.3.2/build/core/build-binary.mk
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
- cp -Rf $CI_PROJECT_DIR/scripts/crystax-sources/sqlite ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz - rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
- mv buildozer.spec.arm64.ci buildozer.spec - mv buildozer.spec.arm64.ci buildozer.spec
- chmod u+x ./build-release.sh - chmod u+x ./build-release.sh
- "./build-release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered" - ./build-release.sh
- cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release.aar $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release__arm64.aar - cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-arm64-v8a-release.aar /dev/null
- cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release.aar /dev/null
build arm aar: build arm aar:
stage: build2 stage: build2
image: lbry/android-base:latest image: lbry/android-base:python39
before_script: before_script:
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
artifacts: artifacts:
paths: paths:
- bin/lbrysdk-*-release__arm.aar - bin/lbrysdk-*-armeabi-v7a-release.aar
expire_in: 1 week expire_in: 1 week
script: script:
- export NEXUS_SIGNING_KEYRING_FILE=$CI_PROJECT_DIR/signing.pgp - export NEXUS_SIGNING_KEYRING_FILE=$CI_PROJECT_DIR/signing.pgp
@ -48,12 +50,14 @@ build arm aar:
- cp -f $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle.arm $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle - cp -f $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle.arm $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh - cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h - cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
- cp -f $CI_PROJECT_DIR/scripts/build-binary.mk ~/.buildozer/android/crystax-ndk-10.3.2/build/core/build-binary.mk
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
- cp -Rf $CI_PROJECT_DIR/scripts/crystax-sources/sqlite ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz - rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
- mv buildozer.spec.arm.ci buildozer.spec - mv buildozer.spec.arm.ci buildozer.spec
- chmod u+x ./build-release.sh - chmod u+x ./build-release.sh
- "./build-release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered" - ./build-release.sh
- cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release.aar $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release__arm.aar - cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-armeabi-v7a-release.aar /dev/null
- cp $CI_PROJECT_DIR/bin/lbrysdk-$BUILD_VERSION-release.aar /dev/null
deploy build.lbry.io: deploy build.lbry.io:
image: python:latest image: python:latest
@ -64,8 +68,8 @@ deploy build.lbry.io:
before_script: before_script:
- pip install awscli - pip install awscli
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
- export BUILD_APK_FILENAME__32=lbrysdk-$BUILD_VERSION-release__arm.aar - export BUILD_APK_FILENAME__32=lbrysdk-$BUILD_VERSION-armeabi-v7a-release.aar
- export BUILD_APK_FILENAME__64=lbrysdk-$BUILD_VERSION-release__arm64.aar - export BUILD_APK_FILENAME__64=lbrysdk-$BUILD_VERSION-arm64-v8a-release.aar
script: script:
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/sdk-build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__64 - aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/sdk-build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__64
- aws s3 cp bin/$BUILD_APK_FILENAME__32 s3://build.lbry.io/android/sdk-build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__32 - aws s3 cp bin/$BUILD_APK_FILENAME__32 s3://build.lbry.io/android/sdk-build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__32
@ -81,7 +85,7 @@ release aar:
before_script: before_script:
- pip install awscli githubrelease - pip install awscli githubrelease
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
- export BUILD_APK_FILENAME__32=lbrysdk-$BUILD_VERSION-release__arm.aar - export BUILD_APK_FILENAME__32=lbrysdk-$BUILD_VERSION-armeabi-v7a-release.aar
- export BUILD_APK_FILENAME__64=lbrysdk-$BUILD_VERSION-release__arm64.aar - export BUILD_APK_FILENAME__64=lbrysdk-$BUILD_VERSION-arm64-v8a-release.aar
script: script:
- githubrelease release lbryio/lbry-android-sdk create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME__64 bin/$BUILD_APK_FILENAME__32 - githubrelease release lbryio/lbry-android-sdk create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME__64 bin/$BUILD_APK_FILENAME__32

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,2 +0,0 @@
lbry-android.keystore:
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json

View file

@ -135,3 +135,17 @@ If you already installed `Android SDK` and `adb`
Note: You need to have your device connected with USB debugging. Note: You need to have your device connected with USB debugging.
Once the bundler is ready, run the LBRY Browser app on your device and then shake the device violently until you see the React Native dev menu. You can enable "Live Reloading" and "Hot Reloading" from this menu, so any changes you make to the React Native code will be visible as you save. This will only reload React Native Javascript files. Native Java code needs to be redeployed by running the command `./deploy.sh` Once the bundler is ready, run the LBRY Browser app on your device and then shake the device violently until you see the React Native dev menu. You can enable "Live Reloading" and "Hot Reloading" from this menu, so any changes you make to the React Native code will be visible as you save. This will only reload React Native Javascript files. Native Java code needs to be redeployed by running the command `./deploy.sh`
## Update LBRY SDK Version
### Update the `requirements` section following files
* buildozer.spec.arm.ci
* buildozer.spec.arm64.ci
* buildozer.spec.sample
* buildozer.spec.vagrant
### Update LBRY_SDK_VERSION in `src/main/java/io/lbry/lbrysdk/LbrynetService.java`
### Update the version in `src/main/python/main.py`
## Github Actions CI

View file

@ -39,7 +39,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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.100.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (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
@ -118,7 +118,7 @@ android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
# (bool) If True, then skip trying to update the Android sdk # (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time # This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package # when an update is due and you just want to test/build your package
#android.skip_update = False android.skip_update = True
# (str) Android entry point, default is ok for Kivy-based app # (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity #android.entrypoint = org.renpy.android.PythonActivity

View file

@ -39,7 +39,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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.100.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (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
@ -118,7 +118,7 @@ android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
# (bool) If True, then skip trying to update the Android sdk # (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time # This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package # when an update is due and you just want to test/build your package
#android.skip_update = False android.skip_update = True
# (str) Android entry point, default is ok for Kivy-based app # (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity #android.entrypoint = org.renpy.android.PythonActivity

View file

@ -39,7 +39,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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.100.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (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
@ -118,7 +118,7 @@ android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
# (bool) If True, then skip trying to update the Android sdk # (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time # This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package # when an update is due and you just want to test/build your package
#android.skip_update = False android.skip_update = True
# (str) Android entry point, default is ok for Kivy-based app # (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity #android.entrypoint = org.renpy.android.PythonActivity

View file

@ -39,7 +39,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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.100.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, netifaces, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
# (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
@ -118,7 +118,7 @@ android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
# (bool) If True, then skip trying to update the Android sdk # (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time # This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package # when an update is due and you just want to test/build your package
#android.skip_update = False android.skip_update = True
# (str) Android entry point, default is ok for Kivy-based app # (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity #android.entrypoint = org.renpy.android.PythonActivity
@ -275,4 +275,4 @@ warn_on_root = 1
# Then, invoke the command line with the "demo" profile: # Then, invoke the command line with the "demo" profile:
# #
#buildozer --profile demo android debug #buildozer --profile demo android debug
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2020.12.5, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.100.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2020.12.5, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"

View file

@ -0,0 +1,36 @@
FROM ubuntu:18.04
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN dpkg --add-architecture i386
RUN apt-get -y update && apt-get -y install curl ca-certificates software-properties-common gpg-agent wget
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
build-essential python3.7 python3.7-dev python3.7-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 \
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 gawk
RUN pip install --upgrade cython==0.28.1 setuptools zipp==1.2.0 importlib-resources==1.0.2 importlib-metadata==0.20 virtualenv==20.4.7
RUN git clone https://github.com/lbryio/buildozer.git
RUN cd buildozer && python2 setup.py install && cd ..
RUN mkdir -p cd ~/.buildozer/android/platform/
RUN wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/build-tools_r28.0.3-linux.zip' -P ~/.buildozer/android/platform/ && \
tar -xvf ~/.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 && \
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms && \
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-28 && \
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools && \
unzip ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools && \
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-9 ~/.buildozer/android/platform/android-sdk-23/build-tools/28.0.3 && \
rm ~/.buildozer/android/platform/android-sdk_r23-linux.tgz && \
rm ~/.buildozer/android/platform/platform-28_r06.zip && \
rm ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip
RUN mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses && \
echo $'\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
CMD ["/bin/bash"]

View file

@ -0,0 +1,47 @@
FROM ubuntu:20.04
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN dpkg --add-architecture i386
RUN apt-get -y update && apt-get -y install curl ca-certificates software-properties-common gpg-agent wget
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install autoconf autogen automake \
libtool libffi-dev build-essential python3.9 python3.9-dev python3.9-venv ccache git \
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 \
libidn11:i386 openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 gawk
RUN rm /usr/bin/python3 && ln -s /usr/bin/python3.9 /usr/bin/python3
RUN rm -f /usr/bin/python && ln -s /usr/bin/python3.9 /usr/bin/python
RUN wget https://bootstrap.pypa.io/pip/get-pip.py && python3 get-pip.py
RUN pip install --upgrade cython==0.29.24 setuptools zipp importlib-resources importlib-metadata virtualenv appdirs sh colorama\>=0.3.3 jinja2 six pep517\<0.7.0 toml
RUN mkdir -p cd ~/.buildozer/android/platform/
RUN wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/build-tools_r28.0.3-linux.zip' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip' -P ~/.buildozer/android/platform
RUN tar -xvf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/ && \
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk && \
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk/platforms && \
mv ~/.buildozer/android/platform/android-sdk/platforms/android-9 ~/.buildozer/android/platform/android-sdk/platforms/android-28 && \
mkdir -p ~/.buildozer/android/platform/android-sdk/build-tools && \
unzip ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip -d ~/.buildozer/android/platform/android-sdk/build-tools && \
mv ~/.buildozer/android/platform/android-sdk/build-tools/android-9 ~/.buildozer/android/platform/android-sdk/build-tools/28.0.3 && \
mkdir -p ~/.buildozer/android/platform/android-sdk/cmdline-tools && \
unzip ~/.buildozer/android/platform/commandlinetools-linux-7583922_latest.zip -d ~/.buildozer/android/platform/android-sdk/cmdline-tools && \
mv ~/.buildozer/android/platform/android-sdk/cmdline-tools/cmdline-tools ~/.buildozer/android/platform/android-sdk/cmdline-tools/5.0 && \
cp -Rf ~/.buildozer/android/platform/android-sdk/cmdline-tools/5.0/* ~/.buildozer/android/platform/android-sdk/tools
RUN rm ~/.buildozer/android/platform/android-sdk_r23-linux.tgz && \
rm ~/.buildozer/android/platform/platform-28_r06.zip && \
rm ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip && \
rm ~/.buildozer/android/platform/commandlinetools-linux-7583922_latest.zip
RUN mkdir -p ~/.buildozer/android/platform/android-sdk/licenses && \
echo $'\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee' > ~/.buildozer/android/platform/android-sdk/licenses/android-sdk-license
RUN git clone https://github.com/lbryio/buildozer.git
RUN cd buildozer && python setup.py install && cd ..
CMD ["/bin/bash"]

View file

@ -76,7 +76,7 @@ public class PythonActivity extends SDLActivity {
public void loadLibraries() { public void loadLibraries() {
String app_root = new String(getAppRoot()); String app_root = new String(getAppRoot());
File app_root_file = new File(app_root); File app_root_file = new File(app_root);
PythonUtil.loadLibraries(app_root_file); PythonUtil.loadLibraries(app_root_file, new File(getApplicationInfo().nativeLibraryDir));
} }
public void recursiveDelete(File f) { public void recursiveDelete(File f) {

View file

@ -119,7 +119,7 @@ public class PythonService extends Service implements Runnable {
public void run(){ public void run(){
String app_root = getFilesDir().getAbsolutePath() + "/app"; String app_root = getFilesDir().getAbsolutePath() + "/app";
File app_root_file = new File(app_root); File app_root_file = new File(app_root);
PythonUtil.loadLibraries(app_root_file); PythonUtil.loadLibraries(app_root_file, new File(getApplicationInfo().nativeLibraryDir));
this.mService = this; this.mService = this;
nativeStart( nativeStart(
androidPrivate, androidArgument, androidPrivate, androidArgument,

View file

@ -1,34 +1,48 @@
package org.kivy.android; package org.kivy.android;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.regex.Pattern;
import android.util.Log; import android.util.Log;
public class PythonUtil { public class PythonUtil {
private static final String TAG = "PythonUtil"; private static final String TAG = "pythonutil";
protected static String[] getLibraries() { protected static void addLibraryIfExists(ArrayList<String> libsList, String pattern, File libsDir) {
return new String[] { // pattern should be the name of the lib file, without the
"SDL2", // preceding "lib" or suffix ".so", for instance "ssl.*" will
"SDL2_image", // match files of the form "libssl.*.so".
"SDL2_mixer", File [] files = libsDir.listFiles();
"SDL2_ttf",
"python2.7", pattern = "lib" + pattern + "\\.so";
"python3.5m", Pattern p = Pattern.compile(pattern);
"python3.6m", for (int i = 0; i < files.length; ++i) {
"python3.7m", File file = files[i];
"main" String name = file.getName();
}; Log.v(TAG, "Checking pattern " + pattern + " against " + name);
if (p.matcher(name).matches()) {
Log.v(TAG, "Pattern " + pattern + " matched file " + name);
libsList.add(name.substring(3, name.length() - 3));
}
}
}
protected static ArrayList<String> getLibraries(File libsDir) {
ArrayList<String> libsList = new ArrayList<String>();
libsList.add("python3.7m");
libsList.add("python3.8");
libsList.add("python3.9");
libsList.add("main");
return libsList;
} }
public static void loadLibraries(File filesDir) { public static void loadLibraries(File filesDir, File libsDir) {
String filesDirPath = filesDir.getAbsolutePath();
boolean foundPython = false; boolean foundPython = false;
for (String lib : getLibraries()) { for (String lib : getLibraries(libsDir)) {
try { Log.v(TAG, "Loading library: " + lib);
try {
System.loadLibrary(lib); System.loadLibrary(lib);
if (lib.startsWith("python")) { if (lib.startsWith("python")) {
foundPython = true; foundPython = true;
@ -37,27 +51,18 @@ public class PythonUtil {
// If this is the last possible libpython // If this is the last possible libpython
// load, and it has failed, give a more // load, and it has failed, give a more
// general error // general error
if (lib.startsWith("python3.7") && !foundPython) { Log.v(TAG, "Library loading error: " + e.getMessage());
throw new java.lang.RuntimeException("Could not load any libpythonXXX.so"); if (lib.startsWith("python3.9") && !foundPython) {
throw new RuntimeException("Could not load any libpythonXXX.so");
} else if (lib.startsWith("python")) {
continue;
} else {
Log.v(TAG, "An UnsatisfiedLinkError occurred loading " + lib);
throw e;
} }
continue;
} }
} }
try {
System.load(filesDirPath + "/lib/python2.7/lib-dynload/_io.so");
System.load(filesDirPath + "/lib/python2.7/lib-dynload/unicodedata.so");
} catch(UnsatisfiedLinkError e) {
Log.v(TAG, "Failed to load _io.so or unicodedata.so...but that's okay.");
}
try {
// System.loadLibrary("ctypes");
System.load(filesDirPath + "/lib/python2.7/lib-dynload/_ctypes.so");
} catch(UnsatisfiedLinkError e) {
Log.v(TAG, "Unsatisfied linker when loading ctypes");
}
Log.v(TAG, "Loaded everything!"); Log.v(TAG, "Loaded everything!");
} }
} }

View file

@ -658,8 +658,8 @@ class BootstrapNDKRecipe(Recipe):
env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch) env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch)
env['EXTRA_LDLIBS'] = ' -lpython{}'.format( env['EXTRA_LDLIBS'] = ' -lpython{}'.format(
self.ctx.python_recipe.major_minor_version_string) self.ctx.python_recipe.major_minor_version_string)
if 'python3' in self.ctx.python_recipe.name: #if 'python3' in self.ctx.python_recipe.name:
env['EXTRA_LDLIBS'] += 'm' # env['EXTRA_LDLIBS'] += 'm'
return env return env
@ -803,7 +803,7 @@ class PythonRecipe(Recipe):
'python')) 'python'))
env['LDFLAGS'] += ' -L{}'.format( env['LDFLAGS'] += ' -L{}'.format(
join(ndk_dir_python, 'libs', arch.arch)) join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_short_version) env['LDFLAGS'] += ' -lpython{}'.format(python_short_version)
hppath = [] hppath = []
hppath.append(join(dirname(self.hostpython_location), 'Lib')) hppath.append(join(dirname(self.hostpython_location), 'Lib'))

View file

@ -5,7 +5,7 @@ from pythonforandroid.recipe import CompiledComponentsPythonRecipe
class CffiRecipe(CompiledComponentsPythonRecipe): class CffiRecipe(CompiledComponentsPythonRecipe):
name = 'cffi' name = 'cffi'
version = '1.13.2' version = '1.14.6'
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'
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi'] depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
@ -48,7 +48,7 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
python_version = self.ctx.python_recipe.version[0:3] python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version) 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'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version) env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream: # until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6 # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -26,7 +26,7 @@ class CoincurveRecipe(CompiledComponentsPythonRecipe):
if self.ctx.ndk == 'crystax': if self.ctx.ndk == 'crystax':
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version) 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'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version) env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream: # until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6 # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -6,7 +6,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
name = 'cryptography' name = 'cryptography'
version = '3.1.1' version = '3.1.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', 'ipaddress', 'cffi'] depends = [('python2', 'python3crystax'), 'openssl', 'six', 'setuptools', 'cffi']
call_hostpython_via_targetpython = False call_hostpython_via_targetpython = False
patches = ['libpthread.patch'] patches = ['libpthread.patch']
@ -26,7 +26,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
python_version = self.ctx.python_recipe.version[0:3] python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version) 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'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version) env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream: # until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6 # 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)) env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) + ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))

View file

@ -1,14 +0,0 @@
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()

View file

@ -1,4 +1,3 @@
import glob import glob
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
from os.path import join from os.path import join
@ -20,10 +19,10 @@ class NetifacesRecipe(CompiledComponentsPythonRecipe):
if self.ctx.ndk == 'crystax': if self.ctx.ndk == 'crystax':
# only keeps major.minor (discards patch) # only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3] python_version = self.ctx.python_recipe.version
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version) 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'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version) env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream: # until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6 # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -8,7 +8,7 @@ import sh
class OpenSSLRecipe(Recipe): class OpenSSLRecipe(Recipe):
version = '1.1' version = '1.1'
url_version = '1.1.1b' url_version = '1.1.1k'
url = 'https://www.openssl.org/source/openssl-{url_version}.tar.gz' url = 'https://www.openssl.org/source/openssl-{url_version}.tar.gz'
@property @property

View file

@ -6,9 +6,7 @@ from os.path import join
class PyjniusRecipe(CythonRecipe): class PyjniusRecipe(CythonRecipe):
# "6553ad4" is one commit after last release (1.2.0) version = '1.3.0'
# it fixes method resolution, required for resolving requestPermissions()
version = '6553ad4'
url = 'https://github.com/kivy/pyjnius/archive/{version}.zip' url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
name = 'pyjnius' name = 'pyjnius'
depends = [('genericndkbuild', 'sdl2', 'sdl'), 'six'] depends = [('genericndkbuild', 'sdl2', 'sdl'), 'six']

View file

@ -10,16 +10,16 @@ index ac89fec..71daa43 100644
cdef JNIEnv *get_platform_jnienv(): cdef JNIEnv *get_platform_jnienv():
- return SDL_ANDROID_GetJNIEnv() - return SDL_ANDROID_GetJNIEnv()
+ return <JNIEnv*>WebView_AndroidGetJNIEnv() + return <JNIEnv*>WebView_AndroidGetJNIEnv()
diff --git a/setup.py b/setup.py diff --git a/jnius/env.py b/jnius/env.py
index 740510f..0c8e55f 100644 --- a/jnius/env.py
--- a/setup.py +++ b/jnius/env.py
+++ b/setup.py @@ -185,10 +185,10 @@ except ImportError:
@@ -53,7 +53,7 @@ except ImportError:
if PLATFORM == 'android': def get_libraries(platform):
# for android, we use SDL... if platform == 'android':
- LIBRARIES = ['sdl', 'log'] # for android, we use SDL...
+ LIBRARIES = ['main', 'log'] - return ['sdl', 'log']
LIBRARY_DIRS = ['libs/' + getenv('ARCH')] + return ['main', 'log']
elif PLATFORM == 'darwin':
import subprocess elif platform == 'win32':
return ['jvm']

View file

@ -10,16 +10,17 @@ index ac89fec..71daa43 100644
cdef JNIEnv *get_platform_jnienv(): cdef JNIEnv *get_platform_jnienv():
- return SDL_ANDROID_GetJNIEnv() - return SDL_ANDROID_GetJNIEnv()
+ return <JNIEnv*>SDL_AndroidGetJNIEnv() + return <JNIEnv*>SDL_AndroidGetJNIEnv()
diff --git a/setup.py b/setup.py diff --git a/env.py b/env.py
index 740510f..0c8e55f 100644 index 740510f..0c8e55f 100644
--- a/setup.py --- a/jnius/env.py
+++ b/setup.py +++ b/jnius/env.py
@@ -53,7 +53,7 @@ except ImportError: @@ -185,10 +185,10 @@ except ImportError:
if PLATFORM == 'android': def get_libraries(platform):
# for android, we use SDL... if platform == 'android':
- LIBRARIES = ['sdl', 'log'] # for android, we use SDL...
+ LIBRARIES = ['SDL2', 'log'] - return ['sdl', 'log']
LIBRARY_DIRS = ['libs/' + getenv('ARCH')] + return ['SDL2', 'log']
elif PLATFORM == 'darwin':
import subprocess elif platform == 'win32':
return ['jvm']

View file

@ -33,7 +33,8 @@ OPENSSLCONF = """#if defined(__ARM_ARCH_5TE__)
LATEST_FULL_VERSION = { LATEST_FULL_VERSION = {
'3.5': '3.5.1', '3.5': '3.5.1',
'3.6': '3.6.6', '3.6': '3.6.6',
'3.7': '3.7.1' '3.7': '3.7.1',
'3.9': '3.9.6'
} }
def realpath(fname): def realpath(fname):
@ -61,17 +62,17 @@ def realpath(fname):
return os.sep.join(abs_path) return os.sep.join(abs_path)
class Python3Recipe(TargetPythonRecipe): class Python3Recipe(TargetPythonRecipe):
version = '3.7' version = '3.9'
url = '' url = ''
name = 'python3crystax' name = 'python3crystax'
depends = ['hostpython3crystax'] depends = ['hostpython3crystax', 'sqlite3', 'openssl']
conflicts = ['python2', 'python3'] conflicts = ['python2', 'python3']
from_crystax = True from_crystax = True
def download_if_necessary(self): def download_if_necessary(self):
if 'openssl' in self.ctx.recipe_build_order or self.version == '3.6' or self.version == '3.7': if 'openssl' in self.ctx.recipe_build_order or self.version in ('3.6', '3.7', '3.9'):
full_version = LATEST_FULL_VERSION[self.version] 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('.')) 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() super(Python3Recipe, self).download_if_necessary()
@ -122,6 +123,36 @@ class Python3Recipe(TargetPythonRecipe):
return join(self.ctx.ndk_dir, 'sources', 'python', self.major_minor_version_string, return join(self.ctx.ndk_dir, 'sources', 'python', self.major_minor_version_string,
'libs', arch_name) 'libs', arch_name)
def check_for_sqlite3so(self, sqlite_recipe, arch):
dynlib_dir = join(self.ctx.ndk_dir, 'sources', 'python', self.version,
'libs', arch.arch, 'modules')
if os.path.exists(join(dynlib_dir, 'libsqlite3.so')):
return 10, 'Shared object exists in ndk'
major_version = sqlite_recipe.version.split('.')[0]
# find out why _ssl.so is missin
source_dir = join(self.ctx.ndk_dir, 'sources', 'sqlite', major_version)
if not os.path.exists(source_dir):
return 0, 'sqlite3 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 sqlite3 source'
include_dir = join(source_dir, 'include')
if not os.path.exists(join(include_dir, 'sqlite3.h')):
return 1.2, 'sqlite3 include dir missing'
# 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, 'libsqlite3.a')):
return 2, 'sqlite3 libs for this arch is missing in ndk'
return 5, 'Ready to recompile python'
def check_for_sslso(self, ssl_recipe, arch): def check_for_sslso(self, ssl_recipe, arch):
# type: (Recipe, str) # type: (Recipe, str)
dynlib_dir = join(self.ctx.ndk_dir, 'sources', 'python', self.version, dynlib_dir = join(self.ctx.ndk_dir, 'sources', 'python', self.version,
@ -131,7 +162,6 @@ class Python3Recipe(TargetPythonRecipe):
return 10, 'Shared object exists in ndk' return 10, 'Shared object exists in ndk'
# find out why _ssl.so is missing # find out why _ssl.so is missing
source_dir = join(self.ctx.ndk_dir, 'sources', 'openssl', ssl_recipe.version) source_dir = join(self.ctx.ndk_dir, 'sources', 'openssl', ssl_recipe.version)
if not os.path.exists(source_dir): if not os.path.exists(source_dir):
return 0, 'Openssl version not present' return 0, 'Openssl version not present'
@ -150,8 +180,6 @@ class Python3Recipe(TargetPythonRecipe):
'opensslconf_{}.h'.format(under_scored_arch))): 'opensslconf_{}.h'.format(under_scored_arch))):
return 1.3, 'Opensslconf arch header missing from include' return 1.3, 'Opensslconf arch header missing from include'
# lastly a check to see whether shared objects for the correct arch # lastly a check to see whether shared objects for the correct arch
# is present in the ndk # is present in the ndk
if not os.path.exists(join(source_dir, 'libs', arch.arch)): if not os.path.exists(join(source_dir, 'libs', arch.arch)):
@ -166,45 +194,119 @@ class Python3Recipe(TargetPythonRecipe):
if os.path.exists(mk_path): if os.path.exists(mk_path):
return mk_path return mk_path
def find_sqlite3_Android_mk(self):
sqlite_dir = join(self.ctx.ndk_dir, 'sources', 'sqlite')
for version in os.listdir(sqlite_dir):
mk_path = join(sqlite_dir, version, 'Android.mk')
if os.path.exists(mk_path):
return mk_path
def prebuild_arch(self, arch): def prebuild_arch(self, arch):
super(Python3Recipe, self).prebuild_arch(arch) super(Python3Recipe, self).prebuild_arch(arch)
if self.version == '3.6' or self.version == '3.7': if self.version in ('3.6', '3.7', '3.9'):
Python3Recipe.patches = ['patch_python3.6.patch', 'remove_android_api_check.patch', 'selectors.patch'] Python3Recipe.patches = [
'patch/patch_python3.6.patch',
'patch/remove_android_api_check.patch',
'patch/selectors.patch'
]
if self.version in ('3.9'):
Python3Recipe.patches = [
'patch/remove_android_api_check.patch',
'patch/patch_python3.9.patch',
'patch/platlibdir.patch',
'patch/strdup.patch',
# from https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/python3/__init__.py#L63
'patch/pyconfig_detection.patch',
'patch/reproducible-buildinfo.diff',
'patch/py3.8.1.patch'
]
if sh.which('lld') is not None:
Python3Recipe.patches += ['patch/py3.8.1_fix_cortex_a8.patch']
build_dir = self.get_build_dir(arch.arch) build_dir = self.get_build_dir(arch.arch)
# copy bundled libffi to _ctypes # copy bundled libffi to _ctypes
sh.cp("-r", join(self.get_recipe_dir(), 'libffi'), join(build_dir, 'Modules', '_ctypes')) sh.cp("-r", join(self.get_recipe_dir(), 'libffi'), join(build_dir, 'Modules', '_ctypes'))
print #####Copied bundle####' print #####Copied bundle####'
shprint(sh.ln, '-sf', shprint(sh.ln, '-sf',
realpath(join(build_dir, 'Lib/site-packages/README.txt')), realpath(join(build_dir, 'Lib/site-packages/README.txt')),
join(build_dir, 'Lib/site-packages/README')) join(build_dir, 'Lib/site-packages/README'))
python_build_files = ['android.mk', 'config.c', 'interpreter.c'] python_build_files = ['android.mk', 'config.c', 'interpreter.c']
ndk_build_tools_python_dir = join(self.ctx.ndk_dir, 'build', 'tools', 'build-target-python') ndk_build_tools_python_dir = join(self.ctx.ndk_dir, 'build', 'tools', 'build-target-python')
for python_build_file in python_build_files: for python_build_file in python_build_files:
shprint(sh.cp, join(self.get_recipe_dir(), python_build_file+'.3.7'), shprint(sh.cp, join(self.get_recipe_dir(), '{}.{}'.format(python_build_file, self.version)),
join(ndk_build_tools_python_dir, python_build_file+'.3.7')) join(ndk_build_tools_python_dir, '{}.{}'.format(python_build_file, self.version)))
ndk_sources_python_dir = join(self.ctx.ndk_dir, 'sources', 'python') ndk_sources_python_dir = join(self.ctx.ndk_dir, 'sources', 'python')
if not os.path.exists(join(ndk_sources_python_dir, '3.7')): if not os.path.exists(join(ndk_sources_python_dir, self.version)):
os.mkdir(join(ndk_sources_python_dir, '3.7')) os.mkdir(join(ndk_sources_python_dir, self.version))
sh.sed('s#3.5#3.7#', sh.sed('s#3.5#{}#'.format(self.version),
join(ndk_sources_python_dir, '3.5/Android.mk'), join(ndk_sources_python_dir, '3.5/Android.mk'),
_out=join(ndk_sources_python_dir, '3.7/Android.mk')) _out=join(ndk_sources_python_dir, '{}/Android.mk.tmp'.format(self.version)))
sh.sed('s#{}m#{}#'.format(self.version, self.version),
join(ndk_sources_python_dir, '{}/Android.mk.tmp'.format(self.version)),
_out=join(ndk_sources_python_dir, '{}/Android.mk'.format(self.version)))
shprint(sh.rm, '-f', join(ndk_sources_python_dir, '{}/Android.mk.tmp'.format(self.version)))
def build_arch(self, arch): def build_arch(self, arch):
# If openssl is needed we may have to recompile cPython to get the rebuild = False
if self.from_crystax and 'sqlite3' in self.ctx.recipe_build_order:
info('checking sqlite3 in crystax-python')
sqlite_recipe = self.get_recipe('sqlite3', self.ctx)
stage, msg = self.check_for_sqlite3so(sqlite_recipe, arch)
major_version = sqlite_recipe.version.split('.')[0]
info(msg)
sqlite3_build_dir = sqlite_recipe.get_build_dir(arch.arch)
sqlite3_ndk_dir = join(self.ctx.ndk_dir, 'sources', 'sqlite', major_version)
if stage < 2:
info('copying sqlite3 Android.mk to ndk')
ensure_dir(sqlite3_ndk_dir)
if stage < 1.2:
# copy include folder and Android.mk to ndk
mk_path = self.find_sqlite3_Android_mk()
if mk_path is None:
raise IOError('Android.mk file could not be found in '
'any versions in ndk->sources->sqlite')
if not ssl_recipe.version in mk_path:
shprint(sh.cp, '-f', mk_path, sqlite3_ndk_dir)
include_dir = join(sqlite3_build_dir, 'include')
if stage < 1.3:
ndk_include_dir = join(sqlite3_ndk_dir, 'include')
ensure_dir(ndk_include_dir)
shprint(sh.cp, '-f', join(sqlite3_build_dir, 'sqlite3.h'), join(ndk_include_dir, 'sqlite3.h'))
shprint(sh.cp, '-f', join(sqlite3_build_dir, 'sqlite3ext.h'), join(ndk_include_dir, 'sqlite3ext.h'))
if stage < 3:
info('copying sqlite3 libs to ndk')
arch_ndk_lib = join(sqlite3_ndk_dir, 'libs', arch.arch)
ensure_dir(arch_ndk_lib)
shprint(sh.ln, '-sf',
realpath(join(sqlite3_build_dir, 'libsqlite3')),
join(sqlite3_build_dir, 'libsqlite3.a'))
libs = ['libs/{}/libsqlite3.a'.format(arch.arch)]
cmd = [join(sqlite3_build_dir, lib) for lib in libs] + [arch_ndk_lib]
shprint(sh.cp, '-f', *cmd)
if stage < 10:
rebuild = True
# If openssl is needed we may have to recompile cPython to get the
# ssl.py module working properly # ssl.py module working properly
if self.from_crystax and 'openssl' in self.ctx.recipe_build_order: if self.from_crystax and 'openssl' in self.ctx.recipe_build_order:
info('Openssl and crystax-python combination may require ' info('openssl and crystax-python combination may require '
'recompilation of python...') 'recompilation of python...')
ssl_recipe = self.get_recipe('openssl', self.ctx) ssl_recipe = self.get_recipe('openssl', self.ctx)
stage, msg = self.check_for_sslso(ssl_recipe, arch) stage, msg = self.check_for_sslso(ssl_recipe, arch)
stage = 0 if stage < 5 else stage stage = 0 if stage < 5 else stage
info(msg) info(msg)
openssl_build_dir = ssl_recipe.get_build_dir(arch.arch) openssl_build_dir = ssl_recipe.get_build_dir(arch.arch)
openssl_ndk_dir = join(self.ctx.ndk_dir, 'sources', 'openssl', openssl_ndk_dir = join(self.ctx.ndk_dir, 'sources', 'openssl', ssl_recipe.version)
ssl_recipe.version)
if stage < 2: if stage < 2:
info('Copying openssl headers and Android.mk to ndk') info('Copying openssl headers and Android.mk to ndk')
@ -253,16 +355,19 @@ class Python3Recipe(TargetPythonRecipe):
shprint(sh.cp, '-f', *cmd) shprint(sh.cp, '-f', *cmd)
if stage < 10: if stage < 10:
info('Recompiling python-crystax') rebuild = True
self.patch_dev_defaults(ssl_recipe)
build_script = join(self.ctx.ndk_dir, 'build', 'tools',
'build-target-python.sh')
shprint(Command(build_script), if rebuild:
'--ndk-dir={}'.format(self.ctx.ndk_dir), info('Recompiling python-crystax')
'--abis={}'.format(arch.arch), self.patch_dev_defaults(ssl_recipe)
'-j5', '--verbose', build_script = join(self.ctx.ndk_dir, 'build', 'tools',
self.get_build_dir(arch.arch)) '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') info('Extracting CrystaX python3 from NDK package')
dirn = self.ctx.get_python_install_dir() dirn = self.ctx.get_python_install_dir()

View file

@ -27,14 +27,17 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Python/getversion.c \ $(MY_PYTHON_SRC_ROOT)/Python/getversion.c \
$(MY_PYTHON_SRC_ROOT)/Python/graminit.c \ $(MY_PYTHON_SRC_ROOT)/Python/graminit.c \
$(MY_PYTHON_SRC_ROOT)/Python/hamt.c \ $(MY_PYTHON_SRC_ROOT)/Python/hamt.c \
$(MY_PYTHON_SRC_ROOT)/Python/hashtable.c \
$(MY_PYTHON_SRC_ROOT)/Python/import.c \ $(MY_PYTHON_SRC_ROOT)/Python/import.c \
$(MY_PYTHON_SRC_ROOT)/Python/importdl.c \ $(MY_PYTHON_SRC_ROOT)/Python/importdl.c \
$(MY_PYTHON_SRC_ROOT)/Python/initconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/marshal.c \ $(MY_PYTHON_SRC_ROOT)/Python/marshal.c \
$(MY_PYTHON_SRC_ROOT)/Python/modsupport.c \ $(MY_PYTHON_SRC_ROOT)/Python/modsupport.c \
$(MY_PYTHON_SRC_ROOT)/Python/mysnprintf.c \ $(MY_PYTHON_SRC_ROOT)/Python/mysnprintf.c \
$(MY_PYTHON_SRC_ROOT)/Python/mystrtoul.c \ $(MY_PYTHON_SRC_ROOT)/Python/mystrtoul.c \
$(MY_PYTHON_SRC_ROOT)/Python/pathconfig.c \ $(MY_PYTHON_SRC_ROOT)/Python/pathconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/peephole.c \ $(MY_PYTHON_SRC_ROOT)/Python/peephole.c \
$(MY_PYTHON_SRC_ROOT)/Python/preconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyarena.c \ $(MY_PYTHON_SRC_ROOT)/Python/pyarena.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyctype.c \ $(MY_PYTHON_SRC_ROOT)/Python/pyctype.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyfpe.c \ $(MY_PYTHON_SRC_ROOT)/Python/pyfpe.c \
@ -57,17 +60,18 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Python/_warnings.c \ $(MY_PYTHON_SRC_ROOT)/Python/_warnings.c \
\ \
$(MY_PYTHON_SRC_ROOT)/Parser/acceler.c \ $(MY_PYTHON_SRC_ROOT)/Parser/acceler.c \
$(MY_PYTHON_SRC_ROOT)/Parser/bitset.c \
$(MY_PYTHON_SRC_ROOT)/Parser/firstsets.c \
$(MY_PYTHON_SRC_ROOT)/Parser/grammar.c \
$(MY_PYTHON_SRC_ROOT)/Parser/grammar1.c \ $(MY_PYTHON_SRC_ROOT)/Parser/grammar1.c \
$(MY_PYTHON_SRC_ROOT)/Parser/listnode.c \ $(MY_PYTHON_SRC_ROOT)/Parser/listnode.c \
$(MY_PYTHON_SRC_ROOT)/Parser/metagrammar.c \
$(MY_PYTHON_SRC_ROOT)/Parser/myreadline.c \ $(MY_PYTHON_SRC_ROOT)/Parser/myreadline.c \
$(MY_PYTHON_SRC_ROOT)/Parser/node.c \ $(MY_PYTHON_SRC_ROOT)/Parser/node.c \
$(MY_PYTHON_SRC_ROOT)/Parser/parser.c \ $(MY_PYTHON_SRC_ROOT)/Parser/parser.c \
$(MY_PYTHON_SRC_ROOT)/Parser/parsetok.c \ $(MY_PYTHON_SRC_ROOT)/Parser/parsetok.c \
$(MY_PYTHON_SRC_ROOT)/Parser/token.c \
$(MY_PYTHON_SRC_ROOT)/Parser/tokenizer.c \ $(MY_PYTHON_SRC_ROOT)/Parser/tokenizer.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/parse.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/parse_string.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/peg_api.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/pegen.c \
\ \
$(MY_PYTHON_SRC_ROOT)/Objects/abstract.c \ $(MY_PYTHON_SRC_ROOT)/Objects/abstract.c \
$(MY_PYTHON_SRC_ROOT)/Objects/accu.c \ $(MY_PYTHON_SRC_ROOT)/Objects/accu.c \
@ -90,6 +94,8 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Objects/frameobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/frameobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/funcobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/funcobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/genobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/genobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/genericaliasobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/interpreteridobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/iterobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/iterobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/listobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/listobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/longobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/longobject.c \
@ -100,6 +106,7 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Objects/object.c \ $(MY_PYTHON_SRC_ROOT)/Objects/object.c \
$(MY_PYTHON_SRC_ROOT)/Objects/obmalloc.c \ $(MY_PYTHON_SRC_ROOT)/Objects/obmalloc.c \
$(MY_PYTHON_SRC_ROOT)/Objects/odictobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/odictobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/picklebufobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/rangeobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/rangeobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/setobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/setobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/sliceobject.c \ $(MY_PYTHON_SRC_ROOT)/Objects/sliceobject.c \
@ -131,10 +138,8 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/gcmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/gcmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/getbuildinfo.c \ $(MY_PYTHON_SRC_ROOT)/Modules/getbuildinfo.c \
$(MY_PYTHON_SRC_ROOT)/Modules/getpath.c \ $(MY_PYTHON_SRC_ROOT)/Modules/getpath.c \
$(MY_PYTHON_SRC_ROOT)/Modules/hashtable.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_heapqmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_heapqmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/itertoolsmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/itertoolsmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_json.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_localemodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_localemodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_lsprof.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_lsprof.c \
$(MY_PYTHON_SRC_ROOT)/Modules/main.c \ $(MY_PYTHON_SRC_ROOT)/Modules/main.c \
@ -146,7 +151,7 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_operator.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_operator.c \
$(MY_PYTHON_SRC_ROOT)/Modules/ossaudiodev.c \ $(MY_PYTHON_SRC_ROOT)/Modules/ossaudiodev.c \
$(MY_PYTHON_SRC_ROOT)/Modules/parsermodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/parsermodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_peg_parser.c \
$(MY_PYTHON_SRC_ROOT)/Modules/posixmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/posixmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_posixsubprocess.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_posixsubprocess.c \
$(MY_PYTHON_SRC_ROOT)/Modules/pwdmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/pwdmodule.c \
@ -162,6 +167,7 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/socketmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/socketmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_sre.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_sre.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_stat.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_stat.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_statisticsmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_struct.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_struct.c \
$(MY_PYTHON_SRC_ROOT)/Modules/symtablemodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/symtablemodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/termios.c \ $(MY_PYTHON_SRC_ROOT)/Modules/termios.c \
@ -175,9 +181,10 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_weakref.c \ $(MY_PYTHON_SRC_ROOT)/Modules/_weakref.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxlimited.c \ $(MY_PYTHON_SRC_ROOT)/Modules/xxlimited.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/xxmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_xxsubinterpretersmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxsubtype.c \ $(MY_PYTHON_SRC_ROOT)/Modules/xxsubtype.c \
$(MY_PYTHON_SRC_ROOT)/Modules/zipimport.c \
$(MY_PYTHON_SRC_ROOT)/Modules/zlibmodule.c \ $(MY_PYTHON_SRC_ROOT)/Modules/zlibmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_zoneinfo.c \
$(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_cn.c \ $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_cn.c \
$(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_hk.c \ $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_hk.c \
$(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_iso2022.c \ $(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_iso2022.c \

View file

@ -26,7 +26,7 @@ extern PyObject* PyInit__thread(void);
extern PyObject* PyInit__codecs(void); extern PyObject* PyInit__codecs(void);
extern PyObject* PyInit__weakref(void); extern PyObject* PyInit__weakref(void);
extern PyObject* PyInit_xxsubtype(void); extern PyObject* PyInit_xxsubtype(void);
extern PyObject* PyInit_zipimport(void); extern PyObject* PyInit__xxsubinterpreters(void);
extern PyObject* PyInit__random(void); extern PyObject* PyInit__random(void);
extern PyObject* PyInit_itertools(void); extern PyObject* PyInit_itertools(void);
extern PyObject* PyInit__collections(void); extern PyObject* PyInit__collections(void);
@ -40,7 +40,6 @@ extern PyObject* PyInit_parser(void);
extern PyObject* PyInit__struct(void); extern PyObject* PyInit__struct(void);
extern PyObject* PyInit__datetime(void); extern PyObject* PyInit__datetime(void);
extern PyObject* PyInit__functools(void); extern PyObject* PyInit__functools(void);
extern PyObject* PyInit__json(void);
extern PyObject* PyInit_zlib(void); extern PyObject* PyInit_zlib(void);
extern PyObject* PyInit__multibytecodec(void); extern PyObject* PyInit__multibytecodec(void);
extern PyObject* PyInit__codecs_cn(void); extern PyObject* PyInit__codecs_cn(void);
@ -53,7 +52,6 @@ extern PyObject* PyInit__winapi(void);
extern PyObject* PyInit__lsprof(void); extern PyObject* PyInit__lsprof(void);
extern PyObject* PyInit__ast(void); extern PyObject* PyInit__ast(void);
extern PyObject* PyInit__io(void); extern PyObject* PyInit__io(void);
extern PyObject* PyInit__pickle(void);
extern PyObject* PyInit_atexit(void); extern PyObject* PyInit_atexit(void);
extern PyObject* _PyWarnings_Init(void); extern PyObject* _PyWarnings_Init(void);
extern PyObject* PyInit__string(void); extern PyObject* PyInit__string(void);
@ -103,10 +101,9 @@ struct _inittab _PyImport_Inittab[] = {
{"_struct", PyInit__struct}, {"_struct", PyInit__struct},
{"_datetime", PyInit__datetime}, {"_datetime", PyInit__datetime},
{"_functools", PyInit__functools}, {"_functools", PyInit__functools},
{"_json", PyInit__json},
{"xxsubtype", PyInit_xxsubtype}, {"xxsubtype", PyInit_xxsubtype},
{"zipimport", PyInit_zipimport}, {"_xxsubinterpreters", PyInit__xxsubinterpreters},
{"zlib", PyInit_zlib}, {"zlib", PyInit_zlib},
/* CJK codecs */ /* CJK codecs */
@ -131,7 +128,6 @@ struct _inittab _PyImport_Inittab[] = {
{"_string", PyInit__string}, {"_string", PyInit__string},
{"_io", PyInit__io}, {"_io", PyInit__io},
{"_pickle", PyInit__pickle},
{"atexit", PyInit_atexit}, {"atexit", PyInit_atexit},
{"_stat", PyInit__stat}, {"_stat", PyInit__stat},
{"_opcode", PyInit__opcode}, {"_opcode", PyInit__opcode},

View file

@ -9,7 +9,7 @@
#define PYTHON3_STDLIB_REL_PATH "stdlib.zip" #define PYTHON3_STDLIB_REL_PATH "stdlib.zip"
#define PYTHON3_MODULES_REL_PATH "modules" #define PYTHON3_MODULES_REL_PATH "modules"
#define PYTHON3_DLL_REL_PATH "libpython3.7m.so" #define PYTHON3_DLL_REL_PATH "libpython3.9.so"
#define SYS_PATH_BUFFER_SIZE (2*(PATH_MAX + 1)) #define SYS_PATH_BUFFER_SIZE (2*(PATH_MAX + 1))

View file

@ -0,0 +1,93 @@
--- a/Modules/expat/xmlparse.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Modules/expat/xmlparse.c 2021-08-20 10:19:38.946990574 +0100
@@ -89,6 +89,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) && ! defined(_WIN32)
diff --git a/Modules/getpath.c b/Modules/getpath.c
--- a/Modules/getpath.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Modules/getpath.c 2021-08-20 10:29:27.000481395 +0100
@@ -103,10 +103,39 @@
extern "C" {
#endif
+/*
+ These variables were set this way in older versions of Python, but
+ changed from 3.5.1 to 3.5.2.
+ https://github.com/python/cpython/commit/f5854148138280c69fdc9d350636dc2140d57753
+ Here we just 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 macros must be defined"
+/*
+ * #if (!defined(PREFIX) || !defined(EXEC_PREFIX) \
+ * || !defined(VERSION) || !defined(VPATH))
+ * #error "PREFIX, EXEC_PREFIX, VERSION and VPATH macros must be 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\

View file

@ -0,0 +1,11 @@
--- a/Python/initconfig.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Python/initconfig.c 2021-08-20 12:03:57.319576456 +0100
@@ -25,7 +25,7 @@
#endif
#ifndef PLATLIBDIR
-# error "PLATLIBDIR macro must be defined"
+# define PLATLIBDIR "/usr/lib"
#endif

View file

@ -0,0 +1,42 @@
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 97973bc..053c231 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -67,6 +67,13 @@ if os.name == "nt":
return fname
return None
+# This patch overrides the find_library to look in the right places on
+# Android
+if True:
+ from android._ctypes_library_finder import find_library as _find_lib
+ def find_library(name):
+ return _find_lib(name)
+
elif os.name == "posix" and sys.platform == "darwin":
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
diff --git a/configure b/configure
index 0914e24..dd00812 100755
--- a/configure
+++ b/configure
@@ -18673,4 +18673,3 @@ if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
echo "" >&6
echo "" >&6
fi
-
diff --git a/setup.py b/setup.py
index 20d7f35..af15cc2 100644
--- a/setup.py
+++ b/setup.py
@@ -1501,7 +1501,9 @@ class PyBuildExt(build_ext):
if zlib_inc is not None:
zlib_h = zlib_inc[0] + '/zlib.h'
version = '"0.0.0"'
- version_req = '"1.1.3"'
+ # version_req = '"1.1.3"'
+ version_req = '"{}"'.format(
+ os.environ.get('ZLIB_VERSION', '1.1.3'))
if MACOS and is_macosx_sdk_path(zlib_h):
zlib_h = os.path.join(macosx_sdk_root(), zlib_h[1:])
with open(zlib_h) as fp:

View file

@ -0,0 +1,15 @@
This patch removes --fix-cortex-a8 from the linker flags in order to support linking
with lld, as lld does not support this flag (https://github.com/android-ndk/ndk/issues/766).
diff --git a/configure b/configure
index 0914e24..7517168 100755
--- a/configure
+++ b/configure
@@ -5642,7 +5642,7 @@ $as_echo_n "checking for the Android arm ABI... " >&6; }
$as_echo "$_arm_arch" >&6; }
if test "$_arm_arch" = 7; then
BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
- LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
+ LDFLAGS="${LDFLAGS} -march=armv7-a"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5

View file

@ -0,0 +1,13 @@
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py
--- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700
+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700
@@ -487,7 +487,8 @@
if key == 'include-system-site-packages':
system_site = value.lower()
elif key == 'home':
- sys._home = value
+ # this is breaking pyconfig.h path detection with venv
+ print('Ignoring "sys._home = value" override')
sys.prefix = sys.exec_prefix = site_prefix

View file

@ -0,0 +1,13 @@
# DP: Build getbuildinfo.o with DATE/TIME values when defined
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -785,6 +785,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
-DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
-DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
+ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \
+ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \
-o $@ $(srcdir)/Modules/getbuildinfo.c
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile

View file

@ -0,0 +1,10 @@
--- a/Python/strdup.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Python/strdup.c 2021-08-20 09:26:36.443055850 +0100
@@ -1,5 +1,7 @@
/* strdup() replacement (from stdwin, if you must know) */
+#include "Python.h"
+
char *
strdup(const char *str)
{

View file

@ -2,7 +2,7 @@ from pythonforandroid.recipe import PythonRecipe
class SetuptoolsRecipe(PythonRecipe): class SetuptoolsRecipe(PythonRecipe):
version = '40.0.0' version = '51.0.0'
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip' url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip'
depends = [('python2', 'python3crystax')] depends = [('python2', 'python3crystax')]

View file

@ -1,10 +0,0 @@
from pythonforandroid.recipe import PythonRecipe
class SixRecipe(PythonRecipe):
version = '1.9.0'
url = 'https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz'
depends = [('python2', 'python3crystax')]
recipe = SixRecipe()

View file

@ -1,11 +1,16 @@
LOCAL_PATH := $(call my-dir)/.. TOP_PATH := $(call my-dir)/..
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_PATH := $(TOP_PATH)
LOCAL_SRC_FILES := sqlite3.c LOCAL_SRC_FILES := sqlite3.c
LOCAL_MODULE := sqlite3_static
LOCAL_MODULE := sqlite3 LOCAL_MODULE_FILENAME := libsqlite3
LOCAL_CFLAGS := \
LOCAL_CFLAGS := -DSQLITE_ENABLE_FTS4 -DSQLITE_BYTEORDER=1234 \
-DSQLITE_DIRECT_OVERFLOW_READ \
include $(BUILD_SHARED_LIBRARY) -DSQLITE_ENABLE_ATOMIC_WRITE \
-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS5 \
-D_FILE_OFFSET_BITS=64
include $(BUILD_STATIC_LIBRARY)

View file

@ -4,31 +4,35 @@ from os.path import join, exists
import sh import sh
class Sqlite3Recipe(NDKRecipe): class Sqlite3Recipe(NDKRecipe):
version = '3.24.0' version = '3.36.0'
# Don't forget to change the URL when changing the version # Don't forget to change the URL when changing the version
url = 'https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip' url = 'https://www.sqlite.org/2021/sqlite-amalgamation-3360000.zip'
generated_libraries = ['sqlite3'] generated_libraries = ['sqlite3']
def should_build(self, arch): def should_build(self, arch):
return not self.has_libs(arch, 'libsqlite3.so') return not self.has_libs(arch, 'libsqlite3.a')
def prebuild_arch(self, arch): def prebuild_arch(self, arch):
super(Sqlite3Recipe, self).prebuild_arch(arch) super().prebuild_arch(arch)
# Copy the Android make file # Copy the Android make file
sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni')) sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'), shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
join(self.get_build_dir(arch.arch), 'jni/Android.mk')) join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
def build_arch(self, arch, *extra_args): def build_arch(self, arch, *extra_args):
super(Sqlite3Recipe, self).build_arch(arch) super().build_arch(arch)
# Copy the shared library # Copy the static library
shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'), # (which doesn't get placed in the libs folder for some reason so we force that to happen)
join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so')) sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'libs', arch.arch))
shutil.copyfile(join(self.get_build_dir(arch.arch), 'obj', 'local', arch.arch, 'libsqlite3.a'),
join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.a'))
shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.a'),
join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.a'))
def get_recipe_env(self, arch): def get_recipe_env(self, arch):
env = super(Sqlite3Recipe, self).get_recipe_env(arch) env = super().get_recipe_env(arch)
env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch) env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch)
return env return env
recipe = Sqlite3Recipe()
recipe = Sqlite3Recipe()

831
scripts/build-binary.mk Normal file
View file

@ -0,0 +1,831 @@
# Copyright (C) 2008, 2014, 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Check that LOCAL_MODULE is defined, then restore its LOCAL_XXXX values
$(call assert-defined,LOCAL_MODULE)
$(call module-restore-locals,$(LOCAL_MODULE))
# For now, only support target (device-specific modules).
# We may want to introduce support for host modules in the future
# but that is too experimental for now.
#
my := TARGET_
# LOCAL_MAKEFILE must also exist and name the Android.mk that
# included the module build script.
#
$(call assert-defined,LOCAL_MAKEFILE LOCAL_BUILD_SCRIPT LOCAL_BUILT_MODULE)
# A list of LOCAL_XXX variables that are ignored for static libraries.
# Print a warning if they are present inside a module definition to let
# the user know this won't do what he/she expects.
not_in_static_libs := \
LOCAL_LDFLAGS \
LOCAL_LDLIBS \
LOCAL_ALLOW_UNDEFINED_SYMBOLS
ifeq ($(call module-get-class,$(LOCAL_MODULE)),STATIC_LIBRARY)
$(foreach _notvar,$(not_in_static_libs),\
$(if $(strip $($(_notvar))),\
$(call __ndk_info,WARNING:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): $(_notvar) is always ignored for static libraries)\
)\
)
endif
# Some developers like to add library names (e.g. -lfoo) to LOCAL_LDLIBS
# and LOCAL_LDFLAGS directly. This is very fragile and can lead to broken
# builds and other nasty surprises, because it doesn't tell ndk-build
# that the corresponding module depends on these files. Emit a warning
# when we detect this case.
libs_in_ldflags := $(filter -l% %.so %.a,$(LOCAL_LDLIBS) $(LOCAL_LDFLAGS))
# Remove the system libraries we know about from the warning, it's ok
# (and actually expected) to link them with -l<name>.
system_libs := \
android \
c \
dl \
jnigraphics \
log \
m \
m_hard \
stdc++ \
z \
EGL \
GLESv1_CM \
GLESv2 \
GLESv3 \
OpenSLES \
OpenMAXAL \
mediandk \
atomic
libs_in_ldflags := $(filter-out $(addprefix -l,$(system_libs)), $(libs_in_ldflags))
ifneq (,$(strip $(libs_in_ldflags)))
$(call __ndk_info,WARNING:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): non-system libraries in linker flags: $(libs_in_ldflags))
$(call __ndk_info, This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES)
$(call __ndk_info, or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the)
$(call __ndk_info, current module)
endif
include $(BUILD_SYSTEM)/import-locals.mk
# Check for LOCAL_THIN_ARCHIVE / APP_THIN_ARCHIVE and print a warning if
# it is defined for non-static library modules.
thin_archive := $(strip $(LOCAL_THIN_ARCHIVE))
ifdef thin_archive
ifneq (STATIC_LIBRARY,$(call module-get-class,$(LOCAL_MODULE)))
$(call __ndk_info,WARNING:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_THIN_ARCHIVE is for building static libraries)
endif
endif
ifndef thin_archive
thin_archive := $(strip $(NDK_APP_THIN_ARCHIVE))
endif
# Print a warning if the value is not 'true', 'false' or empty.
ifneq (,$(filter-out true false,$(thin_archive)))
$(call __ndk_info,WARNING:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): Invalid LOCAL_THIN_ARCHIVE value '$(thin_archive)' ignored!)
thin_archive :=
endif
#
# Ensure that 'make <module>' and 'make clean-<module>' work
#
.PHONY: $(LOCAL_MODULE)
$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE)
cleantarget := clean-$(LOCAL_MODULE)-$(TARGET_ARCH_ABI)
.PHONY: $(cleantarget)
clean: $(cleantarget)
$(cleantarget): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(cleantarget): PRIVATE_MODULE := $(LOCAL_MODULE)
ifneq ($(LOCAL_BUILT_MODULE_NOT_COPIED),true)
$(cleantarget): PRIVATE_CLEAN_FILES := $(LOCAL_BUILT_MODULE) \
$($(my)OBJS)
else
$(cleantarget): PRIVATE_CLEAN_FILES := $($(my)OBJS)
endif
$(cleantarget)::
$(call host-echo-build-step,$(PRIVATE_ABI),Clean) "$(PRIVATE_MODULE) [$(PRIVATE_ABI)]"
$(hide) $(call host-rmdir,$(PRIVATE_CLEAN_FILES))
ifeq ($(NDK_APP_DEBUGGABLE),true)
$(NDK_APP_GDBSETUP): PRIVATE_SRC_DIRS += $(LOCAL_C_INCLUDES) $(LOCAL_PATH)
endif
# list of generated object files
LOCAL_OBJECTS :=
# list of generated object files from RS files, subset of LOCAL_OBJECTS
LOCAL_RS_OBJECTS :=
# always define ANDROID when building binaries
#
LOCAL_CFLAGS := -DANDROID $(LOCAL_CFLAGS)
#
# Add the default system shared libraries to the build
#
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
LOCAL_SHARED_LIBRARIES += $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
else
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
#
# Check LOCAL_CPP_EXTENSION
#
bad_cpp_extensions := $(strip $(filter-out .%,$(LOCAL_CPP_EXTENSION)))
ifdef bad_cpp_extensions
$(call __ndk_info,WARNING: Invalid LOCAL_CPP_EXTENSION values: $(bad_cpp_extensions))
LOCAL_CPP_EXTENSION := $(filter $(bad_cpp_extensions),$(LOCAL_CPP_EXTENSIONS))
endif
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
ifeq ($(LOCAL_CPP_EXTENSION),)
# Match the default GCC C++ extensions.
LOCAL_CPP_EXTENSION := $(default-c++-extensions)
endif
LOCAL_RS_EXTENSION := $(default-rs-extensions)
#
# Check LOCAL_OBJC_EXTENSION, use '.m' by default
#
bad_objc_extensions := $(strip $(filter-out .%,$(LOCAL_OBJC_EXTENSION)))
ifdef bad_objc_extensions
$(call __ndk_info,WARNING: Invalid LOCAL_OBJC_EXTENSION values: $(bad_objc_extensions))
LOCAL_OBJC_EXTENSION := $(filter $(bad_objc_extensions),$(LOCAL_OBJC_EXTENSION))
endif
LOCAL_OBJC_EXTENSION := $(strip $(LOCAL_OBJC_EXTENSION))
ifeq ($(LOCAL_OBJC_EXTENSION),)
LOCAL_OBJC_EXTENSION := .m
endif
#
# Check LOCAL_OBJCPP_EXTENSION, use '.mm' by default
#
bad_objcpp_extensions := $(strip $(filter-out .%,$(LOCAL_OBJCPP_EXTENSION)))
ifdef bad_objcpp_extensions
$(call __ndk_info,WARNING: Invalid LOCAL_OBJCPP_EXTENSION values: $(bad_objcpp_extensions))
LOCAL_OBJCPP_EXTENSION := $(filter $(bad_objcpp_extensions),$(LOCAL_OBJCPP_EXTENSION))
endif
LOCAL_OBJCPP_EXTENSION := $(strip $(LOCAL_OBJCPP_EXTENSION))
ifeq ($(LOCAL_OBJCPP_EXTENSION),)
LOCAL_OBJCPP_EXTENSION := .mm
endif
#
# If LOCAL_ALLOW_UNDEFINED_SYMBOLS is not true, the linker will allow the generation
# of a binary that uses undefined symbols.
#
ifneq ($(LOCAL_ALLOW_UNDEFINED_SYMBOLS),true)
LOCAL_LDFLAGS += $($(my)NO_UNDEFINED_LDFLAGS)
endif
# Toolchain by default disallows generated code running from the heap and stack.
# If LOCAL_DISABLE_NO_EXECUTE is true, we allow that
#
ifeq ($(LOCAL_DISABLE_NO_EXECUTE),true)
LOCAL_CFLAGS += $($(my)DISABLE_NO_EXECUTE_CFLAGS)
LOCAL_LDFLAGS += $($(my)DISABLE_NO_EXECUTE_LDFLAGS)
else
LOCAL_CFLAGS += $($(my)NO_EXECUTE_CFLAGS)
LOCAL_LDFLAGS += $($(my)NO_EXECUTE_LDFLAGS)
endif
# Toolchain by default provides relro and GOT protections.
# If LOCAL_DISABLE_RELRO is true, we disable the protections.
#
ifeq ($(LOCAL_DISABLE_RELRO),true)
LOCAL_LDFLAGS += $($(my)DISABLE_RELRO_LDFLAGS)
else
LOCAL_LDFLAGS += $($(my)RELRO_LDFLAGS)
endif
# By default, we protect against format string vulnerabilities
# If LOCAL_DISABLE_FORMAT_STRING_CHECKS is true, we disable the protections.
ifeq ($(LOCAL_DISABLE_FORMAT_STRING_CHECKS),true)
LOCAL_CFLAGS += $($(my)DISABLE_FORMAT_STRING_CFLAGS)
else
LOCAL_CFLAGS += $($(my)FORMAT_STRING_CFLAGS)
endif
# enable PIE for executable beyond certain API level, unless "-static"
ifneq (,$(filter true,$(NDK_APP_PIE) $(TARGET_PIE)))
ifeq ($(call module-get-class,$(LOCAL_MODULE)),EXECUTABLE)
ifeq (,$(filter -static,$(TARGET_LDFLAGS) $(LOCAL_LDFLAGS) $(NDK_APP_LDFLAGS)))
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
endif
endif
endif
#
# The original Android build system allows you to use the .arm prefix
# to a source file name to indicate that it should be defined in either
# 'thumb' or 'arm' mode, depending on the value of LOCAL_ARM_MODE
#
# First, check LOCAL_ARM_MODE, it should be empty, 'thumb' or 'arm'
# We make the default 'thumb'
#
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
ifdef LOCAL_ARM_MODE
ifneq ($(words $(LOCAL_ARM_MODE)),1)
$(call __ndk_info, LOCAL_ARM_MODE in $(LOCAL_MAKEFILE) must be one word, not '$(LOCAL_ARM_MODE)')
$(call __ndk_error, Aborting)
endif
# check that LOCAL_ARM_MODE is defined to either 'arm' or 'thumb'
$(if $(filter-out thumb arm, $(LOCAL_ARM_MODE)),\
$(call __ndk_info, LOCAL_ARM_MODE must be defined to either 'arm' or 'thumb' in $(LOCAL_MAKEFILE) not '$(LOCAL_ARM_MODE)')\
$(call __ndk_error, Aborting)\
)
endif
# As a special case, the original Android build system
# allows one to specify that certain source files can be
# forced to build in ARM mode by using a '.arm' suffix
# after the extension, e.g.
#
# LOCAL_SRC_FILES := foo.c.arm
#
# to build source file $(LOCAL_PATH)/foo.c as ARM
#
$(call clear-all-src-tags)
# As a special extension, the NDK also supports the .neon extension suffix
# to indicate that a single file can be compiled with ARM NEON support
# We must support both foo.c.neon and foo.c.arm.neon here
#
# Also, if LOCAL_ARM_NEON is set to 'true', force Neon mode for all source
# files
#
neon_sources := $(filter %.neon,$(LOCAL_SRC_FILES))
neon_sources := $(neon_sources:%.neon=%)
LOCAL_ARM_NEON := $(strip $(LOCAL_ARM_NEON))
ifdef LOCAL_ARM_NEON
$(if $(filter-out true false,$(LOCAL_ARM_NEON)),\
$(call __ndk_info,LOCAL_ARM_NEON must be defined either to 'true' or 'false' in $(LOCAL_MAKEFILE), not '$(LOCAL_ARM_NEON)')\
$(call __ndk_error,Aborting) \
)
endif
ifeq ($(LOCAL_ARM_NEON),true)
neon_sources += $(LOCAL_SRC_FILES:%.neon=%)
# tag the precompiled header with 'neon' tag if it exists
ifneq (,$(LOCAL_PCH))
$(call tag-src-files,$(LOCAL_PCH),neon)
endif
endif
neon_sources := $(strip $(neon_sources))
ifdef neon_sources
ifeq ($(filter $(TARGET_ARCH_ABI), armeabi-v7a armeabi-v7a-hard arm64-v8a x86 x86_64),)
$(call __ndk_info,NEON support is only possible for armeabi-v7a ABI, its variant armeabi-v7a-hard, and arm64-v8a, x86 and x86_64 ABIs)
$(call __ndk_info,Please add checks against TARGET_ARCH_ABI in $(LOCAL_MAKEFILE))
$(call __ndk_error,Aborting)
endif
$(call tag-src-files,$(neon_sources:%.arm=%),neon)
endif
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.neon=%)
# strip the .arm suffix from LOCAL_SRC_FILES
# and tag the relevant sources with the 'arm' tag
#
arm_sources := $(filter %.arm,$(LOCAL_SRC_FILES))
arm_sources := $(arm_sources:%.arm=%)
thumb_sources := $(filter-out %.arm,$(LOCAL_SRC_FILES))
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.arm=%)
ifeq ($(LOCAL_ARM_MODE),arm)
arm_sources := $(LOCAL_SRC_FILES)
# tag the precompiled header with 'arm' tag if it exists
ifneq (,$(LOCAL_PCH))
$(call tag-src-files,$(LOCAL_PCH),arm)
endif
else
# For arm, all sources are compiled in thumb mode by default in release mode.
# Linker should behave similarly
ifneq ($(filter armeabi%, $(TARGET_ARCH_ABI)),)
ifneq ($(APP_OPTIM),debug)
LOCAL_LDFLAGS += -mthumb
endif
endif
endif
ifeq ($(LOCAL_ARM_MODE),thumb)
arm_sources := $(empty)
endif
$(call tag-src-files,$(arm_sources),arm)
# tag debug if APP_OPTIM is 'debug'
#
ifeq ($(APP_OPTIM),debug)
$(call tag-src-files,$(LOCAL_SRC_FILES),debug)
ifneq (,$(LOCAL_PCH))
$(call tag-src-files,$(LOCAL_PCH),debug)
endif
endif
# add PCH to LOCAL_SRC_FILES so that TARGET-process-src-files-tags could process it
ifneq (,$(LOCAL_PCH))
LOCAL_SRC_FILES += $(LOCAL_PCH)
endif
# Process all source file tags to determine toolchain-specific
# target compiler flags, and text.
#
$(call TARGET-process-src-files-tags)
# now remove PCH from LOCAL_SRC_FILES to prevent getting NDK warning about
# unsupported source file extensions
ifneq (,$(LOCAL_PCH))
LOCAL_SRC_FILES := $(filter-out $(LOCAL_PCH),$(LOCAL_SRC_FILES))
endif
# only call dump-src-file-tags during debugging
#$(dump-src-file-tags)
LOCAL_DEPENDENCY_DIRS :=
# all_source_patterns contains the list of filename patterns that correspond
# to source files recognized by our build system
ifneq ($(filter x86 x86_64, $(TARGET_ARCH_ABI)),)
all_source_extensions := .c .s .S .asm $(LOCAL_CPP_EXTENSION) $(LOCAL_RS_EXTENSION) $(LOCAL_OBJC_EXTENSION) $(LOCAL_OBJCPP_EXTENSION)
else
all_source_extensions := .c .s .S $(LOCAL_CPP_EXTENSION) $(LOCAL_RS_EXTENSION) $(LOCAL_OBJC_EXTENSION) $(LOCAL_OBJCPP_EXTENSION)
endif
all_source_patterns := $(foreach _ext,$(all_source_extensions),%$(_ext))
all_cpp_patterns := $(foreach _ext,$(LOCAL_CPP_EXTENSION),%$(_ext))
all_rs_patterns := $(foreach _ext,$(LOCAL_RS_EXTENSION),%$(_ext))
all_objc_patterns := $(foreach _ext,$(LOCAL_OBJC_EXTENSION),%$(_ext))
all_objcpp_patterns := $(foreach _ext,$(LOCAL_OBJCPP_EXTENSION),%$(_ext))
unknown_sources := $(strip $(filter-out $(all_source_patterns),$(LOCAL_SRC_FILES)))
ifdef unknown_sources
$(call __ndk_info,WARNING: Unsupported source file extensions in $(LOCAL_MAKEFILE) for module $(LOCAL_MODULE))
$(call __ndk_info, $(unknown_sources))
endif
# LOCAL_OBJECTS will list all object files corresponding to the sources
# listed in LOCAL_SRC_FILES, in the *same* order.
#
LOCAL_OBJECTS := $(LOCAL_SRC_FILES)
$(foreach _ext,$(all_source_extensions),\
$(eval LOCAL_OBJECTS := $$(LOCAL_OBJECTS:%$(_ext)=%$$(TARGET_OBJ_EXTENSION)))\
)
LOCAL_OBJECTS := $(filter %$(TARGET_OBJ_EXTENSION),$(LOCAL_OBJECTS))
LOCAL_OBJECTS := $(subst ../,__/,$(LOCAL_OBJECTS))
LOCAL_OBJECTS := $(subst :,_,$(LOCAL_OBJECTS))
LOCAL_OBJECTS := $(foreach _obj,$(LOCAL_OBJECTS),$(LOCAL_OBJS_DIR)/$(_obj))
LOCAL_RS_OBJECTS := $(filter $(all_rs_patterns),$(LOCAL_SRC_FILES))
$(foreach _ext,$(LOCAL_RS_EXTENSION),\
$(eval LOCAL_RS_OBJECTS := $$(LOCAL_RS_OBJECTS:%$(_ext)=%$$(TARGET_OBJ_EXTENSION)))\
)
LOCAL_RS_OBJECTS := $(filter %$(TARGET_OBJ_EXTENSION),$(LOCAL_RS_OBJECTS))
LOCAL_RS_OBJECTS := $(subst ../,__/,$(LOCAL_RS_OBJECTS))
LOCAL_RS_OBJECTS := $(subst :,_,$(LOCAL_RS_OBJECTS))
LOCAL_RS_OBJECTS := $(foreach _obj,$(LOCAL_RS_OBJECTS),$(LOCAL_OBJS_DIR)/$(_obj))
ifneq (,$(call module-has-objc-sources,$(LOCAL_MODULE)))
objc_cflags :=
objc_ldflags :=
#objc_cflags += objc-exception
ifneq (,$(filter clang%,$(NDK_TOOLCHAIN_VERSION)))
objc_cflags += objc-arc
objc_ldflags += objc-arc
endif
$(foreach __f,$(objc_cflags),\
$(eval LOCAL_OBJCFLAGS += $(if $(filter -f$(__f) -fno-$(__f),$(foreach __t,TARGET LOCAL NDK_APP,$(foreach __l,C OBJC,$($(__t)_$(__l)FLAGS)))),,-f$(__f)))\
)
$(foreach __f,$(objc_ldflags),\
$(eval LOCAL_LDFLAGS += $(if $(filter -f$(__f) -fno-$(__f),$(foreach __t,TARGET LOCAL NDK_APP,$($(__t)_LDFLAGS))),,-f$(__f)))\
)
endif
# If the module has any kind of C++ features, enable them in LOCAL_CPPFLAGS
#
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti))
LOCAL_CPPFLAGS += -frtti
endif
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),exceptions))
LOCAL_CPPFLAGS += -fexceptions
endif
ifeq ($(filter -std=%,$(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS)),)
ifneq ($(TARGET_CXX_STANDARD),)
LOCAL_CPPFLAGS += -std=$(TARGET_CXX_STANDARD)
endif
endif
# If we're using the 'system' STL and use rtti or exceptions, then
# automatically link against the GNU libsupc++ for now.
#
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti exceptions))
ifeq (system,$(NDK_APP_STL))
LOCAL_LDLIBS := $(LOCAL_LDLIBS) $(call host-path,$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
endif
endif
# Set include patch for renderscript
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
else
LOCAL_RENDERSCRIPT_INCLUDES := \
$(RENDERSCRIPT_TOOLCHAIN_HEADER) \
$(TARGET_C_INCLUDES)/rs/scriptc \
$(LOCAL_RENDERSCRIPT_INCLUDES)
endif
RS_COMPAT :=
ifneq ($(call module-is-shared-library,$(LOCAL_MODULE)),)
RS_COMPAT := true
endif
# Build PCH
get-pch-name = $(strip \
$(subst ../,__/,\
$(eval __pch := $1)\
$(eval __pch := $(__pch:%.h=%.precompiled.h))\
$(__pch)\
))
ifneq (,$(LOCAL_PCH))
# Build PCH into obj directory
LOCAL_BUILT_PCH := $(call get-pch-name,$(LOCAL_PCH))
# Build PCH
$(call compile-cpp-source,$(LOCAL_PCH),$(LOCAL_BUILT_PCH).gch)
# All obj files are dependent on the PCH
$(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
$(eval $(LOCAL_OBJS_DIR)/$(call get-object-name,$(src)) : $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH).gch)\
)
# Files from now on build with PCH
LOCAL_CPPFLAGS += -Winvalid-pch -include $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH)
# Insert PCH dir at beginning of include search path
LOCAL_C_INCLUDES := \
$(LOCAL_OBJS_DIR) \
$(LOCAL_C_INCLUDES)
endif
# Build the sources to object files
#
$(foreach src,$(filter %.c,$(LOCAL_SRC_FILES)), $(call compile-c-source,$(src),$(call get-object-name,$(src))))
$(foreach src,$(filter %.S %.s,$(LOCAL_SRC_FILES)), $(call compile-s-source,$(src),$(call get-object-name,$(src))))
$(foreach src,$(filter $(all_objc_patterns),$(LOCAL_SRC_FILES)),\
$(call compile-objc-source,$(src),$(call get-object-name,$(src)))\
)
$(foreach src,$(filter $(all_objcpp_patterns),$(LOCAL_SRC_FILES)),\
$(call compile-objc++-source,$(src),$(call get-object-name,$(src)))\
)
$(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
$(call compile-cpp-source,$(src),$(call get-object-name,$(src)))\
)
$(foreach src,$(filter $(all_rs_patterns),$(LOCAL_SRC_FILES)),\
$(call compile-rs-source,$(src),$(call get-rs-scriptc-name,$(src)),$(call get-rs-bc-name,$(src)),$(call get-rs-so-name,$(src)),$(call get-object-name,$(src)),$(RS_COMPAT))\
)
ifneq ($(filter x86 x86_64, $(TARGET_ARCH_ABI)),)
$(foreach src,$(filter %.asm,$(LOCAL_SRC_FILES)), $(call compile-asm-source,$(src),$(call get-object-name,$(src))))
endif
#
# The compile-xxx-source calls updated LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS
#
ALL_DEPENDENCY_DIRS += $(sort $(LOCAL_DEPENDENCY_DIRS))
CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)
#
# Handle the static and shared libraries this module depends on
#
# If LOCAL_LDLIBS contains anything like -l<library> then
# prepend a -L$(SYSROOT_LINK)/usr/lib to it to ensure that the linker
# looks in the right location
#
ifneq ($(filter -l%,$(LOCAL_LDLIBS)),)
LOCAL_LDLIBS := -L$(call host-path,$(SYSROOT_LINK)/usr/lib) $(LOCAL_LDLIBS)
ifneq ($(filter x86_64 mips64,$(TARGET_ARCH_ABI)),)
LOCAL_LDLIBS := -L$(call host-path,$(SYSROOT_LINK)/usr/lib64) $(LOCAL_LDLIBS)
endif
endif
# When LOCAL_SHORT_COMMANDS is defined to 'true' we are going to write the
# list of all object files and/or static/shared libraries that appear on the
# command line to a file, then use the @<listfile> syntax to invoke it.
#
# This allows us to link or archive a huge number of stuff even on Windows
# with its puny 8192 max character limit on its command-line.
#
LOCAL_SHORT_COMMANDS := $(strip $(LOCAL_SHORT_COMMANDS))
ifndef LOCAL_SHORT_COMMANDS
LOCAL_SHORT_COMMANDS := $(strip $(NDK_APP_SHORT_COMMANDS))
endif
define libcrystax-link-type
$(strip \
$(call assert-defined,LOCAL_LDFLAGS NDK_APP_LIBCRYSTAX)\
$(if \
$(or \
$(filter -static,$(LOCAL_LDFLAGS)),\
$(filter static,$(NDK_APP_LIBCRYSTAX))\
),\
static,\
dynamic\
)\
)
endef
# $1: Target ABI
define libcrystax-libpath
$(strip \
$(eval __libcrystax_libpath := $(crystax-dir)/libs/$(1)$(if $(filter armeabi%,$(1)),/thumb))\
$(if $(wildcard $(__libcrystax_libpath)),\
$(__libcrystax_libpath),\
$(call __ndk_info,Could not find libcrystax libraries: $(call pretty-dir,$(__libcrystax_libpath)) (broken NDK?))\
$(call __ndk_error,Aborting)\
)\
)
endef
# - Ensure -lcrystax is _always_ before -lc
# - Properly detect how to link libcrystax - statically or dynamically
# - Specify path to empty libcrystax.a stub to make linker happy when it
# use -lcrystax (according to built-in linker spec)
# - Specify proper path to libcrystax binary
# - Force __crystax_on_load/__crystax_on_unload to be undefined in case of static
# libcrystax linking. This way we ensure they will not be thrown away by linker.
# - Enable 'muldefs' option when statically linking.
# This way app will use functions from libcrystax and link successfully
# even if there are symbols with the same name in subsequent static libraries (libc etc)
# - Force -Wl,--eh-frame-hdr for static executables if not yet specified
# Parameters:
# $1: List of linker '-lxxx' options to adjust
define interpose-libcrystax
$(strip \
$(call assert-defined,TARGET_ARCH_ABI LOCAL_LDFLAGS)\
$(filter-out -lc -lm,$(1)) \
$(if $(filter static,$(libcrystax-link-type)),\
-u __crystax_on_load \
-u __crystax_on_unload \
) \
$(if $(filter -static,$(LOCAL_LDFLAGS)),\
$(eval __libcrystax_muldefs := -Wl,-z,muldefs) \
$(__libcrystax_muldefs) \
) \
$(if $(filter -static,$(LOCAL_LDFLAGS)),\
$(eval __libcrystax_static_eh_frame_hdr := -Wl,--eh-frame-hdr) \
$(if $(filter $(__libcrystax_static_eh_frame_hdr),$(LOCAL_LDFLAGS)),,$(__libcrystax_static_eh_frame_hdr)) \
) \
-L$(crystax-dir)/empty \
$(call libcrystax-libpath,$(TARGET_ARCH_ABI))/libcrystax.$(if $(filter static,$(libcrystax-link-type)),a,so) \
-lc \
)
endef
$(call generate-file-dir,$(LOCAL_BUILT_MODULE))
$(LOCAL_BUILT_MODULE): PRIVATE_OBJECTS := $(LOCAL_OBJECTS)
$(LOCAL_BUILT_MODULE): PRIVATE_LIBGCC := $(TARGET_LIBGCC)
$(LOCAL_BUILT_MODULE): PRIVATE_LD := $(TARGET_LD)
$(LOCAL_BUILT_MODULE): PRIVATE_LDFLAGS := $(TARGET_LDFLAGS) $(LOCAL_LDFLAGS) $(NDK_APP_LDFLAGS)
$(LOCAL_BUILT_MODULE): PRIVATE_LDLIBS := $(call interpose-libcrystax,$(LOCAL_LDLIBS) $(TARGET_LDLIBS))
$(LOCAL_BUILT_MODULE): PRIVATE_NAME := $(notdir $(LOCAL_BUILT_MODULE))
$(LOCAL_BUILT_MODULE): PRIVATE_CXX := $(TARGET_CXX)
$(LOCAL_BUILT_MODULE): PRIVATE_CC := $(TARGET_CC)
$(LOCAL_BUILT_MODULE): PRIVATE_SYSROOT_LINK := $(SYSROOT_LINK)
ifeq ($(call module-get-class,$(LOCAL_MODULE)),STATIC_LIBRARY)
#
# This is a static library module, things are very easy. We only need
# to build the object files and archive them with 'ar'. Note that module
# dependencies can be ignored here, i.e. if the module depends on other
# static or shared libraries, there is no need to actually build them
# before, so don't add Make dependencies to them.
#
# In other words, consider the following graph:
#
# libfoo.so -> libA.a ->libB.a
#
# then libA.a and libB.a can be built in parallel, only linking libfoo.so
# depends on their completion.
#
ar_objects := $(call host-path,$(LOCAL_OBJECTS))
ifeq ($(LOCAL_SHORT_COMMANDS),true)
$(call ndk_log,Building static library module '$(LOCAL_MODULE)' with linker list file)
ar_list_file := $(LOCAL_OBJS_DIR)/archiver.list
$(call generate-list-file,$(ar_objects),$(ar_list_file))
ar_objects := @$(call host-path,$(ar_list_file))
$(LOCAL_BUILT_MODULE): $(ar_list_file)
endif
# Compute 'ar' flags. Thin archives simply require 'T' here.
ar_flags := $(TARGET_ARFLAGS)
ifeq (true,$(thin_archive))
$(call ndk_log,$(TARGET_ARCH_ABI):Building static library '$(LOCAL_MODULE)' as thin archive)
ar_flags := $(ar_flags)T
endif
$(LOCAL_BUILT_MODULE): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(LOCAL_BUILT_MODULE): PRIVATE_AR := $(TARGET_AR) $(ar_flags)
$(LOCAL_BUILT_MODULE): PRIVATE_AR_OBJECTS := $(ar_objects)
$(LOCAL_BUILT_MODULE): PRIVATE_BUILD_STATIC_LIB := $(cmd-build-static-library)
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
$(call host-echo-build-step,$(PRIVATE_ABI),StaticLibrary) "$(PRIVATE_NAME)"
# $(hide) $(call host-rm,$@)
$(hide) $(PRIVATE_BUILD_STATIC_LIB)
ALL_STATIC_LIBRARIES += $(LOCAL_BUILT_MODULE)
endif
ifneq (,$(filter SHARED_LIBRARY EXECUTABLE,$(call module-get-class,$(LOCAL_MODULE))))
#
# This is a shared library or an executable, so computing dependencies properly is
# crucial. The general rule to apply is the following:
#
# - collect the list of all static libraries that need to be part
# of the link, and in the right order. To do so, get the transitive
# closure of LOCAL_STATIC_LIBRARIES and LOCAL_WHOLE_STATIC_LIBRARIES
# and ensure they are ordered topologically.
#
# - collect the list of all shared libraries that need to be part of
# the link. This is the transitive closure of the list of
# LOCAL_SHARED_LIBRARIES for the module and all its dependent static
# libraries identified in the step above. Of course, need to be
# ordered topologically too.
#
# - add Make dependencies to ensure that all these libs are built
# before the module itself too.
#
# A few quick examples:
#
# main.exe -> libA.a -> libB.a -> libfoo.so -> libC.a
#
# static_libs(main.exe) = libA.a libB.a (i.e. no libC.a)
# shared_libs(main.exe) = libfoo.so
# static_libs(libfoo.so) = libC.a
#
# main.exe -> libA.a ---> libB.a
# | ^
# v |
# libC.a ------
#
# static_libs(main.exe) = libA.a libC.a libB.a
# (i.e. libB.a must appear after all libraries that depend on it).
#
all_libs := $(call module-get-link-libs,$(LOCAL_MODULE))
shared_libs := $(call module-filter-shared-libraries,$(all_libs))
static_libs := $(call module-filter-static-libraries,$(all_libs))
whole_static_libs := $(call module-extract-whole-static-libs,$(LOCAL_MODULE),$(static_libs))
static_libs := $(filter-out $(whole_static_libs),$(static_libs))
$(call -ndk-mod-debug,module $(LOCAL_MODULE) [$(LOCAL_BUILT_MODULE)])
$(call -ndk-mod-debug,. all_libs='$(all_libs)')
$(call -ndk-mod-debug,. shared_libs='$(shared_libs)')
$(call -ndk-mod-debug,. static_libs='$(static_libs)')
$(call -ndk-mod-debug,. whole_static_libs='$(whole_static_libs)')
shared_libs := $(call map,module-get-built,$(shared_libs))\
$(TARGET_PREBUILT_SHARED_LIBRARIES)
static_libs := $(call map,module-get-built,$(static_libs))
whole_static_libs := $(call map,module-get-built,$(whole_static_libs))
$(call -ndk-mod-debug,. built_shared_libs='$(shared_libs)')
$(call -ndk-mod-debug,. built_static_libs='$(static_libs)')
$(call -ndk-mod-debug,. built_whole_static_libs='$(whole_static_libs)')
# The list of object/static/shared libraries passed to the linker when
# building shared libraries and executables. order is important.
#
# Cannot use immediate evaluation because PRIVATE_LIBGCC may not be defined at this point.
linker_objects_and_libraries = $(strip $(call TARGET-get-linker-objects-and-libraries,\
$(LOCAL_OBJECTS), \
$(static_libs), \
$(whole_static_libs), \
$(shared_libs)))
ifeq ($(LOCAL_SHORT_COMMANDS),true)
$(call ndk_log,Building ELF binary module '$(LOCAL_MODULE)' with linker list file)
linker_options := $(linker_objects_and_libraries)
linker_list_file := $(LOCAL_OBJS_DIR)/linker.list
linker_objects_and_libraries := @$(call host-path,$(linker_list_file))
$(call generate-list-file,$(linker_options),$(linker_list_file))
$(LOCAL_BUILT_MODULE): $(linker_list_file)
endif
$(LOCAL_BUILT_MODULE): $(shared_libs) $(static_libs) $(whole_static_libs)
$(LOCAL_BUILT_MODULE): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(LOCAL_BUILT_MODULE): PRIVATE_LINKER_OBJECTS_AND_LIBRARIES := $(linker_objects_and_libraries)
$(LOCAL_BUILT_MODULE): PRIVATE_STATIC_LIBRARIES := $(static_libs)
$(LOCAL_BUILT_MODULE): PRIVATE_WHOLE_STATIC_LIBRARIES := $(whole_static_libs)
$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBRARIES := $(shared_libs)
endif
#
# If this is a shared library module
#
ifeq ($(call module-get-class,$(LOCAL_MODULE)),SHARED_LIBRARY)
$(LOCAL_BUILT_MODULE): PRIVATE_BUILD_SHARED_LIB := $(cmd-build-shared-library)
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
$(call host-echo-build-step,$(PRIVATE_ABI),SharedLibrary) "$(PRIVATE_NAME)"
$(hide) $(PRIVATE_BUILD_SHARED_LIB)
ALL_SHARED_LIBRARIES += $(LOCAL_BUILT_MODULE)
endif
#
# If this is an executable module
#
ifeq ($(call module-get-class,$(LOCAL_MODULE)),EXECUTABLE)
$(LOCAL_BUILT_MODULE): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(LOCAL_BUILT_MODULE): PRIVATE_BUILD_EXECUTABLE := $(cmd-build-executable)
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
$(call host-echo-build-step,$(PRIVATE_ABI),Executable) "$(PRIVATE_NAME)"
$(hide) $(PRIVATE_BUILD_EXECUTABLE)
ALL_EXECUTABLES += $(LOCAL_BUILT_MODULE)
endif
#
# If this is a copyable prebuilt module
#
ifeq ($(call module-is-copyable,$(LOCAL_MODULE)),$(true))
$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
$(call host-echo-build-step,$(PRIVATE_ABI),Prebuilt) "$(PRIVATE_NAME) <= $(call pretty-dir,$(dir $<))"
$(hide) $(call host-cp,$<,$@)
endif
#
# If this is an installable module
#
ifeq ($(call module-is-installable,$(LOCAL_MODULE)),$(true))
$(LOCAL_INSTALLED): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(LOCAL_INSTALLED): PRIVATE_NAME := $(notdir $(LOCAL_BUILT_MODULE))
$(LOCAL_INSTALLED): PRIVATE_SRC := $(LOCAL_BUILT_MODULE)
$(LOCAL_INSTALLED): PRIVATE_DST_DIR := $(NDK_APP_DST_DIR)
$(LOCAL_INSTALLED): PRIVATE_DST := $(LOCAL_INSTALLED)
$(LOCAL_INSTALLED): PRIVATE_STRIP := $(TARGET_STRIP)
$(LOCAL_INSTALLED): PRIVATE_STRIP_CMD := $(call cmd-strip, $(PRIVATE_DST))
$(LOCAL_INSTALLED): PRIVATE_OBJCOPY := $(TARGET_OBJCOPY)
$(LOCAL_INSTALLED): PRIVATE_OBJCOPY_CMD := $(call cmd-add-gnu-debuglink, $(PRIVATE_DST), $(PRIVATE_SRC))
LIBCRYSTAX_INSTALLED := $(subst //,/,$(call parent-dir,$(LOCAL_INSTALLED))/libcrystax.so)
$(LOCAL_INSTALLED): $(LOCAL_BUILT_MODULE) clean-installed-binaries $(if $(filter dynamic,$(libcrystax-link-type)),$(LIBCRYSTAX_INSTALLED))
$(call host-echo-build-step,$(PRIVATE_ABI),Install) "$(PRIVATE_NAME) => $(call pretty-dir,$(PRIVATE_DST))"
$(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST))
$(hide) $(PRIVATE_STRIP_CMD)
#$(hide) $(PRIVATE_OBJCOPY_CMD)
$(call generate-file-dir,$(LOCAL_INSTALLED))
ifeq (,$(GLOBAL_LIBCRYSTAX_INSTALL_RULE_DEFINED.$(TARGET_ARCH_ABI)))
$(LIBCRYSTAX_INSTALLED): PRIVATE_LIBCRYSTAX_ABI := $(TARGET_ARCH_ABI)
$(LIBCRYSTAX_INSTALLED): $(LOCAL_BUILT_MODULE) clean-installed-binaries
$(call host-echo-build-step,$(PRIVATE_LIBCRYSTAX_ABI),Install) "$(notdir $@) => $(call pretty-dir,$@)"
$(hide) $(call host-install,$(call libcrystax-libpath,$(PRIVATE_LIBCRYSTAX_ABI))/libcrystax.so,$@)
$(hide) $(call cmd-strip,$@)
$(call generate-file-dir,$(LIBCRYSTAX_INSTALLED))
GLOBAL_LIBCRYSTAX_INSTALL_RULE_DEFINED.$(TARGET_ARCH_ABI) := true
endif
endif

View file

@ -276,6 +276,9 @@ build_python_for_abi ()
armeabi-v7a-hard) armeabi-v7a-hard)
CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mhard-float" CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mhard-float"
;; ;;
arm64-v8a)
CFLAGS="-march=armv8-a"
;;
*) *)
CFLAGS="" CFLAGS=""
esac esac
@ -285,7 +288,7 @@ build_python_for_abi ()
CFLAGS="$CFLAGS -mthumb" CFLAGS="$CFLAGS -mthumb"
esac esac
local CFLAGS="$CFLAGS --sysroot=$NDK_DIR/platforms/android-$APILEVEL/arch-$ARCH" local CFLAGS="$CFLAGS -O3 -pipe --sysroot=$NDK_DIR/platforms/android-$APILEVEL/arch-$ARCH"
local LDFLAGS="" local LDFLAGS=""
if [ "$ABI" = "armeabi-v7a-hard" ]; then if [ "$ABI" = "armeabi-v7a-hard" ]; then
@ -306,11 +309,12 @@ build_python_for_abi ()
local CONFIG_SITE=$BUILDDIR_CONFIG/config.site local CONFIG_SITE=$BUILDDIR_CONFIG/config.site
{ {
echo 'ac_cv_file__dev_ptmx=no' echo 'ac_cv_file__dev_ptmx=yes'
echo 'ac_cv_file__dev_ptc=no' echo 'ac_cv_file__dev_ptc=no'
echo 'ac_cv_func_gethostbyname_r=no' echo 'ac_cv_func_gethostbyname_r=no'
if [ "$PYTHON_MAJOR_VERSION" == "3" ]; then if [ "$PYTHON_MAJOR_VERSION" == "3" ]; then
echo 'ac_cv_func_faccessat=no' echo 'ac_cv_func_faccessat=no'
echo 'ac_cv_little_endian_double=yes'
fi fi
} >$CONFIG_SITE } >$CONFIG_SITE
fail_panic "Can't create config.site wrapper" fail_panic "Can't create config.site wrapper"
@ -346,11 +350,17 @@ build_python_for_abi ()
echo " --host=$HOST \\" echo " --host=$HOST \\"
echo " --build=$BUILD_ON_PLATFORM \\" echo " --build=$BUILD_ON_PLATFORM \\"
echo " --prefix=$BUILDDIR_CONFIG/install \\" echo " --prefix=$BUILDDIR_CONFIG/install \\"
echo " --exec-prefix=/usr/local \\"
echo " --enable-loadable-sqlite-extensions \\"
echo " --enable-shared \\" echo " --enable-shared \\"
echo " --with-threads \\"
echo " --enable-ipv6 \\" echo " --enable-ipv6 \\"
echo " --enable-optimizations \\"
echo " --with-computed-gotos \\" echo " --with-computed-gotos \\"
echo " --without-ensurepip" echo " --with-lto \\"
echo " --without-ensurepip \\"
echo " ac_cv_file__dev_ptmx=yes \\"
echo " ac_cv_file__dev_ptc=no \\"
echo " ac_cv_little_endian_double=yes"
fi fi
} >$CONFIGURE_WRAPPER } >$CONFIGURE_WRAPPER
fail_panic "Can't create configure wrapper" fail_panic "Can't create configure wrapper"
@ -382,8 +392,8 @@ build_python_for_abi ()
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI" local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"
else else
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"'m' local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"
local PYTHON_SOABI='cpython-'"$PYTHON_ABI"'m' local PYTHON_SOABI='cpython-'"$PYTHON_ABI"
fi fi
{ {
echo 'LOCAL_PATH := $(call my-dir)' echo 'LOCAL_PATH := $(call my-dir)'
@ -391,6 +401,8 @@ build_python_for_abi ()
echo "LOCAL_MODULE := $PYTHON_CORE_MODULE_NAME" echo "LOCAL_MODULE := $PYTHON_CORE_MODULE_NAME"
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include' echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/cpython'
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
echo "LOCAL_CFLAGS := -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\"" echo "LOCAL_CFLAGS := -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\""
else else
@ -410,6 +422,8 @@ build_python_for_abi ()
run rm -Rf $PYTHON_DSTDIR/include run rm -Rf $PYTHON_DSTDIR/include
run mkdir -p $PYTHON_DSTDIR/include/python && \ run mkdir -p $PYTHON_DSTDIR/include/python && \
run cp -p $PYTHON_BUILD_UTILS_DIR/pyconfig.h $PYTHON_SRCDIR/Include/*.h $PYTHON_DSTDIR/include/python run cp -p $PYTHON_BUILD_UTILS_DIR/pyconfig.h $PYTHON_SRCDIR/Include/*.h $PYTHON_DSTDIR/include/python
run cp -pR $PYTHON_SRCDIR/Include/internal $PYTHON_DSTDIR/include/python/internal
run cp -pR $PYTHON_SRCDIR/Include/cpython $PYTHON_DSTDIR/include/python/cpython
fail_panic "Can't install python$PYTHON_ABI headers" fail_panic "Can't install python$PYTHON_ABI headers"
PYTHON_HEADERS_INSTALLED=yes PYTHON_HEADERS_INSTALLED=yes
export PYTHON_HEADERS_INSTALLED export PYTHON_HEADERS_INSTALLED
@ -542,9 +556,11 @@ build_python_for_abi ()
{ {
echo 'LOCAL_PATH := $(call my-dir)' echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)' echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _ctypes'
echo 'LOCAL_C_INCLUDES := $(LOCAL_PATH)/include'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_MODULE := _ctypes'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo 'LOCAL_C_INCLUDES := $(LOCAL_PATH)/include'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \' echo 'LOCAL_SRC_FILES := \'
for ffi_src in $FFI_SRC_LIST; do for ffi_src in $FFI_SRC_LIST; do
echo " \$(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/libffi/$ffi_src \\" echo " \$(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/libffi/$ffi_src \\"
@ -638,8 +654,10 @@ build_python_for_abi ()
echo 'include $(CLEAR_VARS)' echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _queue' echo 'LOCAL_MODULE := _queue'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo 'LOCAL_SRC_FILES := \' echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_queuemodule.c' echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_queuemodule.c'
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_STATIC_LIBRARIES := python_shared' echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'include $(BUILD_SHARED_LIBRARY)' echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)" echo "\$(call import-module,python/$PYTHON_ABI)"
@ -665,6 +683,8 @@ build_python_for_abi ()
echo 'include $(CLEAR_VARS)' echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _asyncio' echo 'LOCAL_MODULE := _asyncio'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \' echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_asynciomodule.c' echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_asynciomodule.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared' echo 'LOCAL_STATIC_LIBRARIES := python_shared'
@ -879,7 +899,7 @@ build_python_for_abi ()
echo 'LOCAL_MODULE := pyexpat' echo 'LOCAL_MODULE := pyexpat'
echo 'LOCAL_CFLAGS := -DHAVE_EXPAT_CONFIG_H -DXML_STATIC' echo 'LOCAL_CFLAGS := -DHAVE_EXPAT_CONFIG_H -DXML_STATIC'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo "LOCAL_C_INCLUDES := \$(MY_PYTHON_SRC_ROOT)/Modules/expat" echo 'LOCAL_C_INCLUDES := \$(MY_PYTHON_SRC_ROOT)/Modules/expat'
echo 'LOCAL_SRC_FILES := \' echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmlparse.c \' 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/xmlrole.c \'
@ -936,7 +956,9 @@ build_python_for_abi ()
echo 'LOCAL_PATH := $(call my-dir)' echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)' echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := unicodedata' echo 'LOCAL_MODULE := unicodedata'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR" echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \' echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/unicodedata.c' echo ' $(MY_PYTHON_SRC_ROOT)/Modules/unicodedata.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared' echo 'LOCAL_STATIC_LIBRARIES := python_shared'
@ -951,6 +973,64 @@ build_python_for_abi ()
log "Install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES" 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 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" fail_panic "Can't install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES"
# _json speedups
local BUILDDIR_JSON="$BUILDDIR/json"
local OBJDIR_JSON="$BUILDDIR_JSON/obj/local/$ABI"
run mkdir -p "$BUILDDIR_JSON/jni"
fail_panic "Can't create directory: $BUILDDIR_JSON/jni"
{
echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _json'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_json.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE_MODULE'
echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)"
} >$BUILDDIR_JSON/jni/Android.mk
fail_panic "Can't generate $BUILDDIR_JSON/jni/Android.mk"
run $NDK_DIR/ndk-build -C $BUILDDIR_JSON -j$NUM_JOBS APP_ABI=$ABI V=1
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_json'"
log "Install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES"
run cp -p -T $OBJDIR_JSON/lib_json.so $PYBIN_INSTALLDIR_MODULES/_json.so
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES"
# _pickle accelerator
local BUILDDIR_PICKLE="$BUILDDIR/pickle"
local OBJDIR_PICKLE="$BUILDDIR_PICKLE/obj/local/$ABI"
run mkdir -p "$BUILDDIR_PICKLE/jni"
fail_panic "Can't create directory: $BUILDDIR_PICKLE/jni"
{
echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _pickle'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE_MODULE'
echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)"
} >$BUILDDIR_PICKLE/jni/Android.mk
fail_panic "Can't generate $BUILDDIR_PICKLE/jni/Android.mk"
run $NDK_DIR/ndk-build -C $BUILDDIR_PICKLE -j$NUM_JOBS APP_ABI=$ABI V=1
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_pickle'"
log "Install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES"
run cp -p -T $OBJDIR_PICKLE/lib_pickle.so $PYBIN_INSTALLDIR_MODULES/_pickle.so
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES"
} }
if [ -n "$PACKAGE_DIR" ]; then if [ -n "$PACKAGE_DIR" ]; then
@ -1015,4 +1095,4 @@ else
log "Don't forget to cleanup: $BUILD_DIR" log "Don't forget to cleanup: $BUILD_DIR"
fi fi
log "Done!" log "Done!"

View file

@ -0,0 +1,7 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sqlite3_static
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libsqlite3.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)

BIN
signing2.pgp Normal file

Binary file not shown.

View file

@ -56,7 +56,7 @@ import org.renpy.android.ResourceManager;
*/ */
public final class LbrynetService extends PythonService { public final class LbrynetService extends PythonService {
public static final String LBRY_SDK_VERSION = "0.100.0"; public static final String LBRY_SDK_VERSION = "0.112.0";
public static final int SERVICE_NOTIFICATION_GROUP_ID = 5; public static final int SERVICE_NOTIFICATION_GROUP_ID = 5;
public static final String ACTION_STOP_SERVICE = "io.lbry.browser.ACTION_STOP_SERVICE"; public static final String ACTION_STOP_SERVICE = "io.lbry.browser.ACTION_STOP_SERVICE";
@ -143,8 +143,7 @@ public final class LbrynetService extends PythonService {
// update the notification with the context intent // update the notification with the context intent
Notification notification = buildNotification(); Notification notification = buildNotification();
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notification); notificationManager.notify(1, notification);
} }
@ -159,13 +158,13 @@ public final class LbrynetService extends PythonService {
String serviceDescription = "The LBRY service is running in the background."; String serviceDescription = "The LBRY service is running in the background.";
Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen)) Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
.setContentText(serviceDescription) .setContentText(serviceDescription)
.setGroup(GROUP_SERVICE) .setGroup(GROUP_SERVICE)
.setWhen(System.currentTimeMillis()) .setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_lbry) .setSmallIcon(R.drawable.ic_lbry)
.setOngoing(true) .setOngoing(true)
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent) .addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent)
.build(); .build();
return notification; return notification;
} }
@ -173,11 +172,10 @@ public final class LbrynetService extends PythonService {
@Override @Override
protected void doStartForeground(Bundle extras) { protected void doStartForeground(Bundle extras) {
downloadManager = new DownloadManager(this); downloadManager = new DownloadManager(this);
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel( NotificationChannel channel = new NotificationChannel(
NOTIFICATION_CHANNEL_ID, "LBRY Browser", NotificationManager.IMPORTANCE_LOW); NOTIFICATION_CHANNEL_ID, "LBRY Browser", NotificationManager.IMPORTANCE_LOW);
channel.setDescription("LBRY service notification channel"); channel.setDescription("LBRY service notification channel");
channel.setShowBadge(false); channel.setShowBadge(false);
notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel);
@ -186,11 +184,11 @@ public final class LbrynetService extends PythonService {
// Create the notification group // Create the notification group
NotificationCompat.Builder groupBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID); NotificationCompat.Builder groupBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
groupBuilder.setContentTitle("LBRY Browser") groupBuilder.setContentTitle("LBRY Browser")
.setColor(ContextCompat.getColor(this, R.color.lbryGreen)) .setColor(ContextCompat.getColor(this, R.color.lbryGreen))
.setSmallIcon(R.drawable.ic_lbry) .setSmallIcon(R.drawable.ic_lbry)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setGroup(GROUP_SERVICE) .setGroup(GROUP_SERVICE)
.setGroupSummary(true); .setGroupSummary(true);
notificationManager.notify(SERVICE_NOTIFICATION_GROUP_ID, groupBuilder.build()); notificationManager.notify(SERVICE_NOTIFICATION_GROUP_ID, groupBuilder.build());
Notification notification = buildNotification(); Notification notification = buildNotification();
@ -221,7 +219,8 @@ public final class LbrynetService extends PythonService {
JSONObject result = status.getJSONObject("result"); JSONObject result = status.getJSONObject("result");
if (result.has("startup_status")) { if (result.has("startup_status")) {
JSONObject startupStatus = result.getJSONObject("startup_status"); JSONObject startupStatus = result.getJSONObject("startup_status");
fileManagerReady = startupStatus.has("file_manager") && startupStatus.getBoolean("file_manager"); fileManagerReady = startupStatus.has("file_manager")
&& startupStatus.getBoolean("file_manager");
} }
} }
} }
@ -232,8 +231,10 @@ public final class LbrynetService extends PythonService {
params.put("page_size", 100); params.put("page_size", 100);
params.put("reverse", true); params.put("reverse", true);
params.put("sort", "added_on"); params.put("sort", "added_on");
/*params.put("status", "stopped"); /*
params.put("comparison", "ne");*/ * params.put("status", "stopped");
* params.put("comparison", "ne");
*/
String fileList = Utils.sdkCall("file_list", params); String fileList = Utils.sdkCall("file_list", params);
if (fileList != null) { if (fileList != null) {
@ -273,7 +274,8 @@ public final class LbrynetService extends PythonService {
if (fileItems != null && fileItems.length() > 0) { if (fileItems != null && fileItems.length() > 0) {
// TODO: Create Java FileItem class // TODO: Create Java FileItem class
JSONObject item = fileItems.getJSONObject(0); JSONObject item = fileItems.getJSONObject(0);
String downloadPath = item.isNull("download_path") ? null : item.getString("download_path"); String downloadPath = item.isNull("download_path") ? null
: item.getString("download_path");
if (downloadPath == null || downloadPath.trim().length() == 0) { if (downloadPath == null || downloadPath.trim().length() == 0) {
return; return;
} }
@ -281,7 +283,8 @@ public final class LbrynetService extends PythonService {
String claimName = item.getString("claim_name"); String claimName = item.getString("claim_name");
String uri = String.format("lbry://%s#%s", claimName, claimId); String uri = String.format("lbry://%s#%s", claimName, claimId);
if (!downloadManager.isDownloadActive(uri) && !downloadManager.isDownloadCompleted(uri)) { if (!downloadManager.isDownloadActive(uri)
&& !downloadManager.isDownloadCompleted(uri)) {
downloadManager.clearWrittenBytesForDownload(uri); downloadManager.clearWrittenBytesForDownload(uri);
File file = new File(downloadPath); File file = new File(downloadPath);
Intent intent = createDownloadEventIntent(uri, outpoint, item.toString()); Intent intent = createDownloadEventIntent(uri, outpoint, item.toString());
@ -443,7 +446,6 @@ public final class LbrynetService extends PythonService {
} }
} }
private static Intent createDownloadEventIntent(String uri, String outpoint, String fileInfo) { private static Intent createDownloadEventIntent(String uri, String outpoint, String fileInfo) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(DownloadManager.ACTION_DOWNLOAD_EVENT); intent.setAction(DownloadManager.ACTION_DOWNLOAD_EVENT);
@ -470,14 +472,15 @@ public final class LbrynetService extends PythonService {
if (intent == null) { if (intent == null) {
intent = ServiceHelper.buildIntent( intent = ServiceHelper.buildIntent(
getApplicationContext(), "", LbrynetService.class, "lbrynetservice"); getApplicationContext(), "", LbrynetService.class, "lbrynetservice");
} }
// send a broadcast indicating that the service has started // send a broadcast indicating that the service has started
Intent startedIntent = new Intent(LBRY_SDK_SERVICE_STARTED); Intent startedIntent = new Intent(LBRY_SDK_SERVICE_STARTED);
sendBroadcast(startedIntent); sendBroadcast(startedIntent);
// no need to iterate the checks repeatedly here, because this is service startup // no need to iterate the checks repeatedly here, because this is service
// startup
checkDownloads(); checkDownloads();
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
@ -496,8 +499,8 @@ public final class LbrynetService extends PythonService {
} }
Context context = getApplicationContext(); Context context = getApplicationContext();
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) context
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll(); notificationManager.cancelAll();
super.onDestroy(); super.onDestroy();
@ -550,7 +553,7 @@ public final class LbrynetService extends PythonService {
// If the disk data is out of date, extract it and write the // If the disk data is out of date, extract it and write the
// version file. // version file.
// if (! data_version.equals(disk_version)) { // if (! data_version.equals(disk_version)) {
if (! data_version.equals(disk_version)) { if (!data_version.equals(disk_version)) {
Log.v(TAG, "Extracting " + resource + " assets."); Log.v(TAG, "Extracting " + resource + " assets.");
recursiveDelete(target); recursiveDelete(target);
@ -558,7 +561,7 @@ public final class LbrynetService extends PythonService {
AssetExtract ae = new AssetExtract(getApplicationContext()); AssetExtract ae = new AssetExtract(getApplicationContext());
if (!ae.extractTar(resource + ".mp3", target.getAbsolutePath())) { if (!ae.extractTar(resource + ".mp3", target.getAbsolutePath())) {
//toastError("Could not extract " + resource + " data."); // toastError("Could not extract " + resource + " data.");
Log.e(TAG, "Could not extract " + resource + " data."); Log.e(TAG, "Could not extract " + resource + " data.");
} }

View file

@ -21,6 +21,9 @@ from lbry.conf import Config
from lbry.extras.daemon.components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT from lbry.extras.daemon.components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT
from lbry.extras.daemon.daemon import Daemon from lbry.extras.daemon.daemon import Daemon
import sqlite3
import ssl
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
@ -122,7 +125,7 @@ def start():
configure_logging(conf) configure_logging(conf)
log.info('Starting lbry sdk {}'.format(lbrynet_version)); log.info('Starting lbry sdk {}'.format(lbrynet_version));
log.info('openssl: {}, sqlite3: {}'.format(ssl.OPENSSL_VERSION, sqlite3.sqlite_version))
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.set_debug(lbrynet_android_utils.isDebug()) loop.set_debug(lbrynet_android_utils.isDebug())

View file

@ -1,5 +1,5 @@
# going forward, this should match sdk version # going forward, this should match sdk version
__version__ = "0.100.0" __version__ = "0.112.0"
class ServiceApp(App): class ServiceApp(App):
def build(self): def build(self):