From b4da58a0c4e22c02ce7c6e85bd0950e050845a43 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 14 May 2021 18:25:05 +0530 Subject: [PATCH] added recipe for bitmessage hash --- .../recipes/bitmsghash/__init__.py | 50 +++++++++++++++++++ src/bitmessagekivy/mpybit.py | 8 +-- src/buildozer.spec | 20 +++----- 3 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 src/bitmessagekivy/android/python-for-android/recipes/bitmsghash/__init__.py diff --git a/src/bitmessagekivy/android/python-for-android/recipes/bitmsghash/__init__.py b/src/bitmessagekivy/android/python-for-android/recipes/bitmsghash/__init__.py new file mode 100644 index 00000000..4566ebfb --- /dev/null +++ b/src/bitmessagekivy/android/python-for-android/recipes/bitmsghash/__init__.py @@ -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() diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index d18af5fb..0f543d11 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -817,7 +817,7 @@ class NavigateApp(MDApp): try: self.root.ids.sc5.children[1].active = True except Exception as e: - self.root.ids.sc5.children[0].children[1].active = False + self.root.ids.sc5.children[0].children[1].active = True Clock.schedule_once(partial(self.load_screen_callback, instance), 1) def load_screen_callback(self, instance, dt=0): @@ -835,9 +835,9 @@ class NavigateApp(MDApp): self.root.ids.sc17.children[0].children[1].active = False elif instance.text == 'Trash': # self.root.ids.sc5.ids.ml.clear_widgets() - self.root.ids.sc5.init_ui(0) - # self.root.ids.sc5.clear_widgets() - # self.root.ids.sc5.add_widget(Trash()) + # self.root.ids.sc5.init_ui(0) + self.root.ids.sc5.clear_widgets() + self.root.ids.sc5.add_widget(Trash()) try: self.root.ids.sc5.children[1].active = False except Exception as e: diff --git a/src/buildozer.spec b/src/buildozer.spec index eb861c6b..f4e74685 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -46,15 +46,14 @@ requirements = libiconv, libzbar, pillow, - #bitmsghash, + bitmsghash, #git+https://github.com/navjotcis/KivyMD#egg=kivymd, git+https://github.com/kivymd/KivyMD#egg=kivymd, #kivymd, - kivy-garden, + kivy-garden, qrcode, msgpack - # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes # requirements.source.kivy = ../../kivy @@ -66,9 +65,9 @@ garden_requirements = qrcode #presplash.filename = %(source.dir)s/data/presplash.png # (str) Icon of the application -#icon.filename = %(source.dir)s/logo.png +#icon.filename = %(source.dir)s/data/icon.png -# (str) Supported orientation (one of landscape, portrait or all) +# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all) orientation = portrait # (list) List of service to declare @@ -140,7 +139,7 @@ android.sdk = 20 # agreements. This is intended for automation only. If set to False, # the default, you will be shown the license when first running # buildozer. -# android.accept_sdk_license = False +# android.accept_sdk_license = True # (str) Android entry point, default is ok for Kivy-based app #android.entrypoint = org.renpy.android.PythonActivity @@ -161,11 +160,11 @@ android.sdk = 20 # their classes. Don't add jars that you do not need, since extra jars can slow # down the build process. Allows wildcards matching, for example: # OUYA-ODK/libs/*.jar -#android.add_jars = libs/*.jar +#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar # (list) List of Java files to add to the android project (can be java or a # directory containing the files) -#android.add_src = Config.java +#android.add_src = # (list) Android AAR archives to add (currently works only with sdl2_gradle # bootstrap) @@ -195,9 +194,6 @@ android.sdk = 20 # (list) Java classes to add as activities to the manifest. #android.add_activites = com.example.ExampleActivity -# (str) python-for-android branch to use, defaults to stable -# p4a.branch = master - # (str) OUYA Console category. Should be one of GAME or APP # If you leave this blank, OUYA support will not be enabled #android.ouya.category = GAME @@ -252,7 +248,7 @@ android.arch = armeabi-v7a p4a.branch = develop # (str) python-for-android git clone directory (if empty, it will be automatically cloned from github) -# p4a.source_dir = /home/cis/Music/androidp4a/python-for-android +#p4a.source_dir = # (str) The directory in which python-for-android should look for your own build recipes (if any) p4a.local_recipes = %(source.dir)s/bitmessagekivy/android/python-for-android/recipes/