# This Jamfile requires boost-build v2 to build. # The version shipped with boost 1.34.0 import modules ; import os ; import errors ; import feature : feature ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; CXXFLAGS = [ modules.peek : CXXFLAGS ] ; LDFLAGS = [ modules.peek : LDFLAGS ] ; ECHO "BOOST_ROOT =" $(BOOST_ROOT) ; ECHO "OS =" [ os.name ] ; if $(BOOST_ROOT) { use-project /boost : $(BOOST_ROOT) ; } # rule for linking the correct libraries depending # on features and target-os rule linking ( properties * ) { local result ; # openssl libraries, if enabled if sha-1 in $(properties) || pe in $(properties) { # exclude gcc from a regular windows build to make mingw # link against the regular unix library name if windows in $(properties) { result += gdi32 ; } if windows in $(properties) && ! gcc in $(properties) { result += ssleay32 libeay32 advapi32 user32 shell32 ; } else { result += crypto ssl ; } } if shared in $(properties) { result += GeoIP ; } # socket functions on windows require winsock libraries if windows in $(properties) || cygwin in $(properties) { result += ws2_32 wsock32 WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0500 __USE_W32_SOCKETS WIN32 _WIN32 ; } if on in $(properties) && ( gcc in $(properties) || darwin in $(properties) ) { result += -fprofile-arcs -ftest-coverage -lgcov NDEBUG ; } # clock_gettime on linux requires librt if yes in $(properties) { result += librt ; } if yes in $(properties) { result += tcmalloc ; } if system in $(properties) { result += boost_filesystem boost_thread boost_system ; } if gcc in $(properties) && linux in $(properties) && debug in $(properties) { # for backtraces in assertion failures # which only works on ELF targets with gcc result += -export-dynamic -rdynamic ; } if source in $(properties) { if static in $(properties) { result += /boost/thread//boost_thread/static /boost/filesystem//boost_filesystem/static /boost/system//boost_system/static ; } else { result += /boost/thread//boost_thread/shared /boost/filesystem//boost_filesystem/shared /boost/system//boost_system/shared ; } result += $(BOOST_ROOT) BOOST_ALL_NO_LIB ; } if system in $(properties) { # on mac the boost headers are installed in # a directory that isn't automatically accessable result += /opt/local/include/boost-1_35 /opt/local/include/boost ; } return $(result) ; } # rule for adding the right source files # depending on target-os and features rule building ( properties * ) { local result ; if gcc in $(properties) || darwin in $(properties) { result += hidden ; } if ( linux in $(properties) || darwin in $(properties) ) && ( gcc in $(properties) || darwin in $(properties) ) { result += src/assert.cpp ; } if static in $(properties) { result += src/GeoIP.c ; } if off in $(properties) { result += src/sha1.cpp ; } else { if pe in $(properties) { result += src/pe_crypto.cpp ; } if linux in $(properties) { # linker library on linux, required when using openssl result += /usr/lib/libdl.so ; } } if on in $(properties) { result += src/memdebug.cpp ; } return $(result) ; } feature tcmalloc : no yes : composite propagated link-incompatible ; feature need-librt : no yes : composite propagated link-incompatible ; feature pool-allocators : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_POOL_ALLOCATOR ; feature geoip : off static shared : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_GEO_IP ; feature bandwidth-limit-logging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_VERBOSE_BANDWIDTH_LIMIT ; feature invariant-checks : on off full : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_INVARIANT_CHECKS ; feature.compose full : TORRENT_EXPENSIVE_INVARIANT_CHECKS ; feature disk-stats : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_DISK_STATS ; feature memdebug : off on : composite propagated ; feature.compose on : TORRENT_MEMDEBUG ; feature logging : none default errors verbose : composite propagated link-incompatible ; feature.compose default : TORRENT_LOGGING ; feature.compose errors : TORRENT_ERROR_LOGGING ; feature.compose verbose : TORRENT_VERBOSE_LOGGING ; feature dht-support : on off logging : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_DHT ; feature.compose logging : TORRENT_DHT_VERBOSE_LOGGING ; feature openssl : pe sha-1 off : composite propagated link-incompatible ; feature.compose pe : TORRENT_USE_OPENSSL ; feature.compose sha-1 : TORRENT_USE_OPENSSL TORRENT_DISABLE_ENCRYPTION ; feature.compose off : TORRENT_DISABLE_ENCRYPTION ; feature resolve-countries : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_RESOLVE_COUNTRIES ; feature character-set : unicode ansi : composite propagated link-incompatible ; feature.compose unicode : _UNICODE UNICODE ; feature zlib : shipped system : composite propagated link-incompatible ; feature deprecated-functions : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_NO_DEPRECATE ; feature statistics : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_STATS ; feature upnp-logging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_UPNP_LOGGING ; feature boost : system source : link-incompatible propagated ; feature boost-link : static shared : composite ; feature debug-iterators : off on : composite propagated link-incompatible ; feature.compose on : _SCL_SECURE=1 _GLIBCXX_DEBUG ; feature test-coverage : off on : composite propagated ; feature fpic : off on : composite propagated link-incompatible ; feature.compose on : -fPIC ; feature visibility : defeault hidden : composite propagated link-incompatible ; feature.compose hidden : -fvisibility=hidden ; # required for openssl on windows lib ssleay32 : : ssleay32 ; lib libeay32 : : libeay32 ; lib advapi32 : : Advapi32 ; lib user32 : : User32 ; lib shell32 : : shell32 ; lib gdi32 : : gdi32 ; local library-search-path = /opt/local/lib /usr/lib /usr/local/lib /sw/lib ; lib boost_filesystem : : boost_filesystem $(library-search-path) ; lib boost_thread : : boost_thread $(library-search-path) ; lib boost_system : : boost_system $(library-search-path) ; # openssl on linux/bsd/macos etc. lib crypto : : crypto ; lib ssl : : ssl ; # time functions used on linux require librt lib librt : : rt ; lib tcmalloc : : tcmalloc $(library-search-path) ; # libz lib zlib-target : : z ; # GeoIP shared library lib GeoIP : : GeoIP ; # socket libraries on windows lib wsock32 : : wsock32 ; lib ws2_32 : : ws2_32 ; SOURCES = alert assert connection_queue create_torrent disk_buffer_holder entry error_code file_storage lazy_bdecode escape_string file gzip http_connection http_stream http_parser identify_client ip_filter peer_connection bt_peer_connection web_peer_connection instantiate_connection natpmp piece_picker policy session session_impl socks4_stream socks5_stream stat storage # mapped_storage torrent torrent_handle torrent_info tracker_manager http_tracker_connection udp_tracker_connection sha1 udp_socket upnp logger file_pool lsd disk_io_thread enum_net broadcast_socket magnet_uri parse_url ConvertUTF # -- extensions -- metadata_transfer ut_pex ut_metadata lt_trackers smart_ban ; KADEMLIA_SOURCES = kademlia/closest_nodes kademlia/dht_tracker kademlia/node kademlia/refresh kademlia/rpc_manager kademlia/find_data kademlia/node_id kademlia/routing_table kademlia/traversal_algorithm ; ZLIB_SOURCES = adler32 compress crc32 deflate gzio infback inffast inflate inftrees trees uncompr zutil ; local usage-requirements = ./include ./include/libtorrent shipped:./zlib release:NDEBUG debug:TORRENT_DEBUG _FILE_OFFSET_BITS=64 BOOST_MULTI_INDEX_DISABLE_SERIALIZATION @linking system:zlib-target # these compiler settings just makes the compiler standard conforming msvc:/Zc:wchar_t msvc:/Zc:forScope # disable bogus deprecation warnings on msvc8 msvc:_SCL_SECURE_NO_DEPRECATE msvc:_CRT_SECURE_NO_DEPRECATE # msvc optimizations msvc,release:/OPT:ICF=5 msvc,release:/OPT:REF # disable warning C4503: decorated name length exceeded, name was truncated msvc:/wd4503 # disable some warnings for gcc gcc:-fno-strict-aliasing gcc:-Wno-missing-braces system:$(CXXFLAGS) system:$(LDFLAGS) ; project torrent ; lib torrent : # sources src/$(SOURCES).cpp : # requirements BOOST_THREAD_USE_LIB multi shared:TORRENT_BUILDING_SHARED on:src/$(KADEMLIA_SOURCES).cpp logging:src/$(KADEMLIA_SOURCES).cpp shipped:zlib/$(ZLIB_SOURCES).c @building system:$(CXXFLAGS) $(usage-requirements) : # default build static : # usage requirements $(usage-requirements) ;