Build native LXST filterlib.so and inject into APK

This commit is contained in:
Mark Qvist
2025-11-24 01:46:51 +01:00
parent 4c99029f9f
commit a911996070
3 changed files with 43 additions and 4 deletions

33
recipes/lxst/__init__.py Normal file
View File

@@ -0,0 +1,33 @@
"""
Android Bluetooth Low Energy
"""
from pythonforandroid.recipe import PythonRecipe
from pythonforandroid.toolchain import current_directory, info, shprint
import sh
from os.path import join
class LXSTRecipe(PythonRecipe):
name = 'lxst_recipe'
depends = ['python3', 'setuptools', 'android', "cffi"]
call_hostpython_via_targetpython = False
install_in_hostpython = True
def prepare_build_dir(self, arch):
build_dir = self.get_build_dir(arch)
assert build_dir.endswith(self.name)
shprint(sh.rm, '-rf', build_dir)
shprint(sh.mkdir, build_dir)
srcs = ('/home/markqvist/Information/Source/LXST/LXST', '/home/markqvist/Information/Source/LXST/setup.py', '/home/markqvist/Information/Source/LXST/README.md')
for filename in srcs:
print(f"Copy {join(self.get_recipe_dir(), filename)} to {build_dir}")
shprint(sh.cp, '-a', join(self.get_recipe_dir(), filename),
build_dir)
def postbuild_arch(self, arch):
super(LXSTRecipe, self).postbuild_arch(arch)
info("LXST native build completed")
recipe = LXSTRecipe()

View File

@@ -47,6 +47,11 @@ injectxml:
cp patches/AndroidManifest.tmpl.xml .buildozer/android/platform/build-arm64-v8a/dists/sideband/templates/
cp patches/p4a_build.py .buildozer/android/platform/build-arm64-v8a/dists/sideband/build.py
injectlibs:
@(echo Injecting native libs...)
cp .buildozer/android/platform/build-arm64-v8a/dists/sideband/_python_bundle__arm64-v8a/_python_bundle/site-packages/LXST/filterlib.so LXST/
@(sleep 1)
debug:
buildozer android debug
@@ -83,10 +88,11 @@ release:
postbuild:
$(MAKE) cleanrns
-(rm ../LXST/filterlib.so)
apk: prepare prebake pacthfiles fetchshare release postbuild
apk: prepare prebake pacthfiles fetchshare injectlibs release postbuild
devapk: prepare prebake pacthfiles fetchshare debug postbuild
devapk: prepare prebake pacthfiles fetchshare injectlibs debug postbuild
version:
@(echo $$(python ./gv.py))

View File

@@ -4,7 +4,7 @@ package.name = sideband
package.domain = io.unsigned
source.dir = .
source.include_exts = py,png,jpg,jpeg,webp,ttf,kv,pyi,typed,so,0,1,2,3,atlas,frag,html,css,js,whl,zip,gz,woff2,pdf,epub,pgm,opus
source.include_exts = py,png,jpg,jpeg,webp,ttf,kv,pyi,typed,so,0,1,2,3,atlas,frag,html,css,js,whl,zip,gz,woff2,pdf,epub,pgm,opus,h,c
source.include_patterns = assets/*,assets/fonts/*,assets/audio/notifications/*,share/*
source.exclude_patterns = app_storage/*,venv/*,Makefile,./Makefil*,requirements,precompiled/*,parked/*,./setup.py,Makef*,./Makefile,Makefile,bin/*,build/*,dist/*,__pycache__/*
@@ -12,7 +12,7 @@ version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
android.numeric_version = 20251122
requirements = kivy==2.3.0,libbz2,sqlite3,pillow==10.2.0,qrcode==7.3.1,usb4a,usbserial4a,able_recipe,libwebp,libogg,libopus,opusfile,numpy,cryptography,ffpyplayer,codec2,pycodec2,sh,pynacl,typing-extensions,mistune>=3.0.2,beautifulsoup4
requirements = kivy==2.3.0,libbz2,sqlite3,pillow==10.2.0,qrcode==7.3.1,usb4a,usbserial4a,able_recipe,libwebp,libogg,libopus,opusfile,numpy,cryptography,ffpyplayer,codec2,pycodec2,sh,pynacl,typing-extensions,mistune>=3.0.2,beautifulsoup4,lxst
android.gradle_dependencies = com.android.support:support-compat:28.0.0
#android.enable_androidx = True