@@ -9,12 +9,19 @@ class LibtorrentRecipe(Recipe):
99 version = '1.0.8'
1010 # Don't forget to change the URL when changing the version
1111 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' ]
1314 patches = ['disable-so-version.patch' , 'use-soname-python.patch' ]
1415
1516 def should_build (self , arch ):
1617 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 )
1825
1926 def build_arch (self , arch ):
2027 super (LibtorrentRecipe , self ).build_arch (arch )
@@ -31,16 +38,23 @@ def build_arch(self, arch):
3138 'link=shared' ,
3239 'boost-link=shared' ,
3340 'boost=source' ,
34- # 'encryption=openssl',
41+ 'encryption=openssl' if 'openssl' in recipe . ctx . recipe_build_order else ' ' ,
3542 '--prefix=' + env ['CROSSHOME' ],
3643 'release'
3744 , _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'
3850 # 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
4051 shutil .copyfile (join (env ['BOOST_BUILD_PATH' ], 'bin.v2/libs/python/build' , build_subdirs , 'libboost_python.so' ),
4152 join (self .ctx .get_libs_dir (arch .arch ), 'libboost_python.so' ))
4253 shutil .copyfile (join (env ['BOOST_BUILD_PATH' ], 'bin.v2/libs/system/build' , build_subdirs , 'libboost_system.so' ),
4354 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' ))
4458 shutil .copyfile (join (self .get_build_dir (arch .arch ), 'bin' , build_subdirs , 'libtorrent.so' ),
4559 join (self .ctx .get_libs_dir (arch .arch ), 'libtorrent.so' ))
4660 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):
5064 env = super (LibtorrentRecipe , self ).get_recipe_env (arch )
5165 # Copy environment from boost recipe
5266 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 )
5369 return env
5470
5571recipe = LibtorrentRecipe ()
0 commit comments