import python ; import feature : feature ; import project ; import targets ; import "class" : new ; import modules ; use-project /torrent : ../.. ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 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 ; if $(BOOST_ROOT) { use-project /boost : $(BOOST_ROOT) ; alias boost_python : /boost/python//boost_python : : : $(BOOST_ROOT) ; } 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_python-mt : : $(boost-include-path) ; lib boost_python : : boost_python : : $(boost-include-path) ; } rule libtorrent_linking ( properties * ) { local result ; if ! windows in $(properties) && gcc in $(properties) && static 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" ; } # 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/shared ; } else { result += boost_python/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 : # usage-requirements false ; install stage_module : libtorrent : . LIB ; explicit stage_module ;