@@ -9,12 +9,19 @@ class LibtorrentRecipe(Recipe):
9
9
version = '1.0.8'
10
10
# Don't forget to change the URL when changing the version
11
11
url = 'http://github.com/arvidn/libtorrent/archive/libtorrent-1_0_8.tar.gz'
12
- depends = ['boost' , 'python2' ] #'openssl'
12
+ depends = ['boost' , 'python2' ]
13
+ opt_depends = ['openssl' ]
13
14
patches = ['disable-so-version.patch' , 'use-soname-python.patch' ]
14
15
15
16
def should_build (self , arch ):
16
17
return not ( self .has_libs (arch , 'libboost_python.so' , 'libboost_system.so' , 'libtorrent.so' )
17
- and self .ctx .has_package ('libtorrent.so' , arch .arch ) )
18
+ and self .ctx .has_package ('libtorrent' , arch .arch ) )
19
+
20
+ def prebuild_arch (self , arch ):
21
+ super (LibtorrentRecipe , self ).prebuild_arch (arch )
22
+ if 'openssl' in recipe .ctx .recipe_build_order :
23
+ # Patch boost user-config.jam to use openssl
24
+ self .get_recipe ('boost' , self .ctx ).apply_patch (join (self .get_recipe_dir (), 'user-config-openssl.patch' ), arch .arch )
18
25
19
26
def build_arch (self , arch ):
20
27
super (LibtorrentRecipe , self ).build_arch (arch )
@@ -31,16 +38,23 @@ def build_arch(self, arch):
31
38
'link=shared' ,
32
39
'boost-link=shared' ,
33
40
'boost=source' ,
34
- # 'encryption=openssl',
41
+ 'encryption=openssl' if 'openssl' in recipe . ctx . recipe_build_order else ' ' ,
35
42
'--prefix=' + env ['CROSSHOME' ],
36
43
'release'
37
44
, _env = env )
45
+ # Common build directories
46
+ build_subdirs = 'gcc-arm/release/boost-link-shared/boost-source'
47
+ if 'openssl' in recipe .ctx .recipe_build_order :
48
+ build_subdirs += '/encryption-openssl'
49
+ build_subdirs += '/libtorrent-python-pic-on/target-os-android/threading-multi/visibility-hidden'
38
50
# Copy the shared libraries into the libs folder
39
- build_subdirs = 'gcc-arm/release/boost-link-shared/boost-source/libtorrent-python-pic-on/target-os-android/threading-multi/visibility-hidden' #encryption-openssl
40
51
shutil .copyfile (join (env ['BOOST_BUILD_PATH' ], 'bin.v2/libs/python/build' , build_subdirs , 'libboost_python.so' ),
41
52
join (self .ctx .get_libs_dir (arch .arch ), 'libboost_python.so' ))
42
53
shutil .copyfile (join (env ['BOOST_BUILD_PATH' ], 'bin.v2/libs/system/build' , build_subdirs , 'libboost_system.so' ),
43
54
join (self .ctx .get_libs_dir (arch .arch ), 'libboost_system.so' ))
55
+ if 'openssl' in recipe .ctx .recipe_build_order :
56
+ shutil .copyfile (join (env ['BOOST_BUILD_PATH' ], 'bin.v2/libs/date_time/build' , build_subdirs , 'libboost_date_time.so' ),
57
+ join (self .ctx .get_libs_dir (arch .arch ), 'libboost_date_time.so' ))
44
58
shutil .copyfile (join (self .get_build_dir (arch .arch ), 'bin' , build_subdirs , 'libtorrent.so' ),
45
59
join (self .ctx .get_libs_dir (arch .arch ), 'libtorrent.so' ))
46
60
shutil .copyfile (join (self .get_build_dir (arch .arch ), 'bindings/python/bin' , build_subdirs , 'libtorrent.so' ),
@@ -50,6 +64,8 @@ def get_recipe_env(self, arch):
50
64
env = super (LibtorrentRecipe , self ).get_recipe_env (arch )
51
65
# Copy environment from boost recipe
52
66
env .update (self .get_recipe ('boost' , self .ctx ).get_recipe_env (arch ))
67
+ if 'openssl' in recipe .ctx .recipe_build_order :
68
+ env ['OPENSSL_BUILD_PATH' ] = self .get_recipe ('openssl' , self .ctx ).get_build_dir (arch .arch )
53
69
return env
54
70
55
71
recipe = LibtorrentRecipe ()
0 commit comments