From 00d6d2106de3d273ffa727a4163bfb2f2ea621cc Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Tue, 12 Jul 2016 14:40:52 +0200 Subject: [PATCH] Workaround recursive link libtorrent.so rename native libtorrent.so to libtorrent_rasterbar.so link python libtorrent.so to libtorrent_rasterbar.so --- .../recipes/libtorrent/__init__.py | 8 ++++---- .../libtorrent/disable-so-version.patch | 2 +- .../recipes/libtorrent/setup-lib-name.patch | 20 +++++++++++++++++++ .../libtorrent/use-soname-python.patch | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 pythonforandroid/recipes/libtorrent/setup-lib-name.patch diff --git a/pythonforandroid/recipes/libtorrent/__init__.py b/pythonforandroid/recipes/libtorrent/__init__.py index dcbbf2782f..f45324afc3 100644 --- a/pythonforandroid/recipes/libtorrent/__init__.py +++ b/pythonforandroid/recipes/libtorrent/__init__.py @@ -11,10 +11,10 @@ class LibtorrentRecipe(Recipe): url = 'https://github.com/arvidn/libtorrent/archive/libtorrent-1_0_9.tar.gz' depends = ['boost', 'python2'] opt_depends = ['openssl'] - patches = ['disable-so-version.patch', 'use-soname-python.patch'] + patches = ['disable-so-version.patch', 'use-soname-python.patch', 'setup-lib-name.patch'] def should_build(self, arch): - return not ( self.has_libs(arch, 'libboost_python.so', 'libboost_system.so', 'libtorrent.so') + return not ( self.has_libs(arch, 'libboost_python.so', 'libboost_system.so', 'libtorrent_rasterbar.so') and self.ctx.has_package('libtorrent', arch.arch) ) def prebuild_arch(self, arch): @@ -55,8 +55,8 @@ def build_arch(self, arch): if 'openssl' in recipe.ctx.recipe_build_order: shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/date_time/build', build_subdirs, 'libboost_date_time.so'), join(self.ctx.get_libs_dir(arch.arch), 'libboost_date_time.so')) - shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent.so'), - join(self.ctx.get_libs_dir(arch.arch), 'libtorrent.so')) + shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent_rasterbar.so'), + join(self.ctx.get_libs_dir(arch.arch), 'libtorrent_rasterbar.so')) shutil.copyfile(join(self.get_build_dir(arch.arch), 'bindings/python/bin', build_subdirs, 'libtorrent.so'), join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so')) diff --git a/pythonforandroid/recipes/libtorrent/disable-so-version.patch b/pythonforandroid/recipes/libtorrent/disable-so-version.patch index 24cb3e5763..df0e32057c 100644 --- a/pythonforandroid/recipes/libtorrent/disable-so-version.patch +++ b/pythonforandroid/recipes/libtorrent/disable-so-version.patch @@ -4,7 +4,7 @@ if $(type) = SHARED_LIB && ( ! ( [ $(property-set).get ] in windows cygwin ) ) { -+ return $(name) ; # disable version suffix for android ++ return "libtorrent_rasterbar.so" ; # linked by python bindings .so name = $(name).$(VERSION) ; } diff --git a/pythonforandroid/recipes/libtorrent/setup-lib-name.patch b/pythonforandroid/recipes/libtorrent/setup-lib-name.patch new file mode 100644 index 0000000000..ec3985af16 --- /dev/null +++ b/pythonforandroid/recipes/libtorrent/setup-lib-name.patch @@ -0,0 +1,20 @@ +--- libtorrent/bindings/python/setup.py 2016-02-28 08:28:49.000000000 +0100 ++++ patch/bindings/python/setup.py 2016-07-12 12:03:05.256455888 +0200 +@@ -97,7 +97,7 @@ + source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src")) + source_list = [os.path.join("src", s) for s in source_list if s.endswith(".cpp")] + +- ext = [Extension('libtorrent', ++ ext = [Extension('libtorrent_rasterbar', + sources = source_list, + language='c++', + include_dirs = parse_cmd(extra_cmd, '-I'), +@@ -107,7 +107,7 @@ + + target_specific(), + libraries = ['torrent-rasterbar'] + parse_cmd(extra_cmd, '-l'))] + +-setup(name = 'python-libtorrent', ++setup(name = 'libtorrent', + version = '1.0.9', + author = 'Arvid Norberg', + author_email = 'arvid@libtorrent.org', diff --git a/pythonforandroid/recipes/libtorrent/use-soname-python.patch b/pythonforandroid/recipes/libtorrent/use-soname-python.patch index d1e63918e6..f78553d269 100644 --- a/pythonforandroid/recipes/libtorrent/use-soname-python.patch +++ b/pythonforandroid/recipes/libtorrent/use-soname-python.patch @@ -5,7 +5,7 @@ if ( gcc in $(properties) ) { - result += -Wl,-Bsymbolic ; -+ result += -Wl,-soname=libtorrentpython.so,-Bsymbolic ; ++ result += -Wl,-soname=libtorrent.so,-Bsymbolic ; } }