Compare commits

...

6 commits

Author SHA1 Message Date
zeppi
3278bf8bdb try self-hosted 2022-12-09 15:28:54 -05:00
zeppi
0dd5a17fb3 service library 2022-12-09 15:25:50 -05:00
zeppi
f7af92712b oops android 2022-12-09 15:02:36 -05:00
zeppi
fc445de715 upgrade_inspect 2022-12-09 14:47:40 -05:00
zeppi
082db3a8be try sdl2 2022-12-09 14:47:05 -05:00
zeppi
a712121c3c import new p4a 2022-12-02 15:15:34 -05:00
3429 changed files with 453020 additions and 3427 deletions

View file

@ -2,11 +2,11 @@ name: Publish Assets
on:
push:
branches: [master]
branches: [master, upgrade_inspect]
jobs:
build_arm64_aar:
runs-on: ubuntu-latest
runs-on: self-hosted
container: lbry/android-base:python39
steps:
- name: checkout
@ -16,20 +16,14 @@ jobs:
cp -r /root/.buildozer ~/.buildozer/
- name: setup
run: |
apt update
apt install libssl-dev zip unzip openjdk-11-jdk -y
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
wget -q 'https://dl.google.com/android/repository/android-ndk-r25b-linux.zip' -P ~/.buildozer/android/
unzip ~/.buildozer/android/android-ndk-r25b-linux.zip -d ~/.buildozer/android/
mv buildozer.spec.arm64.ci buildozer.spec
chmod u+x ./build-release.sh
- name: build release
@ -77,6 +71,7 @@ jobs:
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/
unzip ~/
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

0
MovedRecipes/__init__.py Normal file
View file

View file

