Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update spec file with requirements param #2077

Open
wants to merge 3 commits into
base: v0.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/android/buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
50 changes: 50 additions & 0 deletions packages/android/python-for-android/recipes/bitmsghash/__init__.py
Original file line number Diff line number Diff line change
@@ -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()