import python ; import feature ; import feature : feature ; import project ; import targets ; import "class" : new ; import modules ; use-project /torrent : ../.. ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; # this is used to make bjam use the same version of python which is executing setup.py LIBTORRENT_PYTHON_INTERPRETER = [ modules.peek : LIBTORRENT_PYTHON_INTERPRETER ] ; feature visibility : default hidden : composite ; feature.compose hidden : -fvisibility=hidden -fvisibility-inlines-hidden ; feature libtorrent-link : shared static : composite propagated ; feature libtorrent-python-pic : off on : composite propagated link-incompatible ; feature.compose on : -fPIC ; # this is just to force boost build to pick the desired python target when using LIBTORRENT_PYTHON_INTERPRETER feature libtorrent-python : on ; if $(LIBTORRENT_PYTHON_INTERPRETER) { echo "using python interpreter at: " $(LIBTORRENT_PYTHON_INTERPRETER) ; using python : : "$(LIBTORRENT_PYTHON_INTERPRETER)" : : : on ; } # copied from boost 1.63's boost python jamfile rule find-py3-version { local versions = [ feature.values python ] ; local py3ver ; for local v in $(versions) { if $(v) >= 3.0 { py3ver = $(v) ; } } return $(py3ver) ; } if $(BOOST_ROOT) { use-project /boost : $(BOOST_ROOT) ; alias boost_python : /boost/python//boost_python : : : $(BOOST_ROOT) ; if [ find-py3-version ] { alias boost_python3 : /boost/python//boost_python3 : : : $(BOOST_ROOT) ; } else { alias boost_python3 ; } } else { local boost-lib-search-path = /opt/local/lib /usr/lib /usr/local/lib /sw/lib /usr/g++/lib ; local boost-include-path = /opt/local/include /usr/local/include /usr/sfw/include ; # the names are decorated in MacPorts lib boost_python : : darwin boost_python27-mt : : $(boost-include-path) ; lib boost_python3 : : darwin boost_python3-mt : : $(boost-include-path) ; lib boost_python : : boost_python : : $(boost-include-path) ; lib boost_python3 : : boost_python3 : : $(boost-include-path) ; } rule libtorrent_linking ( properties * ) { local result ; if ! windows in $(properties) && gcc in $(properties) { result += on ; } if gcc in $(properties) || darwin in $(properties) || clang in $(properties) || clang-darwin in $(properties) { result += hidden ; if ( gcc in $(properties) ) { result += -Wl,-Bsymbolic ; } } if static in $(properties) { ECHO "WARNING: you probably want to specify libtorrent-link=static rather than link=static" ; } if static in $(properties) && linux in $(properties) { ECHO "WARNING: you cannot link statically against boost-python on linux, because it links against pthread statically in that case, which is not allowed" ; } local boost_python_lib ; for local prop in $(properties) { switch $(prop) { case 2.* : boost_python_lib = boost_python ; case 3.* : boost_python_lib = boost_python3 ; } } if ! $(boost_python_lib) { ECHO "WARNING: unknown python version" ; boost_python_lib = boost_python ; } # linux must link dynamically against boost python because it pulls # in libpthread, which must be linked dynamically since we're building a .so # (the static build of libpthread is not position independent) if shared in $(properties) || linux in $(properties) { result += $(boost_python_lib)/shared ; } else { result += $(boost_python_lib)/static ; } if shared in $(properties) { result += /torrent//torrent/shared ; } else { result += /torrent//torrent/static ; } return $(result) ; } # this is a copy of the rule from boost-build's python-extension, but without # specifying no as a mandatory property. That property # would otherwise cause build failures because it suppresses linking against the # runtime library and kernel32 on windows rule my-python-extension ( name : sources * : requirements * : default-build * : usage-requirements * ) { requirements += /python//python_for_extensions ; local project = [ project.current ] ; targets.main-target-alternative [ new typed-target $(name) : $(project) : PYTHON_EXTENSION : [ targets.main-target-sources $(sources) : $(name) ] : [ targets.main-target-requirements $(requirements) : $(project) ] : [ targets.main-target-default-build $(default-build) : $(project) ] ] ; } my-python-extension libtorrent : # sources src/module.cpp src/big_number.cpp src/converters.cpp src/create_torrent.cpp src/fingerprint.cpp src/utility.cpp src/session.cpp src/entry.cpp src/torrent_info.cpp src/string.cpp src/torrent_handle.cpp src/torrent_status.cpp src/session_settings.cpp src/version.cpp src/alert.cpp src/datetime.cpp src/peer_info.cpp src/ip_filter.cpp src/magnet_uri.cpp src/error_code.cpp : # requirements src gcc:-Wno-deprecated-declarations darwin:-Wno-deprecated-declarations darwin:-Wno-unused-command-line-argument @libtorrent_linking openssl:/torrent//ssl openssl:/torrent//crypto : # usage-requirements false ; install stage_module : libtorrent : . LIB ; install stage_dependencies : /torrent//torrent boost_python : dependencies on SHARED_LIB ; explicit stage_module ; explicit stage_dependencies ;