openCom-Companion/sbapp/Makefile

107 lines
4.5 KiB
Makefile
Raw Normal View History

2022-07-07 22:16:10 +02:00
all: prepare debug
prepare: cleanrns getrns
2022-07-07 22:16:10 +02:00
clean:
@echo Cleaning...
2022-07-07 22:16:10 +02:00
-(rm ./__pycache__ -r)
-(rm ./app_storage -r)
-(rm ./share/pkg/* -r)
-(rm ./share/mirrors/* -r)
2022-07-07 22:16:10 +02:00
-(rm ./bin -r)
2022-07-07 22:34:01 +02:00
cleanlibs:
. venv/bin/activate; buildozer android clean
2022-07-07 22:16:10 +02:00
2022-07-07 22:34:01 +02:00
cleanall: clean cleanlibs
2024-06-04 03:18:14 +02:00
pacthfiles: patchsdl injectxml patchpycodec2
patchsdl:
# Pach USB HID behaviour
cp patches/HIDDeviceUSB.java .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/jni/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java
2024-09-16 16:41:37 +02:00
cp patches/HIDDeviceUSB.java .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/java/org/libsdl/app/HIDDeviceUSB.java
cp patches/HIDDeviceUSB.java .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/jni/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java
# Pach service loader
2022-09-20 17:28:39 +02:00
cp patches/PythonService.java .buildozer/android/platform/python-for-android/pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonService.java
cp patches/PythonService.java .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/src/main/java/org/kivy/android/PythonService.java
2024-09-16 16:41:37 +02:00
cp patches/PythonService.java .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/java/org/kivy/android/PythonService.java
2022-09-20 17:28:39 +02:00
2024-06-04 03:18:14 +02:00
patchpycodec2:
2024-09-16 16:41:37 +02:00
patchelf --replace-needed libcodec2.so.1.2 libcodec2.so .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/_python_bundle__arm64-v8a/_python_bundle/site-packages/pycodec2/pycodec2.so
patchelf --replace-needed libcodec2.so.1.2 libcodec2.so .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/_python_bundle__armeabi-v7a/_python_bundle/site-packages/pycodec2/pycodec2.so
2024-06-04 03:18:14 +02:00
injectxml:
2023-07-10 02:49:58 +02:00
# mkdir /home/markqvist/.local/lib/python3.11/site-packages/pythonforandroid/bootstraps/sdl2/build/src/main/xml
# Inject XML on arm64-v8a
2024-09-16 16:41:37 +02:00
mkdir -p .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/res/xml
mkdir -p .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/templates
cp patches/device_filter.xml .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/res/xml/
cp patches/file_paths.xml .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/res/xml/
cp patches/AndroidManifest.tmpl.xml .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/templates/
cp patches/p4a_build.py .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/build.py
2022-07-07 22:16:10 +02:00
debug:
. venv/bin/activate; buildozer android debug
2022-07-07 22:16:10 +02:00
prebake:
2024-09-16 16:41:37 +02:00
ifneq (,$(wildcard .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/occ/src/main/res/xml/device_filter.xml))
2022-09-17 17:11:49 +02:00
@echo Device filter XML exists, skipping prebake
else
@(echo Prebaking build before patching files...)
@(sleep 2)
-(. venv/bin/activate; buildozer android release)
@(echo Prebake finished, applying patches and rebuilding...)
@(sleep 2)
2022-09-17 17:11:49 +02:00
endif
fetchshare:
2024-03-16 22:52:41 +01:00
-(rm ./share/pkg/*)
-(rm ./share/mirrors/* -r)
if [ ! -d "./share/pkg" ]; then mkdir ./share/pkg; fi
if [ ! -d "./share/mirrors" ]; then mkdir ./share/mirrors; fi
cp ../../dist_archive/rns-*-py3-none-any.whl ./share/pkg/
cp ../../dist_archive/rnspure-*-py3-none-any.whl ./share/pkg/
cp ../../dist_archive/lxmf-*-py3-none-any.whl ./share/pkg/
cp ../../dist_archive/nomadnet-*-py3-none-any.whl ./share/pkg/
cp ../../dist_archive/rnsh-*-py3-none-any.whl ./share/pkg/
2024-06-04 18:51:36 +02:00
# cp ../../dist_archive/sbapp-*-py3-none-any.whl ./share/pkg/
2023-10-16 20:21:57 +02:00
cp ../../dist_archive/RNode_Firmware_*_Source.zip ./share/pkg/
zip --junk-paths ./share/pkg/example_plugins.zip ../docs/example_plugins/*.py
cp -r ../../dist_archive/reticulum.network ./share/mirrors/
2023-11-04 21:43:33 +01:00
cp -r ../../dist_archive/unsigned.io ./share/mirrors/
cp ../../dist_archive/Reticulum\ Manual.pdf ./share/mirrors/Reticulum_Manual.pdf
cp ../../dist_archive/Reticulum\ Manual.epub ./share/mirrors/Reticulum_Manual.epub
2022-07-07 22:16:10 +02:00
release:
. venv/bin/activate; buildozer android release
2022-07-07 22:16:10 +02:00
2022-10-03 12:54:35 +02:00
postbuild:
$(MAKE) cleanrns
2022-07-07 22:16:10 +02:00
apk: prepare prebake pacthfiles fetchshare release postbuild
2022-07-07 22:16:10 +02:00
devapk: prepare prebake pacthfiles fetchshare debug postbuild
2022-07-07 22:16:10 +02:00
2022-07-08 13:53:04 +02:00
version:
@(echo $$(python ./gv.py))
2022-07-07 22:16:10 +02:00
install:
2024-09-16 16:41:37 +02:00
adb install bin/occ-$$(python ./gv.py)-arm64-v8a_armeabi-v7a-release.apk
2022-07-07 22:16:10 +02:00
console:
2024-09-16 18:05:59 +02:00
(adb logcat | grep "python\|sidebandservice")
2022-07-07 22:16:10 +02:00
getrns:
2024-08-08 16:17:02 +02:00
(cp -rv ../../Reticulum/RNS ./)
-(rm ./RNS/Utilities/RNS)
-(rm ./RNS/__pycache__ -r)
2024-08-08 16:17:02 +02:00
(cp -rv ../../LXMF/LXMF ./)
-(rm ./LXMF/Utilities/LXMF)
2022-11-22 14:25:01 +01:00
-(rm ./LXMF/__pycache__ -r)
2022-07-07 22:16:10 +02:00
cleanrns:
-(rm ./RNS -r)
2022-11-22 14:25:01 +01:00
-(rm ./LXMF -r)