1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
|
# 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 "OS =" [ os.name ] ;
if $(BOOST_ROOT)
{
use-project /boost : $(BOOST_ROOT) ;
}
VERSION = 0.15.10 ;
# rule for linking the correct libraries depending
# on features and target-os
rule linking ( properties * )
{
local result ;
# openssl libraries, if enabled
if <openssl>sha-1 in $(properties)
|| <openssl>pe in $(properties)
{
# exclude gcc from a regular windows build to make mingw
# link against the regular unix library name
if <target-os>windows in $(properties)
{
result += <library>gdi32 ;
}
if <target-os>windows in $(properties)
{
result += <library>ssleay32
<library>libeay32
<library>advapi32
<library>user32
<library>shell32
;
}
else
{
result += <library>crypto <library>ssl ;
}
}
if <geoip>shared in $(properties)
{
result += <library>GeoIP ;
}
# socket functions on windows require winsock libraries
if <target-os>windows in $(properties)
|| <target-os>cygwin in $(properties)
{
result += <library>ws2_32
<library>wsock32
<define>WIN32_LEAN_AND_MEAN
<define>_WIN32_WINNT=0x0500
<define>__USE_W32_SOCKETS
<define>WIN32
<define>_WIN32
;
}
if <target-os>solaris in $(properties)
{
result += <library>libsocket <library>libnsl ;
}
if <test-coverage>on in $(properties)
&& ( <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties) )
{
result += <cxxflags>-fprofile-arcs <cxxflags>-ftest-coverage
<linkflags>-lgcov <define>NDEBUG ;
}
# clock_gettime on linux requires librt
if <need-librt>yes in $(properties)
{
result += <library>librt ;
}
if <iconv>on in $(properties)
{
result += <library>libiconv ;
}
if <tcmalloc>yes in $(properties)
{
result += <library>tcmalloc ;
}
if <boost>system in $(properties)
{
result += <library>boost_filesystem
<library>boost_thread
<library>boost_system
;
}
if <toolset>gcc in $(properties)
&& <target-os>linux in $(properties)
&& <variant>debug in $(properties)
{
# for backtraces in assertion failures
# which only works on ELF targets with gcc
result += <linkflags>-export-dynamic <cxxflags>-rdynamic ;
}
if <boost>source in $(properties)
{
if <boost-link>static in $(properties)
{
if <toolset>gcc in $(properties) && <link>shared in $(properties)
{
result += <fpic>on ;
}
result += <library>/boost/filesystem//boost_filesystem/<link>static
<library>/boost/system//boost_system/<link>static
;
# if we're building a shared library
# we need to link dynamically against the
# pthread library
if <fpic>on in $(properties) && <target-os>linux in $(properties)
{
result += <library>/boost/thread//boost_thread/<link>shared ;
}
else
{
result += <library>/boost/thread//boost_thread/<link>static ;
}
}
else
{
result += <library>/boost/thread//boost_thread/<link>shared
<library>/boost/filesystem//boost_filesystem/<link>shared
<library>/boost/system//boost_system/<link>shared
;
}
result += <include>$(BOOST_ROOT) <define>BOOST_ALL_NO_LIB ;
}
if <boost>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 += <include>/opt/local/include/boost-1_35
<include>/opt/local/include
<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 ( <target-os>linux in $(properties)
|| <target-os>darwin in $(properties) )
&& ( <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties) )
{
result += <source>src/assert.cpp ;
}
if <geoip>static in $(properties)
{
result += <source>src/GeoIP.c ;
}
if <openssl>off in $(properties)
{
result += <source>src/sha1.cpp ;
}
else
{
if <openssl>pe in $(properties)
{
result += <source>src/pe_crypto.cpp ;
}
if <target-os>linux in $(properties)
{
# linker library on linux, required when using openssl
result += <library>dl ;
}
}
if <memdebug>on in $(properties)
{
result += <source>src/memdebug.cpp ;
}
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 <target-os> ] in windows cygwin ) )
{
name = $(name).$(VERSION) ;
}
return $(name) ;
}
feature tcmalloc : no yes : composite propagated link-incompatible ;
feature need-librt : no yes : composite propagated link-incompatible ;
feature fiemap : off on : composite propagated ;
feature.compose <fiemap>on : <define>HAVE_LINUX_FIEMAP_H ;
feature iconv : auto on off : composite propagated ;
feature.compose <iconv>on : <define>TORRENT_USE_ICONV=1 ;
feature.compose <iconv>off : <define>TORRENT_USE_ICONV=0 ;
feature pool-allocators : on off : composite propagated link-incompatible ;
feature.compose <pool-allocators>off : <define>TORRENT_DISABLE_POOL_ALLOCATOR ;
feature piece-allocator : valloc memalign posix_memalign : composite propagated ;
feature.compose <piece-allocator>memalign : <define>TORRENT_USE_MEMALIGN=1 ;
feature.compose <piece-allocator>posix_memalign : <define>TORRENT_USE_POSIX_MEMALIGN=1 ;
feature geoip : off static shared : composite propagated link-incompatible ;
feature.compose <geoip>off : <define>TORRENT_DISABLE_GEO_IP ;
feature bandwidth-limit-logging : off on : composite propagated link-incompatible ;
feature.compose <bandwidth-limit-logging>on : <define>TORRENT_VERBOSE_BANDWIDTH_LIMIT ;
feature invariant-checks : on off full : composite propagated link-incompatible ;
feature.compose <invariant-checks>off : <define>TORRENT_DISABLE_INVARIANT_CHECKS ;
feature.compose <invariant-checks>full : <define>TORRENT_EXPENSIVE_INVARIANT_CHECKS ;
feature disk-stats : off on : composite propagated link-incompatible ;
feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;
feature memdebug : off on : composite propagated ;
feature.compose <memdebug>on : <define>TORRENT_MEMDEBUG ;
feature simulate-slow-read : off on : composite propagated ;
feature.compose <simulate-slow-read>on : <define>TORRENT_SIMULATE_SLOW_READ ;
feature logging : none default errors verbose : composite propagated link-incompatible ;
feature.compose <logging>default : <define>TORRENT_LOGGING ;
feature.compose <logging>errors : <define>TORRENT_ERROR_LOGGING ;
feature.compose <logging>verbose : <define>TORRENT_VERBOSE_LOGGING ;
feature dht-support : on off logging : composite propagated link-incompatible ;
feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
feature openssl : pe sha-1 off : composite propagated link-incompatible ;
feature.compose <openssl>pe : <define>TORRENT_USE_OPENSSL ;
feature.compose <openssl>sha-1 : <define>TORRENT_USE_OPENSSL <define>TORRENT_DISABLE_ENCRYPTION ;
feature.compose <openssl>off : <define>TORRENT_DISABLE_ENCRYPTION ;
feature resolve-countries : on off : composite propagated link-incompatible ;
feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ;
feature character-set : unicode ansi : composite propagated link-incompatible ;
feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ;
feature.compose <character-set>ansi : <define>BOOST_FILESYSTEM_NARROW_ONLY=1 ;
feature zlib : shipped system : composite propagated link-incompatible ;
feature deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
feature statistics : off on : composite propagated link-incompatible ;
feature.compose <statistics>on : <define>TORRENT_STATS ;
feature upnp-logging : off on : composite propagated link-incompatible ;
feature.compose <upnp-logging>on : <define>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 <debug-iterators>on : <define>_SCL_SECURE=1 <define>_GLIBCXX_DEBUG ;
feature test-coverage : off on : composite propagated ;
feature fpic : off on : composite propagated link-incompatible ;
feature.compose <fpic>on : <cflags>-fPIC ;
feature.compose <fpic>off : <toolset>darwin:<cflags>-mdynamic-no-pic ;
# required for openssl on windows
lib ssleay32 : : <name>ssleay32 ;
lib libeay32 : : <name>libeay32 ;
lib advapi32 : : <name>Advapi32 ;
lib user32 : : <name>User32 ;
lib shell32 : : <name>shell32 ;
lib gdi32 : : <name>gdi32 ;
# when using iconv
lib libiconv : : <name>iconv <link>shared ;
local boost-library-search-path =
<search>/opt/local/lib
<search>/usr/lib
<search>/usr/local/lib
<search>/sw/lib
<search>/usr/g++/lib
;
lib boost_filesystem : : <target-os>darwin <name>boost_filesystem-mt $(boost-library-search-path) ;
lib boost_thread : : <target-os>darwin <name>boost_thread-mt $(boost-library-search-path) ;
lib boost_system : : <target-os>darwin <name>boost_system-mt $(boost-library-search-path) ;
lib boost_filesystem : : <name>boost_filesystem $(boost-library-search-path) ;
lib boost_thread : : <name>boost_thread $(boost-library-search-path) ;
lib boost_system : : <name>boost_system $(boost-library-search-path) ;
# openssl on linux/bsd/macos etc.
lib crypto : : <name>crypto <search>/lib ;
lib ssl : : <name>ssl ;
lib dl : : <link>shared <name>dl ;
# time functions used on linux require librt
lib librt : : <name>rt ;
lib libsocket : : <use>libnsl <name>socket <link>shared <search>/usr/sfw/lib ;
lib libnsl : : <name>nsl <link>shared <search>/usr/sfw/lib ;
lib tcmalloc : : <name>tcmalloc ;
# libz
lib zlib-target : : <name>z ;
# GeoIP shared library
lib GeoIP : : <name>GeoIP ;
# socket libraries on windows
lib wsock32 : : <name>wsock32 ;
lib ws2_32 : : <name>ws2_32 ;
SOURCES =
alert
allocator
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
http_seed_connection
instantiate_connection
natpmp
piece_picker
policy
session
session_impl
socks5_stream
stat
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 =
closest_nodes
dht_tracker
node
refresh
rpc_manager
find_data
node_id
routing_table
traversal_algorithm
;
ZLIB_SOURCES =
adler32
compress
crc32
deflate
gzio
infback
inffast
inflate
inftrees
trees
uncompr
zutil
;
local usage-requirements =
<include>./include
<include>./include/libtorrent
<include>/usr/sfw/include
<zlib>shipped:<include>./zlib
<variant>release:<define>NDEBUG
<variant>debug:<define>TORRENT_DEBUG
<define>_FILE_OFFSET_BITS=64
<define>BOOST_EXCEPTION_DISABLE
<define>BOOST_FILESYSTEM_VERSION=2
<conditional>@linking
<zlib>system:<library>zlib-target
# these compiler settings just makes the compiler standard conforming
<toolset>msvc:<cflags>/Zc:wchar_t
<toolset>msvc:<cflags>/Zc:forScope
# disable bogus deprecation warnings on msvc8
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
# msvc optimizations
<toolset>msvc,<variant>release:<linkflags>/OPT:ICF=5
<toolset>msvc,<variant>release:<linkflags>/OPT:REF
# disable warning C4503: decorated name length exceeded, name was truncated
<toolset>msvc:<cxxflags>/wd4503
# disable warning C4275: non-dll interface class 'x' used as base for dll-interface struct 'y'
<toolset>msvc:<cxxflags>/wd4275
# disable warning C4251: 'x' needs to have dll-interface to be used by clients of class 'y'
<toolset>msvc:<cxxflags>/wd4251
# disable some warnings for gcc
<toolset>gcc:<cflags>-fno-strict-aliasing
<toolset>gcc:<cflags>-Wno-missing-braces
<boost>system:<cxxflags>$(CXXFLAGS)
<boost>system:<linkflags>$(LDFLAGS)
# this works around a bug in asio in boost-1.39
<define>BOOST_ASIO_HASH_MAP_BUCKETS=1021
<tag>@tag
;
project torrent ;
lib torrent
: # sources
src/$(SOURCES).cpp
: # requirements
<define>BOOST_THREAD_USE_LIB
<threading>multi
<link>shared:<define>TORRENT_BUILDING_SHARED
<dht-support>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<dht-support>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<zlib>shipped:<source>zlib/$(ZLIB_SOURCES).c
<conditional>@building
<boost>system:<cxxflags>$(CXXFLAGS)
# hide non-external symbols
<toolset>darwin:<cflags>-fvisibility=hidden
<toolset>gcc:<cflags>-fvisibility=hidden
<toolset>llvm:<cflags>-fvisibility=hidden
$(usage-requirements)
: # default build
<link>static
<threading>multi
: # usage requirements
$(usage-requirements)
;
headers = [ path.glob-tree include/libtorrent : *.hpp ] ;
package.install install
: <install-header-subdir>libtorrent
<install-source-root>libtorrent
<install-no-version-symlinks>on
:
: torrent
: $(headers)
;
|