premiere-libtorrent/Jamfile

759 lines
22 KiB
Plaintext
Executable File

# 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 = 1.1.0 ;
rule coverage ( properties * )
{
local result ;
if <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties)
|| <toolset>clang in $(properties)
{
result += <cxxflags>-fprofile-arcs <cxxflags>-ftest-coverage ;
if <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties)
{
result += <linkflags>-lgcov ;
}
else
{
result += <linkflags>--coverage ;
}
}
return $(result) ;
}
# rule for linking the correct libraries depending
# on features and target-os
rule linking ( properties * )
{
local result ;
# openssl libraries, if enabled
if <encryption>openssl 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>ssleay32
<library>libeay32
<library>advapi32
<library>user32
<library>shell32
<library>gdi32
;
}
else
{
result += <library>crypto <library>ssl <library>z ;
}
if <target-os>linux in $(properties)
{
# linker library on linux, required when using openssl
result += <library>dl ;
}
}
# dbghelp doesn't appear to exist in mingw
if <target-os>windows in $(properties)
&& ! <toolset>gcc in $(properties)
&& ( <variant>debug in $(properties)
|| <asserts>on in $(properties)
|| <asserts>production in $(properties)
|| <pool-allocators>debug in $(properties)
|| <allocator>debug in $(properties)
|| <asio-debugging>on in $(properties) )
{
result += <library>dbghelp ;
}
# gcrypt libraries, if enabled
if <encryption>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 += <library>gcrypt <include>/opt/local/include ;
}
# socket functions on windows require winsock libraries
if <target-os>windows in $(properties)
|| <target-os>cygwin in $(properties)
{
result += <library>ws2_32
<library>wsock32
<library>iphlpapi
<define>WIN32_LEAN_AND_MEAN
<define>__USE_W32_SOCKETS
<define>WIN32
<define>_WIN32
;
# when DHT is enabled, we need ed25519 which in turn
# needs entropy
if ! <dht>off in $(properties)
{
result += <library>advapi32 ;
}
}
if <target-os>beos in $(properties)
{
result += <library>netkit <library>gcc ;
}
if <target-os>solaris in $(properties)
{
result += <library>libsocket <library>libnsl ;
}
# 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 <toolset>gcc in $(properties)
&& <target-os>linux in $(properties)
&& ( <variant>debug in $(properties)
|| <asserts>on in $(properties)
|| <asserts>production in $(properties)
|| <pool-allocators>debug in $(properties)
|| <allocator>debug in $(properties)
|| <asio-debugging>on 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 <link>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 += <define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/system//boost_system/<link>static/<define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/chrono//boost_chrono/<link>static/<define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/random//boost_random/<link>static/<define>BOOST_ALL_DYN_LINK ;
}
else
{
result += <library>/boost/system//boost_system/<link>static ;
result += <library>/boost/chrono//boost_chrono/<link>static ;
result += <library>/boost/random//boost_random/<link>static ;
}
if <toolset>gcc in $(properties)
&& ! <target-os>windows in $(properties)
&& <link>shared in $(properties)
{
result += <fpic>on ;
}
}
else
{
result += <library>/boost/system//boost_system/<link>shared ;
result += <library>/boost/chrono//boost_chrono/<link>shared ;
result += <library>/boost/random//boost_random/<link>shared ;
}
result += <include>$(BOOST_ROOT)
<define>BOOST_ALL_NO_LIB
<define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
;
}
else
{
result += <library>boost_system ;
result += <library>boost_chrono ;
result += <library>boost_random ;
# 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 <link>shared in $(properties) && <export-extra>on in $(properties)
{
# export some internal libtorrent functions
# in order to me able to unit test them.
# this is off by default to keep the export
# symbol table reasonably small
result += <define>TORRENT_EXPORT_EXTRA ;
}
if ( <variant>debug in $(properties)
&& ( <toolset>clang in $(properties)
|| <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties) ) )
{
result += <cflags>-ftrapv ;
}
if ( <variant>debug in $(properties)
|| <asserts>on in $(properties) )
{
result += <source>src/assert.cpp ;
}
if <encryption>openssl in $(properties)
{
result += <source>src/asio_ssl.cpp ;
}
if <encryption>tommath in $(properties)
{
result += <source>src/mpi.c ;
}
if <encryption>off in $(properties)
|| <encryption>tommath in $(properties)
{
result += <source>src/sha1.cpp ;
}
if ! <encryption>off in $(properties)
{
result += <source>src/pe_crypto.cpp ;
}
if ( <toolset>darwin in $(properties)
|| <toolset>gcc in $(properties)
|| <toolset>clang in $(propertoes)
|| <toolset>clang-darwin in $(propertoes) )
&& <link>shared in $(properties)
# on GCC, enabling debugging in libstdc++
# breaks the ABI and its ability to appear
# in shared object interfaces, so when it's
# enabled, just export everything (since we're)
# probably not a production build anyway
&& ! <debug-iterators>on in $(properties)
{
# hide non-external symbols
# use ms-compat because boost.asio (as of 1.47.0
# appears to have some types not fully exported)
result += <cflags>-fvisibility=hidden ;
result += <cxxflags>-fvisibility-inlines-hidden ;
if ( <toolset>gcc in $(properties) )
{
result += <linkflags>-Wl,-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 <target-os> ] in windows cygwin ) )
{
name = $(name).$(VERSION) ;
}
return $(name) ;
}
feature tcmalloc : no yes : composite propagated link-incompatible ;
feature ipv6 : on off : composite propagated link-incompatible ;
feature.compose <ipv6>off : <define>TORRENT_USE_IPV6=0 ;
feature sanitize : off bounds undefined thread rtc : composite propagated link-incompatible ;
# sanitize is a clang and GCC feature
feature.compose <sanitize>bounds : <cflags>-fsanitize=bounds <cflags>-fsanitize-undefined-trap-on-error <linkflags>-fsanitize=bounds <linkflags>-fsanitize-undefined-trap-on-error ;
feature.compose <sanitize>undefined : <cflags>-fsanitize=undefined <linkflags>-fsanitize=undefined ;
feature.compose <sanitize>thread : <cflags>-fsanitize=thread <linkflags>-fsanitize=thread ;
# RTC (runtime check) is an msvc feature
feature.compose <sanitize>rtc : <cflags>/RTCc <cflags>/RTCsu ;
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 file-leak-logging : off on : composite propagated ;
feature.compose <file-leak-logging>on : <define>TORRENT_DEBUG_FILE_LEAKS=1 ;
feature i2p : on off : composite propagated ;
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
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 use-valgrind : off on : composite propagated link-incompatible ;
feature.compose <use-valgrind>on : <define>TORRENT_USE_VALGRIND=1 ;
feature memory-optimization : off on : composite propagated link-incompatible ;
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;
feature asserts : auto on off production system : composite propagated ;
feature.compose <asserts>on : <define>TORRENT_RELEASE_ASSERTS=1 ;
feature.compose <asserts>production : <define>TORRENT_PRODUCTION_ASSERTS=1 <define>TORRENT_RELEASE_ASSERTS=1 ;
feature.compose <asserts>off : <define>TORRENT_USE_ASSERTS=0 ;
feature.compose <asserts>system : <define>TORRENT_USE_SYSTEM_ASSERTS=1 ;
feature windows-version : xp vista win7 : composite propagated link-incompatible ;
feature.compose <windows-version>xp : <define>_WIN32_WINNT=0x0501 ;
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
feature.compose <windows-version>win7 : <define>_WIN32_WINNT=0x0601 ;
feature extensions : on off : composite propagated link-incompatible ;
feature.compose <extensions>off : <define>TORRENT_DISABLE_EXTENSIONS ;
feature asio-debugging : off on : composite propagated link-incompatible ;
feature.compose <asio-debugging>on : <define>TORRENT_ASIO_DEBUGGING ;
feature picker-debugging : off on : composite propagated link-incompatible ;
feature.compose <picker-debugging>on : <define>TORRENT_DEBUG_REFCOUNTS ;
# deprecated use allocator=pool instead
feature pool-allocators : on off debug : composite propagated link-incompatible ;
feature.compose <pool-allocators>off : <define>TORRENT_DISABLE_POOL_ALLOCATOR ;
feature.compose <pool-allocators>debug : <define>TORRENT_DISABLE_POOL_ALLOCATOR <define>TORRENT_DEBUG_BUFFERS ;
feature allocator : pool system debug : composite propagated ;
feature.compose <allocator>system : <define>TORRENT_DISABLE_POOL_ALLOCATOR ;
feature.compose <allocator>debug : <define>TORRENT_DISABLE_POOL_ALLOCATOR <define>TORRENT_DEBUG_BUFFERS ;
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 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 request-log : off on : composite propagated link-incompatible ;
feature.compose <request-log>on : <define>TORRENT_REQUEST_LOGGING ;
feature disk-stats : off on : composite propagated link-incompatible ;
feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;
feature simulate-slow-read : off on : composite propagated ;
feature.compose <simulate-slow-read>on : <define>TORRENT_SIMULATE_SLOW_READ ;
feature logging : off on : composite propagated link-incompatible ;
feature.compose <logging>on : <define>TORRENT_LOGGING ;
feature dht : on off logging : composite propagated link-incompatible ;
feature.compose <dht>off : <define>TORRENT_DISABLE_DHT ;
feature.compose <dht>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
feature encryption : tommath off openssl gcrypt : composite propagated link-incompatible ;
feature.compose <encryption>openssl : <define>TORRENT_USE_OPENSSL ;
feature.compose <encryption>gcrypt : <define>TORRENT_USE_GCRYPT ;
feature.compose <encryption>tommath : <define>TORRENT_USE_TOMMATH ;
feature.compose <encryption>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 deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
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.compose <test-coverage>on : <conditional>@coverage ;
feature fpic : off on : composite propagated link-incompatible ;
feature.compose <fpic>on : <cflags>-fPIC ;
feature.compose <fpic>off : <toolset>darwin:<cflags>-mdynamic-no-pic ;
feature profile-calls : off on : composite propagated link-incompatible ;
feature.compose <profile-calls>on : <define>TORRENT_PROFILE_CALLS=1 ;
# controls whether or not to export some internal
# libtorrent functions. Used for unit testing
feature export-extra : off on : composite propagated ;
# this is a trick to get filename paths to targets to become shorter
# making it possible to build on windows, especially mingw seems particular
variant test_release
: release : <asserts>production <debug-symbols>on
<invariant-checks>full <boost-link>shared
<export-extra>on <debug-iterators>on <boost>source <threading>multi
;
variant test_debug : debug
: <encryption>openssl <logging>on <disk-stats>on
<dht>logging <request-log>on <allocator>debug <debug-iterators>on
<invariant-checks>full <boost-link>shared
<export-extra>on <debug-iterators>on <boost>source <threading>multi
;
variant test_barebones : debug
: <ipv6>off <dht>off <extensions>off <logging>off <boost-link>shared
<deprecated-functions>off <invariant-checks>off
<export-extra>on <debug-iterators>on <boost>source <threading>multi
;
# 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 ;
lib dbghelp : : <name>dbghelp ;
# required for networking on beos
lib netkit : : <name>net <search>/boot/system/lib <link>shared ;
lib gcc : : <name>gcc <link>static ;
# when using iconv
lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
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_system : : <target-os>darwin <name>boost_system-mt $(boost-library-search-path) ;
lib boost_system : : <target-os>solaris <name>boost_system $(boost-library-search-path) ;
lib boost_system : : <name>boost_system ;
lib boost_chrono : : <target-os>darwin <name>boost_chrono-mt $(boost-library-search-path) ;
lib boost_chrono : : <target-os>solaris <name>boost_chrono $(boost-library-search-path) ;
lib boost_chrono : : <name>boost_chrono ;
lib boost_random : : <target-os>darwin <name>boost_random-mt $(boost-library-search-path) ;
lib boost_random : : <target-os>solaris <name>boost_random $(boost-library-search-path) ;
lib boost_random : : <name>boost_random ;
# openssl on linux/bsd/macos etc.
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
lib z : : <link>shared <name>z <search>/usr/lib ;
lib crypto : : <name>crypto <search>/usr/lib <use>z ;
lib ssl : : <name>ssl <link>shared <use>crypto <search>/opt/local/lib ;
lib dl : : <link>shared <name>dl ;
lib aio : : <link>shared <name>aio ;
# time functions used on linux require librt
lib librt : : <name>rt <link>shared ;
lib libsocket : : <use>libnsl <name>socket <link>shared <search>/usr/sfw/lib <link>shared ;
lib libnsl : : <name>nsl <link>shared <search>/usr/sfw/lib <link>shared ;
lib tcmalloc : : <name>tcmalloc <link>shared ;
# GeoIP shared library
lib GeoIP : : <name>GeoIP <link>shared ;
# socket libraries on windows
lib wsock32 : : <name>wsock32 <link>shared ;
lib ws2_32 : : <name>ws2_32 <link>shared ;
lib iphlpapi : : <name>iphlpapi <link>shared ;
SOURCES =
alert
alert_manager
allocator
asio
assert
bandwidth_limit
bandwidth_manager
bandwidth_queue_entry
block_cache
bloom_filter
chained_buffer
choker
crc32c
create_torrent
disk_buffer_holder
disk_buffer_pool
disk_io_job
disk_job_pool
entry
error_code
file_storage
lazy_bdecode
escape_string
string_util
file
gzip
hasher
http_connection
http_stream
http_parser
identify_client
ip_filter
ip_voter
peer_connection
platform_util
bt_peer_connection
web_connection_base
web_peer_connection
http_seed_connection
i2p_stream
instantiate_connection
natpmp
packet_buffer
piece_picker
peer_list
proxy_base
puff
random
receive_buffer
rss
session
session_impl
session_call
settings_pack
socket_io
socket_type
socks5_stream
stat
storage
torrent
torrent_handle
torrent_info
torrent_peer
torrent_peer_allocator
time
tracker_manager
http_tracker_connection
udp_tracker_connection
sha1
tailqueue
timestamp_history
udp_socket
upnp
utf8
utp_socket_manager
utp_stream
file_pool
lsd
disk_buffer_pool
disk_io_thread
enum_net
broadcast_socket
magnet_uri
parse_url
ConvertUTF
thread
xml_parse
peer_class
peer_class_set
part_file
stat_cache
request_blocks
session_stats
performance_counters
resolver
# -- extensions --
metadata_transfer
ut_pex
ut_metadata
lt_trackers
smart_ban
;
KADEMLIA_SOURCES =
dht_tracker
node
refresh
rpc_manager
find_data
node_id
routing_table
traversal_algorithm
logging
dos_blocker
get_peers
item
get_item
;
ED25519_SOURCES =
add_scalar
fe
ge
key_exchange
keypair
sc
seed
sha512
sign
verify
;
local usage-requirements =
<include>./include
<include>./include/libtorrent
<include>/usr/sfw/include
# freebsd doesn't seem to include this automatically
# and iconv.h is installed there
<include>/usr/local/include
<variant>release:<define>NDEBUG
<variant>debug:<define>TORRENT_DEBUG
<define>_FILE_OFFSET_BITS=64
<define>BOOST_EXCEPTION_DISABLE
# enable cancel support in asio
<define>BOOST_ASIO_ENABLE_CANCELIO
<conditional>@linking
# 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
# suppress warnings caused by boost using c++11 features even when not
# in c++11 mode
<toolset>darwin:<cxxflags>-Wno-c++11-extensions
# assert on integer overflow
<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
# make sure asio symbols are properly exported
# and imported
<link>shared:<define>BOOST_ASIO_DYN_LINK
<define>BOOST_ASIO_SEPARATE_COMPILATION
<tag>@tag
;
project torrent ;
lib torrent
: # sources
src/$(SOURCES).cpp
: # requirements
<include>./ed25519/src
<threading>multi
<link>shared:<define>TORRENT_BUILDING_SHARED
<define>BOOST_NO_DEPRECATED
# on windows, when linking statically against asio
# but producing a DLL, everything inside the DLL needs
# to declare the symbol as being exported
<link>shared:<define>BOOST_ASIO_SOURCE
<link>shared:<define>BOOST_SYSTEM_SOURCE
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<dht>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
<dht>logging:<source>ed25519/src/$(ED25519_SOURCES).cpp
<conditional>@building
<boost>system:<cxxflags>$(CXXFLAGS)
$(usage-requirements)
: # default build
<link>static
<threading>multi
: # usage requirements
$(usage-requirements)
<link>shared:<define>TORRENT_LINKING_SHARED
;
headers = [ path.glob-tree include/libtorrent : *.hpp ] ;
package.install install
: <install-source-root>libtorrent
<install-no-version-symlinks>on
:
: torrent
: $(headers)
;