From d9a9a310a8d71d3cbec4df8bc096a08c10f6b2e5 Mon Sep 17 00:00:00 2001
From: Akinwale Ariwodola <akinwale@gmail.com>
Date: Sun, 28 Oct 2018 19:20:40 +0100
Subject: [PATCH] update PyJNIus recipe

---
 recipes/pyjnius/__init__.py                   | 20 +++++--------------
 .../genericndkbuild_jnienv_getter.patch       | 10 +++++-----
 recipes/pyjnius/sdl2_jnienv_getter.patch      | 10 +++++-----
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/recipes/pyjnius/__init__.py b/recipes/pyjnius/__init__.py
index c336e8a..90d63a8 100644
--- a/recipes/pyjnius/__init__.py
+++ b/recipes/pyjnius/__init__.py
@@ -1,30 +1,20 @@
-
-from pythonforandroid.toolchain import CythonRecipe, Recipe, shprint, current_directory, info
-from pythonforandroid.patching import will_build, check_any
+from pythonforandroid.recipe import CythonRecipe
+from pythonforandroid.toolchain import shprint, current_directory, info
+from pythonforandroid.patching import will_build
 import sh
 from os.path import join
 
 
 class PyjniusRecipe(CythonRecipe):
-    version = 'master'
+    version = '1.1.3'
     url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
     name = 'pyjnius'
-    depends = [('python2', 'python3crystax'), 'genericndkbuild', 'six']
+    depends = [('python2', 'python3crystax'), ('genericndkbuild', 'sdl2', 'sdl'), 'six']
     site_packages_name = 'jnius'
-    call_hostpython_via_targetpython = False
 
     patches = [('sdl2_jnienv_getter.patch', will_build('sdl2')),
                ('genericndkbuild_jnienv_getter.patch', will_build('genericndkbuild'))]
 
-    def get_recipe_env(self, arch):
-        env = super(PyjniusRecipe, self).get_recipe_env(arch)
-        target_python = Recipe.get_recipe('python3crystax', self.ctx).get_build_dir(arch.arch)
-        env['PYTHON_ROOT'] = join(target_python, 'python-install')
-        env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python3.6'
-        env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython3.6m'
-
-        return env
-
     def postbuild_arch(self, arch):
         super(PyjniusRecipe, self).postbuild_arch(arch)
         info('Copying pyjnius java class to classes build dir')
diff --git a/recipes/pyjnius/genericndkbuild_jnienv_getter.patch b/recipes/pyjnius/genericndkbuild_jnienv_getter.patch
index 50c62cb..ff26994 100644
--- a/recipes/pyjnius/genericndkbuild_jnienv_getter.patch
+++ b/recipes/pyjnius/genericndkbuild_jnienv_getter.patch
@@ -16,10 +16,10 @@ index 740510f..0c8e55f 100644
 +++ b/setup.py
 @@ -53,7 +53,7 @@ except ImportError:
  
- if platform == 'android':
+ if PLATFORM == 'android':
      # for android, we use SDL...
--    libraries = ['sdl', 'log']
-+    libraries = ['main', 'log']
-     library_dirs = ['libs/' + getenv('ARCH')]
- elif platform == 'darwin':
+-    LIBRARIES = ['sdl', 'log']
++    LIBRARIES = ['main', 'log']
+     LIBRARY_DIRS = ['libs/' + getenv('ARCH')]
+ elif PLATFORM == 'darwin':
      import subprocess
diff --git a/recipes/pyjnius/sdl2_jnienv_getter.patch b/recipes/pyjnius/sdl2_jnienv_getter.patch
index a366138..d208e5f 100644
--- a/recipes/pyjnius/sdl2_jnienv_getter.patch
+++ b/recipes/pyjnius/sdl2_jnienv_getter.patch
@@ -16,10 +16,10 @@ index 740510f..0c8e55f 100644
 +++ b/setup.py
 @@ -53,7 +53,7 @@ except ImportError:
  
- if platform == 'android':
+ if PLATFORM == 'android':
      # for android, we use SDL...
--    libraries = ['sdl', 'log']
-+    libraries = ['SDL2', 'log']
-     library_dirs = ['libs/' + getenv('ARCH')]
- elif platform == 'darwin':
+-    LIBRARIES = ['sdl', 'log']
++    LIBRARIES = ['SDL2', 'log']
+     LIBRARY_DIRS = ['libs/' + getenv('ARCH')]
+ elif PLATFORM == 'darwin':
      import subprocess