premiere-libtorrent/Jamfile

812 lines
21 KiB
Plaintext

# 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 "CXXFLAGS =" $(CXXFLAGS) ;
ECHO "LDFLAGS =" $(LDFLAGS) ;
ECHO "OS =" [ os.name ] ;
if $(BOOST_ROOT)
{
ECHO "building boost from source directory: " $(BOOST_ROOT) ;
use-project /boost : $(BOOST_ROOT) ;
alias boost_system : /boost/system//boost_system : : : <include>$(BOOST_ROOT) ;
}
else
{
local boost-lib-search-path =
<search>/usr/local/lib
;
local boost-include-path =
<include>/usr/local/include
<include>/usr/sfw/include
;
# the names are decorated in MacPorts
lib boost_system : : <target-os>darwin <name>boost_system-mt $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_system : : <name>boost_system $(boost-lib-search-path)
: : $(boost-include-path) ;
}
VERSION = 1.2.0 ;
rule linking ( properties * )
{
local result ;
if <simulator>on in $(properties)
{
result += <library>/libsimulator//simulator ;
}
if <target-os>windows in $(properties)
&& ( <asserts>on in $(properties)
|| <asserts>production in $(properties)
|| <asio-debugging>on in $(properties) )
{
result += <library>dbghelp ;
}
# gcrypt libraries, if enabled
if <crypto>gcrypt in $(properties)
{
result += <library>gcrypt ;
}
else if <crypto>openssl in $(properties)
{
result += <library>ssl ;
result += <library>crypto ;
}
else if <crypto>libcrypto in $(properties)
{
result += <library>crypto ;
}
if <target-os>windows in $(properties)
|| <target-os>cygwin in $(properties)
{
# socket functions on windows require winsock libraries
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>android in $(properties)
{
result += <library>dl ;
}
if <target-os>beos in $(properties)
{
result += <library>netkit <library>gcc ;
}
if <target-os>haiku in $(properties)
{
result += <library>libnetwork <library>gcc ;
}
if <target-os>solaris in $(properties)
{
result += <library>libsocket <library>libnsl ;
}
if <target-os>darwin in $(properties)
|| <target-os>iphone in $(properties)
{
# for ip_notifier
result += <framework>CoreFoundation <framework>SystemConfiguration ;
}
if <iconv>on in $(properties)
{
result += <library>libiconv ;
}
if ( <toolset>gcc in $(properties)
|| <toolset>clang in $(properties) )
&& <target-os>linux in $(properties)
&& ( <asserts>on in $(properties)
|| <asserts>production in $(properties)
|| <asio-debugging>on in $(properties) )
{
# for backtraces in assertion failures
# which only works on ELF targets with gcc
result += <linkflags>-export-dynamic <linkflags>-rdynamic ;
}
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/<link>static/<define>BOOST_ALL_DYN_LINK ;
}
else
{
result += <library>boost_system/<link>static ;
}
if <toolset>gcc in $(properties)
&& ! <target-os>windows in $(properties)
&& <link>shared in $(properties)
{
result += <fpic>on ;
}
}
else if <boost-link>shared in $(properties)
{
result += <library>boost_system/<link>shared ;
}
else
{
result += <library>boost_system ;
}
result += <define>BOOST_ALL_NO_LIB
<define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
<define>BOOST_SYSTEM_NO_DEPRECATED
;
return $(result) ;
}
rule warnings ( properties * )
{
local result ;
if <warnings>off in $(properties)
{
return $(result) ;
}
if <toolset>clang in $(properties)
|| <toolset>darwin in $(properties)
{
result += <cflags>-Weverything ;
result += <cflags>-Wno-documentation ;
result += <cxxflags>-Wno-c++98-compat-pedantic ;
result += <cflags>-Wno-padded ;
result += <cflags>-Wno-global-constructors ;
# this warns on any global static object, which are used for error_category
# objects
result += <cflags>-Wno-exit-time-destructors ;
# enable these warnings again, once the other ones are dealt with
result += <cflags>-Wno-weak-vtables ;
}
if <toolset>gcc in $(properties)
{
result += <cflags>-Wall ;
result += <cflags>-Wextra ;
result += <cflags>-Wpedantic ;
# result += <cflags>-Wmisleading-indentation ;
result += <cflags>-Wparentheses ;
result += <cflags>-Wvla ;
result += <cxxflags>-Wc++11-compat ;
result += <cflags>-Wno-format-zero-length ;
}
if <toolset>msvc in $(properties)
{
# on msvc this resolves to /W4
result += <warnings>all ;
# enable these warnings again, once the other ones are dealt with
# disable warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
result += <cflags>/wd4251 ;
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
result += <cflags>/wd4275 ;
# disable warning C4373: virtual function overrides, previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
result += <cflags>/wd4373 ;
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
result += <cflags>/wd4268 ;
# C4503: 'identifier': decorated name length exceeded, name was truncated
result += <cflags>/wd4503 ;
}
return $(result) ;
}
# rule for adding the right source files
# depending on target-os and features
rule building ( properties * )
{
local result ;
if ( <asserts>off in $(properties) &&
! <invariant-checks>off in $(properties) )
{
ECHO "'invariant-check' requires enabled 'asserts' mode. (e.g. specify build params: invariant-check=on asserts=on)" ;
result += <build>no ;
}
if <toolset>msvc in $(properties)
{
# allow larger .obj files (with more sections)
result += <cflags>/bigobj ;
}
if ( <variant>debug in $(properties)
&& ( <toolset>clang in $(properties)
|| <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties) ) )
{
result += <cflags>-ftrapv ;
}
if ( <asserts>production in $(properties)
|| <asserts>on in $(properties) )
{
result += <source>src/assert.cpp ;
}
if <encryption>on in $(properties)
{
result += <source>src/pe_crypto.cpp ;
}
if <crypto>built-in in $(properties)
&& ! <target-os>windows in $(properties)
&& ! <target-os>darwin in $(properties)
{
result += <source>src/sha1.cpp ;
if <dht>on in $(properties)
{
result += <source>src/sha512.cpp ;
}
}
if <target-os>windows in $(properties)
&& <windows-version>xp in $(properties)
{
result += <source>src/sha512.cpp ;
}
if ( <toolset>darwin in $(properties)
|| <toolset>gcc in $(properties)
|| <toolset>clang in $(properties)
|| <toolset>clang-darwin in $(properties) )
&& <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
result += <cflags>-fvisibility=hidden ;
result += <cxxflags>-fvisibility-inlines-hidden ;
if ( <toolset>gcc in $(properties) )
{
result += <linkflags>-Wl,-Bsymbolic ;
}
}
return $(result) ;
}
rule default-build ( properties * )
{
local result ;
if <variant>debug in $(properties)
{
result += <variant>debug:<invariant-checks>on
<variant>debug:<asserts>on ;
}
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) ;
}
# the search path to pick up the openssl libraries from. This is the <search>
# property of those libraries
rule openssl-lib-path ( properties * )
{
local OPENSSL_LIB = [ feature.get-values <openssl-lib> : $(properties) ] ;
if <target-os>darwin in $(properties) && $(OPENSSL_LIB) = ""
{
# on macOS, default to pick up openssl from the homebrew installation
# brew install openssl
OPENSSL_LIB = /usr/local/opt/openssl/lib ;
}
else if <target-os>windows in $(properties) && $(OPENSSL_LIB) = ""
{
# on windows, assume openssl is installed to c:\OpenSSL-Win32
if <address-model>64 in $(properties)
{ OPENSSL_LIB = c:\\OpenSSL-Win64\\lib ; }
else
{ OPENSSL_LIB = c:\\OpenSSL-Win32\\lib ; }
}
local result ;
result += <search>$(OPENSSL_LIB) ;
return $(result) ;
}
# the include path to pick up openssl headers from. This is the
# usage-requirement for the openssl-related libraries
rule openssl-include-path ( properties * )
{
local OPENSSL_INCLUDE = [ feature.get-values <openssl-include> : $(properties) ] ;
if <target-os>darwin in $(properties) && $(OPENSSL_INCLUDE) = ""
{
# on macOS, default to pick up openssl from the homebrew installation
# brew install openssl
OPENSSL_INCLUDE = /usr/local/opt/openssl/include ;
}
else if <target-os>windows in $(properties) && $(OPENSSL_INCLUDE) = ""
{
# on windows, assume openssl is installed to c:\OpenSSL-Win32
if <address-model>64 in $(properties)
{ OPENSSL_INCLUDE = c:\\OpenSSL-Win64\\include ; }
else
{ OPENSSL_INCLUDE = c:\\OpenSSL-Win32\\include ; }
}
local result ;
result += <include>$(OPENSSL_INCLUDE) ;
return $(result) ;
}
feature openssl-lib : : free path ;
feature openssl-include : : free path ;
feature sanitize : off address memory undefined thread rtc : composite propagated link-incompatible ;
# sanitize is a clang and GCC feature
feature.compose <sanitize>undefined : <cflags>-fsanitize=undefined <cflags>-fsanitize-undefined-trap-on-error <linkflags>-fsanitize=undefined <linkflags>-fsanitize-undefined-trap-on-error ;
feature.compose <sanitize>thread : <cflags>-fsanitize=thread <linkflags>-fsanitize=thread ;
feature.compose <sanitize>address : <cflags>-fsanitize=address <linkflags>-fsanitize=address ;
feature.compose <sanitize>memory : <cflags>-fsanitize=memory <linkflags>-fsanitize=memory ;
# RTC (runtime check) is an msvc feature
feature.compose <sanitize>rtc : <cflags>/RTCc <cflags>/RTCsu ;
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 asserts : off on production system : composite propagated ;
feature.compose <asserts>on : <define>TORRENT_USE_ASSERTS=1 ;
feature.compose <asserts>production : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_PRODUCTION_ASSERTS=1 ;
feature.compose <asserts>system : <define>TORRENT_USE_ASSERTS=1 <define>TORRENT_USE_SYSTEM_ASSERTS=1 ;
feature windows-version : vista win7 xp : composite propagated ;
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
feature.compose <windows-version>win7 : <define>_WIN32_WINNT=0x0601 ;
feature.compose <windows-version>xp : <define>_WIN32_WINNT=0x0501 ;
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 ;
feature simulator : off on : composite propagated link-incompatible ;
feature.compose <simulator>on : <define>TORRENT_BUILD_SIMULATOR ;
feature invariant-checks : off on full : composite propagated link-incompatible ;
feature.compose <invariant-checks>on : <define>TORRENT_USE_INVARIANT_CHECKS=1 ;
feature.compose <invariant-checks>full : <define>TORRENT_USE_INVARIANT_CHECKS=1 <define>TORRENT_EXPENSIVE_INVARIANT_CHECKS ;
feature utp-log : off on : composite propagated link-incompatible ;
feature.compose <utp-log>on : <define>TORRENT_UTP_LOG_ENABLE ;
feature simulate-slow-read : off on : composite propagated ;
feature.compose <simulate-slow-read>on : <define>TORRENT_SIMULATE_SLOW_READ ;
feature logging : on off : composite propagated link-incompatible ;
feature.compose <logging>off : <define>TORRENT_DISABLE_LOGGING ;
feature dht : on off : composite propagated link-incompatible ;
feature.compose <dht>off : <define>TORRENT_DISABLE_DHT ;
feature encryption : on off : composite propagated link-incompatible ;
feature.compose <encryption>off : <define>TORRENT_DISABLE_ENCRYPTION ;
feature mutable-torrents : on off : composite propagated link-incompatible ;
feature.compose <mutable-torrents>off : <define>TORRENT_DISABLE_MUTABLE_TORRENTS ;
feature crypto : built-in openssl libcrypto gcrypt : composite propagated ;
feature.compose <crypto>openssl : <define>TORRENT_USE_LIBCRYPTO <define>TORRENT_USE_OPENSSL <define>OPENSSL_NO_SSL2 ;
feature.compose <crypto>libcrypto : <define>TORRENT_USE_LIBCRYPTO ;
feature.compose <crypto>gcrypt : <define>TORRENT_USE_LIBGCRYPT ;
feature openssl-version : 1.1 pre1.1 : composite propagated ;
feature deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
feature boost-link : default static shared : propagated composite ;
# msvc enables debug iterators by default in debug builds whereas GCC and
# clang do not, that's why "default" is there. msvc has incorrect noexcept
# constructors on some containers when enabling debug iterators, so it's
# possible to turn them off
feature debug-iterators : default off on : composite propagated link-incompatible ;
feature.compose <debug-iterators>on : <define>_ITERATOR_DEBUG_LEVEL=2 <define>_GLIBCXX_DEBUG
<define>_GLIBCXX_DEBUG_PEDANTIC ;
feature.compose <debug-iterators>off : <define>_ITERATOR_DEBUG_LEVEL=0 ;
feature fpic : off on : composite propagated link-incompatible ;
feature.compose <fpic>on : <cflags>-fPIC ;
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 ;
# 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
feature.compose <export-extra>on : <define>TORRENT_EXPORT_EXTRA ;
# this is a trick to get filename paths to targets to become shorter
# making it possible to build on windows, especially mingw seems particular
# for release builds, disable optimizations as they bump GCC over the edge of
# allowed memory usage on travis-ci
variant test_release : release
: <asserts>production <debug-symbols>on
<invariant-checks>full <boost-link>shared <optimization>off
<export-extra>on <threading>multi
<inlining>on <deprecated-functions>off
;
variant test_debug : debug
: <logging>on
<invariant-checks>full <boost-link>shared
<export-extra>on <threading>multi <asserts>on
;
variant test_barebones : debug
: <dht>off <extensions>off <logging>off <boost-link>shared
<deprecated-functions>off <invariant-checks>off
<export-extra>on <threading>multi <asserts>on
;
variant test_arm : debug
: <dht>off <extensions>off <logging>off
<deprecated-functions>off <invariant-checks>off
<export-extra>on <asserts>on
;
lib advapi32 : : <name>advapi32 ;
lib user32 : : <name>user32 ;
lib shell32 : : <name>shell32 ;
lib gdi32 : : <name>gdi32 ;
lib z : : <link>shared <name>z ;
# openssl libraries on windows
alias ssl-deps : advapi32 user32 shell32 gdi32 ;
# pre OpenSSL 1.1 windows
lib crypto : ssl-deps : <target-os>windows <openssl-version>pre1.1 <name>libeay32
<conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
lib ssl : ssl-deps : <target-os>windows <openssl-version>pre1.1 <name>ssleay32
<use>crypto <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
# OpenSSL 1.1+ windows
lib crypto : ssl-deps : <toolset>msvc <openssl-version>1.1 <name>libcrypto
<conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
lib ssl : ssl-deps : <toolset>msvc <openssl-version>1.1 <name>libssl <use>crypto
<conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
# generic OpenSSL
lib crypto : : <name>crypto <use>z <conditional>@openssl-lib-path : :
<conditional>@openssl-include-path ;
lib ssl : : <name>ssl <use>crypto <conditional>@openssl-lib-path : :
<conditional>@openssl-include-path ;
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 ;
# openssl on linux/bsd etc.
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
lib dl : : <link>shared <name>dl ;
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 libnetwork : : <name>network <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
announce_entry
assert
bandwidth_limit
bandwidth_manager
bandwidth_queue_entry
bdecode
bitfield
block_cache
bloom_filter
chained_buffer
choker
close_reason
cpuid
crc32c
create_torrent
disk_buffer_holder
disk_buffer_pool
disk_io_job
disk_io_thread
disk_io_thread_pool
disk_job_fence
disk_job_pool
entry
error_code
file_storage
escape_string
string_util
file
path
fingerprint
gzip
hasher
hex
http_connection
http_stream
http_parser
identify_client
ip_filter
ip_notifier
ip_voter
listen_socket_handle
merkle
peer_connection
platform_util
bt_peer_connection
web_connection_base
web_peer_connection
http_seed_connection
peer_connection_handle
i2p_stream
instantiate_connection
lazy_bdecode
natpmp
packet_buffer
piece_picker
peer_list
proxy_base
puff
random
read_resume_data
write_resume_data
receive_buffer
resolve_links
session
session_handle
session_impl
session_call
session_udp_sockets
settings_pack
sha1_hash
socket_io
socket_type
socks5_stream
stat
storage
storage_piece_set
storage_utils
torrent
torrent_handle
torrent_info
torrent_peer
torrent_peer_allocator
torrent_status
time
tracker_manager
http_tracker_connection
udp_tracker_connection
timestamp_history
udp_socket
upnp
utf8
utp_socket_manager
utp_stream
file_pool
lsd
enum_net
broadcast_socket
magnet_uri
parse_url
ConvertUTF
xml_parse
version
peer_class
peer_class_set
part_file
stat_cache
request_blocks
session_stats
performance_counters
resolver
session_settings
proxy_settings
file_progress
ffs
add_torrent_params
peer_info
stack_allocator
generate_peer_id
# -- extensions --
ut_pex
ut_metadata
smart_ban
;
KADEMLIA_SOURCES =
dht_state
dht_storage
dht_tracker
msg
node
node_entry
refresh
rpc_manager
find_data
node_id
routing_table
traversal_algorithm
dos_blocker
get_peers
item
get_item
put_data
ed25519
sample_infohashes
dht_settings
;
ED25519_SOURCES =
add_scalar
fe
ge
key_exchange
keypair
sc
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
<define>_FILE_OFFSET_BITS=64
# enable cancel support in asio
<define>BOOST_ASIO_ENABLE_CANCELIO
# make sure asio uses std::chrono
<define>BOOST_ASIO_HAS_STD_CHRONO
<conditional>@linking
# msvc optimizations
<toolset>msvc,<variant>release:<linkflags>"/OPT:ICF=5"
<toolset>msvc,<variant>release:<linkflags>"/OPT:REF"
# disable bogus deprecation warnings on msvc8
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
<cxxflags>$(CXXFLAGS)
<linkflags>$(LDFLAGS)
;
project torrent ;
lib torrent
: # sources
src/$(SOURCES).cpp
: # requirements
<include>./ed25519/src
<threading>multi
<define>TORRENT_BUILDING_LIBRARY
<link>shared:<define>TORRENT_BUILDING_SHARED
<define>BOOST_NO_DEPRECATED
<link>shared:<define>BOOST_SYSTEM_SOURCE
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
<dht>on:<source>src/hasher512.cpp
<conditional>@building
<conditional>@warnings
<cxxflags>$(CXXFLAGS)
<tag>@tag
$(usage-requirements)
: # default build
<threading>multi
<c++-template-depth>512
<conditional>@default-build
: # usage requirements
$(usage-requirements)
<link>shared:<define>TORRENT_LINKING_SHARED
;
headers = [ path.glob-tree include/libtorrent : *.hpp ] ;
package.install install
: <install-source-root>libtorrent
:
: torrent
: $(headers)
;