Skip to content

Commit 00d6d21

Browse files
committed
Workaround recursive link libtorrent.so
rename native libtorrent.so to libtorrent_rasterbar.so link python libtorrent.so to libtorrent_rasterbar.so
1 parent 1b4b1ea commit 00d6d21

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

pythonforandroid/recipes/libtorrent/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class LibtorrentRecipe(Recipe):
1111
url = 'https://github.com/arvidn/libtorrent/archive/libtorrent-1_0_9.tar.gz'
1212
depends = ['boost', 'python2']
1313
opt_depends = ['openssl']
14-
patches = ['disable-so-version.patch', 'use-soname-python.patch']
14+
patches = ['disable-so-version.patch', 'use-soname-python.patch', 'setup-lib-name.patch']
1515

1616
def should_build(self, arch):
17-
return not ( self.has_libs(arch, 'libboost_python.so', 'libboost_system.so', 'libtorrent.so')
17+
return not ( self.has_libs(arch, 'libboost_python.so', 'libboost_system.so', 'libtorrent_rasterbar.so')
1818
and self.ctx.has_package('libtorrent', arch.arch) )
1919

2020
def prebuild_arch(self, arch):
@@ -55,8 +55,8 @@ def build_arch(self, arch):
5555
if 'openssl' in recipe.ctx.recipe_build_order:
5656
shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/date_time/build', build_subdirs, 'libboost_date_time.so'),
5757
join(self.ctx.get_libs_dir(arch.arch), 'libboost_date_time.so'))
58-
shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent.so'),
59-
join(self.ctx.get_libs_dir(arch.arch), 'libtorrent.so'))
58+
shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent_rasterbar.so'),
59+
join(self.ctx.get_libs_dir(arch.arch), 'libtorrent_rasterbar.so'))
6060
shutil.copyfile(join(self.get_build_dir(arch.arch), 'bindings/python/bin', build_subdirs, 'libtorrent.so'),
6161
join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
6262

pythonforandroid/recipes/libtorrent/disable-so-version.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if $(type) = SHARED_LIB &&
55
( ! ( [ $(property-set).get <target-os> ] in windows cygwin ) )
66
{
7-
+ return $(name) ; # disable version suffix for android
7+
+ return "libtorrent_rasterbar.so" ; # linked by python bindings .so
88
name = $(name).$(VERSION) ;
99
}
1010

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- libtorrent/bindings/python/setup.py 2016-02-28 08:28:49.000000000 +0100
2+
+++ patch/bindings/python/setup.py 2016-07-12 12:03:05.256455888 +0200
3+
@@ -97,7 +97,7 @@
4+
source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
5+
source_list = [os.path.join("src", s) for s in source_list if s.endswith(".cpp")]
6+
7+
- ext = [Extension('libtorrent',
8+
+ ext = [Extension('libtorrent_rasterbar',
9+
sources = source_list,
10+
language='c++',
11+
include_dirs = parse_cmd(extra_cmd, '-I'),
12+
@@ -107,7 +107,7 @@
13+
+ target_specific(),
14+
libraries = ['torrent-rasterbar'] + parse_cmd(extra_cmd, '-l'))]
15+
16+
-setup(name = 'python-libtorrent',
17+
+setup(name = 'libtorrent',
18+
version = '1.0.9',
19+
author = 'Arvid Norberg',
20+
author_email = 'arvid@libtorrent.org',

pythonforandroid/recipes/libtorrent/use-soname-python.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if ( <toolset>gcc in $(properties) )
66
{
77
- result += <linkflags>-Wl,-Bsymbolic ;
8-
+ result += <linkflags>-Wl,-soname=libtorrentpython.so,-Bsymbolic ;
8+
+ result += <linkflags>-Wl,-soname=libtorrent.so,-Bsymbolic ;
99
}
1010
}
1111

0 commit comments

Comments
 (0)