Skip to content

Commit c27a8ef

Browse files
committed
update spec file with requirements param
1 parent f6c7e50 commit c27a8ef

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

packages/android/buildozer.spec

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title = mockone
77
package.name = mock
88

99
# (str) Package domain (needed for android/ios packaging)
10-
package.domain = org.mock
10+
package.domain = org.test
1111

1212
# (str) Source code where the main.py live
1313
source.dir = ../../src
@@ -36,7 +36,17 @@ version = 0.1
3636

3737
# (list) Application requirements
3838
# comma separated e.g. requirements = sqlite3,kivy
39-
requirements = python3,kivy
39+
requirements =
40+
openssl,
41+
sqlite3,
42+
python3,
43+
kivy,
44+
kivymd,
45+
bitmsghash,
46+
kivy-garden,
47+
qrcode,
48+
Pillow,
49+
msgpack
4050

4151
# (str) Custom source folders for requirements
4252
# Sets custom source for any requirements with recipes
@@ -88,7 +98,7 @@ fullscreen = 0
8898
#android.presplash_lottie = "path/to/lottie/file.json"
8999

90100
# (list) Permissions
91-
#android.permissions = INTERNET
101+
android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE
92102

93103
# (int) Android API to use (targetSdkVersion AND compileSdkVersion)
94104
# 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
225235
#android.copy_libs = 1
226236

227237
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
228-
android.archs = armeabi-v7a, arm64-v8a, x86, x86_64
238+
android.archs = armeabi-v7a
229239

230240
# (int) overrides automatic versionCode computation (used in build.gradle)
231241
# 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
257267
#p4a.source_dir =
258268

259269
# (str) The directory in which python-for-android should look for your own build recipes (if any)
260-
#p4a.local_recipes =
270+
p4a.local_recipes = /home/surbhi/aug_peter/PyBitmessage/packages/android/python-for-android/recipes/
271+
261272

262273
# (str) Filename to the hook for p4a
263274
#p4a.hook =
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2+
from os.path import exists, join
3+
import os
4+
import sys
5+
from multiprocessing import cpu_count
6+
import sh
7+
8+
9+
class BitmsghashRecipe(Recipe):
10+
# This could also inherit from PythonRecipe etc. if you want to
11+
# use their pre-written build processes
12+
13+
url = 'https://github.com/surbhicis/bitmsghash/archive/master.zip'
14+
# {version} will be replaced with self.version when downloading
15+
16+
depends = ['openssl']
17+
18+
conflicts = []
19+
20+
def get_recipe_env(self, arch=None):
21+
env = super(BitmsghashRecipe, self).get_recipe_env(arch)
22+
r = Recipe.get_recipe('openssl', self.ctx)
23+
b = r.get_build_dir(arch.arch)
24+
env['CCFLAGS'] = env['CFLAGS'] = \
25+
env['CFLAGS'] + ' -I{openssl_build_path}/include ' \
26+
'-I{openssl_build_path}/include/openssl'.format(
27+
openssl_build_path=b)
28+
env['LDFLAGS'] = \
29+
env['LDFLAGS'] + ' -L{openssl_build_path} ' \
30+
'-lcrypto{openssl_version} ' \
31+
'-lssl{openssl_version}'.format(
32+
openssl_build_path=b,
33+
openssl_version=r.version)
34+
return env
35+
36+
def should_build(self, arch=None):
37+
super(BitmsghashRecipe, self).should_build(arch)
38+
return not exists(
39+
join(self.ctx.get_libs_dir(arch.arch), 'libbitmsghash.so'))
40+
41+
def build_arch(self, arch=None):
42+
super(BitmsghashRecipe, self).build_arch(arch)
43+
env = self.get_recipe_env(arch)
44+
with current_directory(join(self.get_build_dir(arch.arch))):
45+
dst_dir = join(self.get_build_dir(arch.arch))
46+
shprint(sh.make, '-j', str(cpu_count()), _env=env)
47+
self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir),
48+
'libbitmsghash.so')
49+
50+
recipe = BitmsghashRecipe()

0 commit comments

Comments
 (0)