update spec file with requirements param #2077
|
@ -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,14 @@ version = 0.1
|
|||
|
||||
# (list) Application requirements
|
||||
# comma separated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3,kivy
|
||||
requirements =
|
||||
openssl,
|
||||
sqlite3,
|
||||
python3,
|
||||
kivy,
|
||||
kivymd,
|
||||
Pillow,
|
||||
msgpack
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
|
@ -88,7 +95,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 +232,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 +264,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 = ../android/python-for-android/recipes/
|
||||
|
||||
|
||||
# (str) Filename to the hook for p4a
|
||||
#p4a.hook =
|
||||
|
|
|
@ -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()
|
Reference in New Issue
Block a user