update spec file with requirements param

This commit is contained in:
surbhicis 2022-09-21 11:09:17 +05:30
parent f6c7e50acf
commit c27a8ef72f
Signed by untrusted user: surbhicis
GPG Key ID: 48A8C2D218DE7B0B
2 changed files with 66 additions and 5 deletions

View File

@ -7,7 +7,7 @@ title = mockone
package.name = mock
# (str) Package domain (needed for android/ios packaging)
package.domain = org.mock
package.domain = org.test
# (str) Source code where the main.py live
source.dir = ../../src
@ -36,7 +36,17 @@ version = 0.1
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy
requirements =
openssl,
sqlite3,
python3,
kivy,
kivymd,
bitmsghash,
kivy-garden,
qrcode,
Pillow,
msgpack
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
@ -88,7 +98,7 @@ fullscreen = 0
#android.presplash_lottie = "path/to/lottie/file.json"
# (list) Permissions
#android.permissions = INTERNET
android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE
# (int) Android API to use (targetSdkVersion AND compileSdkVersion)
# note: when changing, Dockerfile also needs to be changed to install corresponding build tools
@ -225,7 +235,7 @@ android.ant_path = /opt/android/apache-ant
#android.copy_libs = 1
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.archs = armeabi-v7a, arm64-v8a, x86, x86_64
android.archs = armeabi-v7a
# (int) overrides automatic versionCode computation (used in build.gradle)
# this is not the same as app version and should only be edited if you know what you're doing
@ -257,7 +267,8 @@ android.allow_backup = True
#p4a.source_dir =
# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =
p4a.local_recipes = /home/surbhi/aug_peter/PyBitmessage/packages/android/python-for-android/recipes/
# (str) Filename to the hook for p4a
#p4a.hook =

View File

@ -0,0 +1,50 @@
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from os.path import exists, join
import os
import sys
from multiprocessing import cpu_count
import sh
class BitmsghashRecipe(Recipe):
# This could also inherit from PythonRecipe etc. if you want to
# use their pre-written build processes
url = 'https://github.com/surbhicis/bitmsghash/archive/master.zip'
# {version} will be replaced with self.version when downloading
depends = ['openssl']
conflicts = []
def get_recipe_env(self, arch=None):
env = super(BitmsghashRecipe, self).get_recipe_env(arch)
r = Recipe.get_recipe('openssl', self.ctx)
b = r.get_build_dir(arch.arch)
env['CCFLAGS'] = env['CFLAGS'] = \
env['CFLAGS'] + ' -I{openssl_build_path}/include ' \
'-I{openssl_build_path}/include/openssl'.format(
openssl_build_path=b)
env['LDFLAGS'] = \
env['LDFLAGS'] + ' -L{openssl_build_path} ' \
'-lcrypto{openssl_version} ' \
'-lssl{openssl_version}'.format(
openssl_build_path=b,
openssl_version=r.version)
return env
def should_build(self, arch=None):
super(BitmsghashRecipe, self).should_build(arch)
return not exists(
join(self.ctx.get_libs_dir(arch.arch), 'libbitmsghash.so'))
def build_arch(self, arch=None):
super(BitmsghashRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(join(self.get_build_dir(arch.arch))):
dst_dir = join(self.get_build_dir(arch.arch))
shprint(sh.make, '-j', str(cpu_count()), _env=env)
self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir),
'libbitmsghash.so')
recipe = BitmsghashRecipe()