@ -1,5 +1,96 @@
from pythonforandroid.recipe import CythonRecipe, IncludedFilesBehaviour
from pythonforandroid.util import current_directory
from pythonforandroid import logger
from os.path import join
class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
# name = 'android'
version = None
url = None
src_filename = 'src'
depends = [('sdl2', 'genericndkbuild'), 'pyjnius']
config_env = {}
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
env.update(self.config_env)
return env
def prebuild_arch(self, arch):
super().prebuild_arch(arch)
ctx_bootstrap = self.ctx.bootstrap.name
# define macros for Cython, C, Python
tpxi = 'DEF {} = {}\n'
th = '#define {} {}\n'
tpy = '{} = {}\n'
# make sure bootstrap name is in unicode
if isinstance(ctx_bootstrap, bytes):
ctx_bootstrap = ctx_bootstrap.decode('utf-8')
bootstrap = bootstrap_name = ctx_bootstrap
is_lbry = bootstrap_name in ('lbry',)
is_sdl2 = (bootstrap_name == "sdl2")
if bootstrap_name in ["sdl2", "webview", "service_only", "service_library", "lbry"]:
java_ns = u'org.kivy.android'
jni_ns = u'org/kivy/android'
else:
logger.error((
'unsupported bootstrap for android recipe: {}'
''.format(bootstrap_name)
))
exit(1)
config = {
'BOOTSTRAP': bootstrap,
'IS_SDL2': int(is_sdl2),
'PY2': 0,
'JAVA_NAMESPACE': java_ns,
'JNI_NAMESPACE': jni_ns,
'ACTIVITY_CLASS_NAME': self.ctx.activity_class_name,
'ACTIVITY_CLASS_NAMESPACE': self.ctx.activity_class_name.replace('.', '/'),
'SERVICE_CLASS_NAME': self.ctx.service_class_name,
}
# create config files for Cython, C and Python
with (
current_directory(self.get_build_dir(arch.arch))), (
open(join('android', 'config.pxi'), 'w')) as fpxi, (
open(join('android', 'config.h'), 'w')) as fh, (
open(join('android', 'config.py'), 'w')) as fpy:
for key, value in config.items():
fpxi.write(tpxi.format(key, repr(value)))
fpy.write(tpy.format(key, repr(value)))
fh.write(th.format(
key,
value if isinstance(value, int) else '"{}"'.format(value)
))
self.config_env[key] = str(value)
if is_sdl2:
fh.write('JNIEnv *SDL_AndroidGetJNIEnv(void);\n')
fh.write(
'#define SDL_ANDROID_GetJNIEnv SDL_AndroidGetJNIEnv\n'
)
else:
fh.write('JNIEnv *WebView_AndroidGetJNIEnv(void);\n')
fh.write(
'#define SDL_ANDROID_GetJNIEnv WebView_AndroidGetJNIEnv\n'
)
recipe = AndroidRecipe()
'''
from pythonforandroid.recipe import CythonRecipe, IncludedFilesBehaviour
from pythonforandroid.util import current_directory
from pythonforandroid.patching import will_build
from pythonforandroid import logger
@ -75,7 +166,7 @@ class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
recipe = AndroidRecipe()
'''
'''
from pythonforandroid.recipe import CythonRecipe, Recipe, IncludedFilesBehaviour

View file

View file

@ -8,7 +8,7 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
version = '1.14.6'
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
depends = [('python2', 'python3'), 'setuptools', 'pycparser', 'libffi']
patches = ['disable-pkg-config.patch']
@ -43,16 +43,16 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
self.ctx.get_site_packages_dir(),
env['BUILDLIB_PATH'],
])
if self.ctx.ndk == 'crystax':
# only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
return env
# if self.ctx.ndk == 'crystax':
# # only keeps major.minor (discards patch)
# python_version = self.ctx.python_recipe.version[0:3]
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# return env
recipe = CffiRecipe()

View file

@ -0,0 +1,74 @@
import os
from pythonforandroid.recipe import PythonRecipe, CompiledComponentsPythonRecipe
class CoincurveRecipe(CompiledComponentsPythonRecipe):
# version = '15.0.0'
# url = 'https://github.com/ofek/coincurve/archive/{version}.tar.gz'
# call_hostpython_via_targetpython = False
# depends = ['setuptools',
# 'libffi', 'cffi', 'libsecp256k1']
# patches = [
# "cross_compile.patch", "drop_setup_requires.patch",
# "find_lib.patch", "no-download.patch", "setup.py.patch"]
#
# def get_recipe_env(self, arch=None, with_flags_in_cc=True):
# env = super().get_recipe_env(arch, with_flags_in_cc)
# # sets linker to use the correct gcc (cross compiler)
# env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
# libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx)
# libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs'))
# env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include')
# # only keeps major.minor (discards patch)
# python_version = self.ctx.python_recipe.version[0:3]
# # required additional library and path for Crystax
# if self.ctx.ndk == 'crystax':
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# else:
# env['PYTHON_ROOT'] = self.ctx.get_python_install_dir(arch.arch)
# env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version)
# env['LDFLAGS'] += " -lpython{}".format(python_version)
# env['LDFLAGS'] += " -lsecp256k1"
# return env
version = 'v15.0.1'
url = 'https://github.com/ofek/coincurve/archive/refs/tags/v15.0.1.tar.gz'
call_hostpython_via_targetpython = False
depends = [('python2', 'python3'), 'setuptools',
'libffi', 'cffi', 'libsecp256k1']
patches = [
"cross_compile.patch", "drop_setup_requires.patch",
"find_lib.patch", "no-download.patch", "setup.py.patch"]
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super().get_recipe_env(arch, with_flags_in_cc)
# sets linker to use the correct gcc (cross compiler)
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx)
libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs'))
env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include')
# only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3]
# required additional library and path for Crystax
# if self.ctx.ndk == 'crystax':
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# else:
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir(arch.arch)
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version)
env['LDFLAGS'] += " -lpython{}".format(python_version)
env['LDFLAGS'] += " -lsecp256k1"
return env
recipe = CoincurveRecipe()

View file

@ -0,0 +1,12 @@
diff --git a/setup.py b/setup.py
index c224fb2..bf925bd 100644
--- a/setup.py
+++ b/setup.py
@@ -182,6 +182,7 @@ class build_clib(_build_clib):
'--disable-dependency-tracking',
'--with-pic',
'--enable-module-recovery',
+ "--host=%s" % os.environ['TOOLCHAIN_PREFIX'],
'--disable-jni',
'--prefix',
os.path.abspath(self.build_clib),

View file

@ -0,0 +1,12 @@
diff --git a/setup.py b/setup.py
index c224fb2..466e789 100644
--- a/setup.py
+++ b/setup.py
@@ -250,7 +250,6 @@ else:
def has_c_libraries(self):
return not has_system_lib()
setup_kwargs = dict(
- setup_requires=['cffi>=1.3.0', 'pytest-runner>=2.6.2'],
ext_package='coincurve',
cffi_modules=['_cffi_build/build.py:ffi'],
cmdclass={

View file

@ -0,0 +1,13 @@
diff --git a/setup_support.py b/setup_support.py
index e7a4f2e..72f0c4d 100644
--- a/setup_support.py
+++ b/setup_support.py
@@ -68,6 +69,8 @@ def build_flags(library, type_, path):
def _find_lib():
+ # we're picking up the recipe one
+ return True
from cffi import FFI
ffi = FFI()
try:

View file

@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index c224fb2..d5f6d1a 100644
--- a/setup.py
+++ b/setup.py
@@ -51,6 +51,8 @@ if [int(i) for i in setuptools_version.split('.', 2)[:2]] < [3, 3]:
def download_library(command):
+ # we will use the custom libsecp256k1 recipe
+ return
if command.dry_run:
return
libdir = absolute('libsecp256k1')

Some files were not shown because too many files have changed in this diff Show more