# This Jamfile requires boost-build v2 to build.
# The version shipped with boost 1.34.0
import modules ;
import path ;
import os ;
import errors ;
import feature : feature ;
import package ;
import virtual-target ;
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
CXXFLAGS = [ modules.peek : CXXFLAGS ] ;
LDFLAGS = [ modules.peek : LDFLAGS ] ;
ECHO "BOOST_ROOT =" $(BOOST_ROOT) ;
ECHO "CXXFLAGS =" $(CXXFLAGS) ;
ECHO "LDFLAGS =" $(LDFLAGS) ;
ECHO "OS =" [ os.name ] ;
if $(BOOST_ROOT)
{
use-project /boost : $(BOOST_ROOT) ;
}
VERSION = 0.16.0 ;
# rule for linking the correct libraries depending
# on features and target-os
rule linking ( properties * )
{
local result ;
if shared in $(properties)
{
# make sure asio symbols are properly exported
# and imported
result += BOOST_ASIO_DYN_LINK ;
}
# openssl libraries, if enabled
if openssl 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)
{
result += ssleay32
libeay32
advapi32
user32
shell32
;
}
else
{
result += crypto ssl z ;
}
if linux in $(properties)
{
# linker library on linux, required when using openssl
result += dl ;
}
}
if windows in $(properties)
&& ( on in $(properties)
|| debug in $(properties)
|| on in $(properties) )
{
result += dbghelp ;
}
# gcrypt libraries, if enabled
if gcrypt in $(properties)
{
# on mac os x, adding the /opt/local/include path
# would include openssl headers incompatible with
# the system library. Only add this include path
# if we're not using openssl (which we're most
# likely not if we're using libgcrypt)
result += gcrypt /opt/local/include ;
}
if shared in $(properties)
{
result += GeoIP ;
}
# socket functions on windows require winsock libraries
if windows in $(properties)
|| cygwin in $(properties)
{
result += ws2_32
wsock32
iphlpapi
WIN32_LEAN_AND_MEAN
__USE_W32_SOCKETS
WIN32
_WIN32
;
}
if beos in $(properties)
{
result += netkit gcc ;
}
if solaris in $(properties)
{
result += libsocket libnsl ;
}
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 on in $(properties)
{
result += libiconv ;
}
if yes in $(properties)
{
result += tcmalloc ;
}
if system in $(properties)
{
result += boost_system ;
}
if gcc in $(properties)
&& linux in $(properties)
&& (debug in $(properties)
|| release in $(properties)
|| production 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)
{
if shared in $(properties)
{
# if libtorrent is being built as a shared library
# but we're linking against boost statically, we still
# need to make boost think it's being built as a shared
# library, so that it properly exports its symbols
result += BOOST_ALL_DYN_LINK ;
}
if gcc in $(properties) && shared in $(properties)
{
result += on ;
}
result += /boost/system//boost_system/static ;
}
else
{
result += /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
# on open indiana, boost is install at /usr/g++/include
result += /opt/local/include/boost-1_35
/opt/local/include
/usr/g++/include
;
}
return $(result) ;
}
# rule for adding the right source files
# depending on target-os and features
rule building ( properties * )
{
local result ;
if ( debug in $(properties)
|| on in $(properties) )
{
result += src/assert.cpp ;
}
if tommath in $(properties)
{
result += src/mpi.c ;
}
if static in $(properties)
{
result += src/GeoIP.c ;
}
if off in $(properties)
|| tommath in $(properties)
{
result += src/sha1.cpp ;
}
if ! ( off in $(properties) )
{
result += src/pe_crypto.cpp ;
}
if ( darwin in $(properties)
|| gcc in $(properties)
|| clang in $(propertoes) )
&& shared in $(properties)
{
# hide non-external symbols
# use ms-compat because boost.asio (as of 1.47.0
# appears to have some types not fulle exported)
result += -fvisibility-ms-compat ;
result += -fvisibility-inlines-hidden ;
result += -W1,-Bsymbolic ;
}
return $(result) ;
}
rule tag ( name : type ? : property-set )
{
name = [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ;
if $(type) = SHARED_LIB &&
( ! ( [ $(property-set).get ] in windows cygwin ) )
{
name = $(name).$(VERSION) ;
}
return $(name) ;
}
feature tcmalloc : no yes : composite propagated link-incompatible ;
feature timer : auto boost absolute performance clock system_time
: composite propagated link-incompatible ;
feature.compose boost : TORRENT_USE_BOOST_DATE_TIME=1 ;
feature.compose absolute : TORRENT_USE_ABSOLUTE_TIME=1 ;
feature.compose performance : TORRENT_USE_PERFORMANCE_TIMER=1 ;
feature.compose clock : TORRENT_USE_CLOCK_GETTIME=1 ;
feature.compose system_time : TORRENT_USE_SYSTEM_TIME=1 ;
feature ipv6 : on off : composite propagated link-incompatible ;
feature.compose off : TORRENT_USE_IPV6=0 ;
feature need-librt : no yes : composite propagated link-incompatible ;
feature fiemap : off on : composite propagated ;
feature.compose on : HAVE_LINUX_FIEMAP_H ;
feature iconv : auto on off : composite propagated ;
feature.compose on : TORRENT_USE_ICONV=1 ;
feature.compose off : TORRENT_USE_ICONV=0 ;
feature full-stats : on off : composite propagated link-incompatible ;
feature.compose off : TORRENT_DISABLE_FULL_STATS ;
feature asserts : auto on off production system : composite propagated ;
feature.compose on : TORRENT_RELEASE_ASSERTS=1 ;
feature.compose production : TORRENT_PRODUCTION_ASSERTS=1 TORRENT_RELEASE_ASSERTS=1 ;
feature.compose off : TORRENT_NO_ASSERTS=1 ;
feature.compose system : TORRENT_USE_SYSTEM_ASSERTS=1 ;
feature windows-version : 2k xp vista win7 : composite propagated link-incompatible ;
feature.compose 2k : _WIN32_WINNT=0x0500 ;
feature.compose xp : _WIN32_WINNT=0x0501 ;
feature.compose vista : _WIN32_WINNT=0x0600 ;
feature.compose win7 : _WIN32_WINNT=0x0601 ;
feature asio-debugging : off on : composite propagated link-incompatible ;
feature.compose on : TORRENT_ASIO_DEBUGGING ;
feature pool-allocators : on off : composite propagated link-incompatible ;
feature.compose off : TORRENT_DISABLE_POOL_ALLOCATOR ;
feature piece-allocator : valloc memalign posix_memalign : composite propagated ;
feature.compose memalign : TORRENT_USE_MEMALIGN=1 ;
feature.compose posix_memalign : TORRENT_USE_POSIX_MEMALIGN=1 ;
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 request-log : off on : composite propagated link-incompatible ;
feature.compose on : TORRENT_REQUEST_LOGGING ;
feature disk-stats : off on : composite propagated link-incompatible ;
feature.compose on : TORRENT_DISK_STATS ;
feature simulate-slow-read : off on : composite propagated ;
feature.compose on : TORRENT_SIMULATE_SLOW_READ ;
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 encryption : tommath off openssl gcrypt : composite propagated link-incompatible ;
feature.compose openssl : TORRENT_USE_OPENSSL ;
feature.compose gcrypt : TORRENT_USE_GCRYPT ;
feature.compose tommath : TORRENT_USE_TOMMATH ;
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 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.compose off : darwin:-mdynamic-no-pic ;
# required for openssl on windows
lib ssleay32 : : ssleay32 ;
lib libeay32 : : libeay32 ;
lib advapi32 : : Advapi32 ;
lib user32 : : User32 ;
lib shell32 : : shell32 ;
lib gdi32 : : gdi32 ;
lib dbghelp : : dbghelp ;
# required for networking on beos
lib netkit : : net /boot/system/lib shared ;
lib gcc : : gcc static ;
# when using iconv
lib libiconv : : iconv shared ;
local boost-library-search-path =
/opt/local/lib
/usr/lib
/usr/local/lib
/sw/lib
/usr/g++/lib
;
lib boost_system : : darwin boost_system-mt $(boost-library-search-path) ;
lib boost_system : : solaris boost_system $(boost-library-search-path) ;
lib boost_system : : boost_system ;
# openssl on linux/bsd/macos etc.
lib gcrypt : : gcrypt shared /opt/local/lib ;
lib z : : shared z /lib ;
lib crypto : : crypto /lib