diff --git a/recipes/kivy/__init__.py b/recipes/kivy/__init__.py deleted file mode 100644 index 686b0840..00000000 --- a/recipes/kivy/__init__.py +++ /dev/null @@ -1,54 +0,0 @@ - -from pythonforandroid.toolchain import CythonRecipe, Recipe, shprint, current_directory, ArchARM -from os.path import exists, join -import sh -import glob - - -class KivyRecipe(CythonRecipe): - version = '1.10.0' - url = 'https://github.com/kivy/kivy/archive/{version}.zip' - name = 'kivy' - - depends = [('sdl2', 'pygame'), 'pyjnius'] - - call_hostpython_via_targetpython = False - # patches = ['setargv.patch'] - - - def cythonize_build(self, env, build_dir='.'): - super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir) - - if not exists(join(build_dir, 'kivy', 'include')): - return - - # If kivy is new enough to use the include dir, copy it - # manually to the right location as we bypass this stage of - # the build - with current_directory(build_dir): - build_libs_dirs = glob.glob(join('build', 'lib.*')) - - for dirn in build_libs_dirs: - shprint(sh.cp, '-r', join('kivy', 'include'), - join(dirn, 'kivy')) - - def get_recipe_env(self, arch): - env = super(KivyRecipe, self).get_recipe_env(arch) - - target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch) - env['PYTHON_ROOT'] = join(target_python, 'python-install') - env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' - env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7' - - if 'sdl2' in self.ctx.recipe_build_order: - env['USE_SDL2'] = '1' - env['KIVY_SDL2_PATH'] = ':'.join([ - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'), - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'), - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), - ]) - - return env - -recipe = KivyRecipe() diff --git a/recipes/openssl/__init__.py b/recipes/openssl/__init__.py new file mode 100644 index 00000000..19084691 --- /dev/null +++ b/recipes/openssl/__init__.py @@ -0,0 +1,63 @@ +from functools import partial + +from pythonforandroid.toolchain import Recipe, shprint, current_directory +import sh + + +class OpenSSLRecipe(Recipe): + version = '1.0.2l' + url = 'https://www.openssl.org/source/openssl-{version}.tar.gz' + + def should_build(self, arch): + return not self.has_libs(arch, 'libssl' + self.version + '.so', + 'libcrypto' + self.version + '.so') + + def check_symbol(self, env, sofile, symbol): + nm = env.get('NM', 'nm') + syms = sh.sh('-c', "{} -gp {} | cut -d' ' -f3".format( + nm, sofile), _env=env).splitlines() + if symbol in syms: + return True + print('{} missing symbol {}; rebuilding'.format(sofile, symbol)) + return False + + def get_recipe_env(self, arch=None): + env = super(OpenSSLRecipe, self).get_recipe_env(arch) + env['OPENSSL_VERSION'] = self.version + env['CFLAGS'] += ' ' + env['LDFLAGS'] + env['CC'] += ' ' + env['LDFLAGS'] + return env + + def select_build_arch(self, arch): + aname = arch.arch + if 'arm64' in aname: + return 'linux-aarch64' + if 'v7a' in aname: + return 'android-armv7' + if 'arm' in aname: + return 'android' + return 'linux-armv4' + + def build_arch(self, arch): + env = self.get_recipe_env(arch) + with current_directory(self.get_build_dir(arch.arch)): + # sh fails with code 255 trying to execute ./Configure + # so instead we manually run perl passing in Configure + perl = sh.Command('perl') + buildarch = self.select_build_arch(arch) + shprint(perl, 'Configure', 'shared', 'no-dso', 'no-krb5', buildarch, _env=env) + self.apply_patch('disable-sover.patch', arch.arch) + self.apply_patch('rename-shared-lib.patch', arch.arch) + + # check_ssl = partial(self.check_symbol, env, 'libssl' + self.version + '.so') + check_crypto = partial(self.check_symbol, env, 'libcrypto' + self.version + '.so') + while True: + shprint(sh.make, 'build_libs', _env=env) + if all(map(check_crypto, ('SSLeay', 'MD5_Transform', 'MD4_Init'))): + break + shprint(sh.make, 'clean', _env=env) + + self.install_libs(arch, 'libssl' + self.version + '.so', + 'libcrypto' + self.version + '.so') + +recipe = OpenSSLRecipe() diff --git a/recipes/openssl/disable-sover.patch b/recipes/openssl/disable-sover.patch new file mode 100644 index 00000000..6099fadc --- /dev/null +++ b/recipes/openssl/disable-sover.patch @@ -0,0 +1,20 @@ +--- openssl/Makefile 2016-01-28 17:26:49.159522273 +0100 ++++ b/Makefile 2016-01-28 17:26:54.358438402 +0100 +@@ -342,7 +342,7 @@ + link-shared: + @ set -e; for i in $(SHLIBDIRS); do \ + $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \ +- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ ++ LIBNAME=$$i LIBVERSION= \ + LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ + symlink.$(SHLIB_TARGET); \ + libs="$$libs -l$$i"; \ +@@ -356,7 +356,7 @@ + libs="$(LIBKRB5) $$libs"; \ + fi; \ + $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \ +- LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \ ++ LIBNAME=$$i LIBVERSION= \ + LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \ + LIBDEPS="$$libs $(EX_LIBS)" \ + link_a.$(SHLIB_TARGET); \ diff --git a/recipes/openssl/rename-shared-lib.patch b/recipes/openssl/rename-shared-lib.patch new file mode 100644 index 00000000..30c0f796 --- /dev/null +++ b/recipes/openssl/rename-shared-lib.patch @@ -0,0 +1,16 @@ +--- openssl/Makefile.shared 2016-05-03 15:44:42.000000000 +0200 ++++ patch/Makefile.shared 2016-07-14 00:08:37.268792948 +0200 +@@ -147,11 +147,11 @@ + DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null + + DO_GNU_SO=$(CALC_VERSIONS); \ +- SHLIB=lib$(LIBNAME).so; \ ++ SHLIB=lib$(LIBNAME)$(OPENSSL_VERSION).so; \ + SHLIB_SUFFIX=; \ + ALLSYMSFLAGS='-Wl,--whole-archive'; \ + NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \ +- SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" ++ SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB" + + DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)" +