|
| 1 | +from pythonforandroid.logger import shprint |
| 2 | +from pythonforandroid.recipe import Recipe |
| 3 | +from pythonforandroid.util import current_directory |
| 4 | +import sh |
| 5 | +from os.path import join |
| 6 | + |
| 7 | + |
| 8 | +class LibmysqlclientRecipe(Recipe): |
| 9 | + name = 'libmysqlclient' |
| 10 | + version = 'master' |
| 11 | + url = 'https://github.com/0x-ff/libmysql-android/archive/{version}.zip' |
| 12 | + # version = '5.5.47' |
| 13 | + # url = 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-{version}.tar.gz' |
| 14 | + # |
| 15 | + # depends = ['ncurses'] |
| 16 | + # |
| 17 | + |
| 18 | + # patches = ['add-custom-platform.patch'] |
| 19 | + |
| 20 | + patches = ['disable-soversion.patch'] |
| 21 | + |
| 22 | + def should_build(self, arch): |
| 23 | + return not self.has_libs(arch, 'libmysql.so') |
| 24 | + |
| 25 | + def build_arch(self, arch): |
| 26 | + env = self.get_recipe_env(arch) |
| 27 | + with current_directory(join(self.get_build_dir(arch.arch), 'libmysqlclient')): |
| 28 | + shprint(sh.cp, '-t', '.', join(self.get_recipe_dir(), 'p4a.cmake')) |
| 29 | + # shprint(sh.mkdir, 'Platform') |
| 30 | + # shprint(sh.cp, '-t', 'Platform', join(self.get_recipe_dir(), 'Linux.cmake')) |
| 31 | + shprint(sh.rm, '-f', 'CMakeCache.txt') |
| 32 | + shprint(sh.cmake, '-G', 'Unix Makefiles', |
| 33 | + # '-DCMAKE_MODULE_PATH=' + join(self.get_build_dir(arch.arch), 'libmysqlclient'), |
| 34 | + '-DCMAKE_INSTALL_PREFIX=./install', |
| 35 | + '-DCMAKE_TOOLCHAIN_FILE=p4a.cmake', _env=env) |
| 36 | + shprint(sh.make, _env=env) |
| 37 | + |
| 38 | + self.install_libs(arch, join('libmysql', 'libmysql.so')) |
| 39 | + |
| 40 | + # def get_recipe_env(self, arch=None): |
| 41 | + # env = super(LibmysqlclientRecipe, self).get_recipe_env(arch) |
| 42 | + # env['WITHOUT_SERVER'] = 'ON' |
| 43 | + # ncurses = self.get_recipe('ncurses', self) |
| 44 | + # # env['CFLAGS'] += ' -I' + join(ncurses.get_build_dir(arch.arch), |
| 45 | + # # 'include') |
| 46 | + # env['CURSES_LIBRARY'] = join(self.ctx.get_libs_dir(arch.arch), 'libncurses.so') |
| 47 | + # env['CURSES_INCLUDE_PATH'] = join(ncurses.get_build_dir(arch.arch), |
| 48 | + # 'include') |
| 49 | + # return env |
| 50 | + # |
| 51 | + # def build_arch(self, arch): |
| 52 | + # env = self.get_recipe_env(arch) |
| 53 | + # with current_directory(self.get_build_dir(arch.arch)): |
| 54 | + # # configure = sh.Command('./configure') |
| 55 | + # # TODO: should add openssl as an optional dep and compile support |
| 56 | + # # shprint(configure, '--enable-shared', '--enable-assembler', |
| 57 | + # # '--enable-thread-safe-client', '--with-innodb', |
| 58 | + # # '--without-server', _env=env) |
| 59 | + # # shprint(sh.make, _env=env) |
| 60 | + # shprint(sh.cmake, '.', '-DCURSES_LIBRARY=' + env['CURSES_LIBRARY'], |
| 61 | + # '-DCURSES_INCLUDE_PATH=' + env['CURSES_INCLUDE_PATH'], _env=env) |
| 62 | + # shprint(sh.make, _env=env) |
| 63 | + # |
| 64 | + # self.install_libs(arch, 'libmysqlclient.so') |
| 65 | + |
| 66 | + |
| 67 | +recipe = LibmysqlclientRecipe() |
0 commit comments