2007-06-13 03:48:24 +02:00
# This Jamfile requires boost-build v2 to build.
# The version shipped with boost 1.34.0
2004-02-18 01:08:20 +01:00
2004-02-04 21:20:53 +01:00
import modules ;
2011-07-23 21:46:27 +02:00
import path ;
2004-02-21 12:52:21 +01:00
import os ;
2005-01-11 03:13:07 +01:00
import errors ;
2006-08-31 02:26:41 +02:00
import feature : feature ;
2009-04-03 01:21:44 +02:00
import package ;
import virtual-target ;
2019-05-12 02:28:48 +02:00
import cast ;
2004-02-04 21:20:53 +01:00
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
2008-05-14 02:21:57 +02:00
CXXFLAGS = [ modules.peek : CXXFLAGS ] ;
LDFLAGS = [ modules.peek : LDFLAGS ] ;
2004-02-04 21:20:53 +01:00
2011-04-10 01:57:56 +02:00
ECHO "CXXFLAGS =" $(CXXFLAGS) ;
ECHO "LDFLAGS =" $(LDFLAGS) ;
2004-07-25 23:44:53 +02:00
ECHO "OS =" [ os.name ] ;
2007-07-07 23:27:36 +02:00
if $(BOOST_ROOT)
2005-01-11 03:13:07 +01:00
{
2015-08-09 01:18:05 +02:00
ECHO "building boost from source directory: " $(BOOST_ROOT) ;
2007-07-07 23:27:36 +02:00
use-project /boost : $(BOOST_ROOT) ;
2015-08-09 01:18:05 +02:00
alias boost_system : /boost/system//boost_system : : : <include>$(BOOST_ROOT) ;
}
else
{
local boost-lib-search-path =
2019-10-15 08:25:26 +02:00
<search>/usr/local/opt/boost/lib
2015-08-09 01:18:05 +02:00
;
local boost-include-path =
2019-10-15 08:25:26 +02:00
<include>/usr/local/opt/boost/include
2015-08-09 01:18:05 +02:00
;
2019-10-15 08:25:26 +02:00
# the names are decorated in MacPorts.
2015-08-09 01:18:05 +02:00
lib boost_system : : <target-os>darwin <name>boost_system-mt $(boost-lib-search-path)
: : $(boost-include-path) ;
2019-10-15 08:25:26 +02:00
# we can't add /usr/local/lib to the search path on mac, as that will
# interfere with system libraries (specifically libjpeg)
lib boost_system : : <name>boost_system $(boost-lib-search-path) <search>/usr/local/lib
: : $(boost-include-path) <include>/usr/local/include ;
2005-01-11 03:13:07 +01:00
}
2019-08-23 11:58:50 +02:00
VERSION = 1.2.2 ;
2009-04-03 01:21:44 +02:00
2017-10-07 15:26:46 +02:00
rule linking ( properties * )
{
local result ;
2015-08-08 03:28:51 +02:00
if <simulator>on in $(properties)
{
result += <library>/libsimulator//simulator ;
}
2012-01-26 11:33:39 +01:00
if <target-os>windows in $(properties)
2016-07-02 01:46:59 +02:00
&& ( <asserts>on in $(properties)
2013-06-17 18:11:52 +02:00
|| <asserts>production in $(properties)
2012-01-26 11:33:39 +01:00
|| <asio-debugging>on in $(properties) )
{
result += <library>dbghelp ;
}
2009-11-08 04:09:19 +01:00
# gcrypt libraries, if enabled
2017-07-14 08:42:56 +02:00
if <crypto>gcrypt in $(properties)
2009-11-08 04:09:19 +01:00
{
2016-05-02 18:36:21 +02:00
result += <library>gcrypt ;
2009-11-08 04:09:19 +01:00
}
2018-07-10 05:27:45 +02:00
else if <crypto>openssl in $(properties)
{
result += <library>ssl ;
result += <library>crypto ;
2019-01-23 00:11:59 +01:00
if <target-os>linux in $(properties)
{
result += <library>dl ;
}
2018-07-10 05:27:45 +02:00
}
else if <crypto>libcrypto in $(properties)
{
result += <library>crypto ;
}
2009-11-08 04:09:19 +01:00
2007-08-20 06:58:56 +02:00
if <target-os>windows in $(properties)
|| <target-os>cygwin in $(properties)
2007-06-13 19:36:26 +02:00
{
2016-07-31 00:03:06 +02:00
# socket functions on windows require winsock libraries
2007-06-13 19:36:26 +02:00
result += <library>ws2_32
<library>wsock32
2010-11-29 02:33:05 +01:00
<library>iphlpapi
2007-06-13 19:36:26 +02:00
<define>WIN32_LEAN_AND_MEAN
<define>__USE_W32_SOCKETS
<define>WIN32
<define>_WIN32
;
2013-08-24 23:35:49 +02:00
# when DHT is enabled, we need ed25519 which in turn
# needs entropy
if ! <dht>off in $(properties)
{
result += <library>advapi32 ;
}
2007-06-13 19:36:26 +02:00
}
2018-03-08 17:43:34 +01:00
if <target-os>android in $(properties)
{
result += <library>dl ;
}
2009-12-09 10:55:19 +01:00
if <target-os>beos in $(properties)
{
2011-07-20 07:14:25 +02:00
result += <library>netkit <library>gcc ;
2009-12-09 10:55:19 +01:00
}
2018-02-04 01:57:54 +01:00
if <target-os>haiku in $(properties)
{
result += <library>libnetwork <library>gcc ;
}
2009-01-27 09:24:48 +01:00
if <target-os>solaris in $(properties)
{
result += <library>libsocket <library>libnsl ;
}
2017-04-07 23:53:12 +02:00
if <target-os>darwin in $(properties)
2017-04-12 05:53:13 +02:00
|| <target-os>iphone in $(properties)
2017-04-07 23:53:12 +02:00
{
# for ip_notifier
result += <framework>CoreFoundation <framework>SystemConfiguration ;
}
2011-02-09 10:54:45 +01:00
if <iconv>on in $(properties)
{
result += <library>libiconv ;
}
2015-06-20 22:36:23 +02:00
if ( <toolset>gcc in $(properties)
|| <toolset>clang in $(properties) )
2007-08-20 06:58:56 +02:00
&& <target-os>linux in $(properties)
2016-06-27 07:00:44 +02:00
&& ( <asserts>on in $(properties)
2013-06-17 18:11:52 +02:00
|| <asserts>production in $(properties)
|| <asio-debugging>on in $(properties) )
2007-08-20 06:58:56 +02:00
{
# for backtraces in assertion failures
# which only works on ELF targets with gcc
2015-06-20 22:36:23 +02:00
result += <linkflags>-export-dynamic <linkflags>-rdynamic ;
2007-08-20 06:58:56 +02:00
}
2015-08-09 01:18:05 +02:00
if <boost-link>static in $(properties)
2007-07-07 23:27:36 +02:00
{
2015-08-09 01:18:05 +02:00
if <link>shared in $(properties)
2008-06-28 10:59:25 +02:00
{
2015-08-09 01:18:05 +02:00
# 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 ;
2008-06-28 10:59:25 +02:00
}
else
2015-06-07 07:31:09 +02:00
{
result += <library>boost_system/<link>static ;
}
2015-08-09 01:18:05 +02:00
if <toolset>gcc in $(properties)
&& ! <target-os>windows in $(properties)
&& <link>shared in $(properties)
2015-06-07 07:31:09 +02:00
{
2015-08-09 01:18:05 +02:00
result += <fpic>on ;
2015-06-07 07:31:09 +02:00
}
2012-07-23 18:10:34 +02:00
2008-06-07 19:36:33 +02:00
}
2015-08-09 01:30:01 +02:00
else if <boost-link>shared in $(properties)
2015-08-09 01:18:05 +02:00
{
result += <library>boost_system/<link>shared ;
}
2015-08-09 01:30:01 +02:00
else
{
result += <library>boost_system ;
}
2015-08-09 01:18:05 +02:00
result += <define>BOOST_ALL_NO_LIB
<define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
2016-10-05 03:54:02 +02:00
<define>BOOST_SYSTEM_NO_DEPRECATED
2015-08-09 01:18:05 +02:00
;
2008-06-07 19:36:33 +02:00
2007-06-13 03:48:24 +02:00
return $(result) ;
}
2015-04-18 04:33:39 +02:00
rule warnings ( properties * )
{
local result ;
2015-04-26 02:51:44 +02:00
if <warnings>off in $(properties)
{
return $(result) ;
}
2015-04-18 04:33:39 +02:00
if <toolset>clang in $(properties)
|| <toolset>darwin in $(properties)
{
result += <cflags>-Weverything ;
result += <cflags>-Wno-documentation ;
2015-08-21 00:26:11 +02:00
result += <cxxflags>-Wno-c++98-compat-pedantic ;
2015-04-18 04:33:39 +02:00
result += <cflags>-Wno-padded ;
result += <cflags>-Wno-global-constructors ;
2016-11-19 20:19:35 +01:00
# this warns on any global static object, which are used for error_category
# objects
2015-04-18 04:33:39 +02:00
result += <cflags>-Wno-exit-time-destructors ;
2015-04-20 06:52:49 +02:00
2015-08-20 01:33:20 +02:00
# enable these warnings again, once the other ones are dealt with
2015-04-19 08:28:21 +02:00
result += <cflags>-Wno-weak-vtables ;
2019-10-15 08:25:26 +02:00
result += <cflags>-Wno-return-std-move-in-c++11 ;
result += <cflags>-Wno-unknown-warning-option ;
2015-04-18 04:33:39 +02:00
}
2015-04-18 16:33:55 +02:00
if <toolset>gcc in $(properties)
{
result += <cflags>-Wall ;
result += <cflags>-Wextra ;
2015-08-20 01:33:20 +02:00
result += <cflags>-Wpedantic ;
# result += <cflags>-Wmisleading-indentation ;
result += <cflags>-Wparentheses ;
result += <cflags>-Wvla ;
2015-08-21 00:26:11 +02:00
result += <cxxflags>-Wc++11-compat ;
2015-09-06 23:29:01 +02:00
result += <cflags>-Wno-format-zero-length ;
2015-04-18 16:33:55 +02:00
}
2015-04-18 04:33:39 +02:00
if <toolset>msvc in $(properties)
{
2016-12-13 16:30:36 +01:00
# on msvc this resolves to /W4
result += <warnings>all ;
2015-04-27 04:21:12 +02:00
# enable these warnings again, once the other ones are dealt with
2016-04-25 23:22:09 +02:00
# 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 ;
2016-07-24 00:57:04 +02:00
# 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 ;
2017-01-26 00:04:22 +01:00
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
result += <cflags>/wd4268 ;
2017-07-14 05:04:21 +02:00
# C4503: 'identifier': decorated name length exceeded, name was truncated
result += <cflags>/wd4503 ;
2015-04-18 04:33:39 +02:00
}
return $(result) ;
}
2007-06-13 19:36:26 +02:00
# rule for adding the right source files
# depending on target-os and features
rule building ( properties * )
2007-06-13 03:48:24 +02:00
{
local result ;
2017-01-14 17:14:10 +01:00
if ( <asserts>off in $(properties) &&
! <invariant-checks>off in $(properties) )
{
2018-04-30 16:59:12 +02:00
ECHO "'invariant-check' requires enabled 'asserts' mode. (e.g. specify build params: invariant-check=on asserts=on)" ;
2017-01-15 13:57:05 +01:00
result += <build>no ;
2017-01-14 17:14:10 +01:00
}
2015-08-20 20:56:52 +02:00
if <toolset>msvc in $(properties)
{
# allow larger .obj files (with more sections)
result += <cflags>/bigobj ;
}
2016-06-28 04:28:51 +02:00
if ( <asserts>production in $(properties)
2012-01-26 11:33:39 +01:00
|| <asserts>on in $(properties) )
2007-09-01 06:08:39 +02:00
{
result += <source>src/assert.cpp ;
}
2014-12-29 17:50:22 +01:00
if <encryption>on in $(properties)
2012-03-15 07:08:08 +01:00
{
2014-12-29 17:50:22 +01:00
result += <source>src/pe_crypto.cpp ;
2012-03-15 07:08:08 +01:00
}
if ( <toolset>darwin in $(properties)
|| <toolset>gcc in $(properties)
2016-08-26 01:07:16 +02:00
|| <toolset>clang in $(properties)
|| <toolset>clang-darwin in $(properties) )
2012-03-15 07:08:08 +01:00
&& <link>shared in $(properties)
2012-03-21 17:34:41 +01:00
# 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
2012-12-15 06:09:11 +01:00
&& ! <debug-iterators>on in $(properties)
2012-03-15 07:08:08 +01:00
{
# hide non-external symbols
2012-03-19 00:31:04 +01:00
result += <cflags>-fvisibility=hidden ;
2012-03-15 07:08:08 +01:00
result += <cxxflags>-fvisibility-inlines-hidden ;
2013-09-04 03:16:13 +02:00
if ( <toolset>gcc in $(properties) )
{
result += <linkflags>-Wl,-Bsymbolic ;
}
2012-03-15 07:08:08 +01:00
}
2007-06-13 03:48:24 +02:00
return $(result) ;
}
2004-03-17 13:14:44 +01:00
2017-10-07 15:26:46 +02:00
rule tag ( name : type ? : property-set )
2009-04-03 01:21:44 +02:00
{
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) ;
}
2017-10-07 15:26:46 +02:00
# 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) = ""
{
2018-12-01 19:44:13 +01:00
# on windows, assume openssl is installed to c:\OpenSSL-Win32
2017-10-07 15:26:46 +02:00
if <address-model>64 in $(properties)
2018-12-01 19:44:13 +01:00
{ OPENSSL_LIB = c:\\OpenSSL-Win64\\lib ; }
2017-10-07 15:26:46 +02:00
else
2018-12-01 19:44:13 +01:00
{ OPENSSL_LIB = c:\\OpenSSL-Win32\\lib ; }
2017-10-07 15:26:46 +02:00
}
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) = ""
{
2018-12-01 19:44:13 +01:00
# on windows, assume openssl is installed to c:\OpenSSL-Win32
2017-10-07 15:26:46 +02:00
if <address-model>64 in $(properties)
2018-12-01 19:44:13 +01:00
{ OPENSSL_INCLUDE = c:\\OpenSSL-Win64\\include ; }
2017-10-07 15:26:46 +02:00
else
2018-12-01 19:44:13 +01:00
{ OPENSSL_INCLUDE = c:\\OpenSSL-Win32\\include ; }
2017-10-07 15:26:46 +02:00
}
local result ;
result += <include>$(OPENSSL_INCLUDE) ;
return $(result) ;
}
2019-03-24 22:14:35 +01:00
path-constant blacklist-file : tools/sanitizer-blacklist.txt ;
rule sanitizer-options ( properties * )
{
local result ;
if <sanitize>on in $(properties)
{
local sanitizers ;
2019-03-31 15:03:13 +02:00
local extra ;
local flags ;
2019-03-24 22:14:35 +01:00
# sanitize is a clang and GCC feature
if <toolset>clang in $(properties)
{
2019-03-31 15:03:13 +02:00
local version = [ feature.get-values <toolset-clang:version> : $(properties) ] ;
# implicit-conversion sanitizer was added in clang-7
2019-09-15 15:56:06 +02:00
if $(version) >= 7.0 {
2019-03-31 15:03:13 +02:00
sanitizers += address,undefined,leak,implicit-conversion ;
}
else {
sanitizers += address,undefined,leak ;
}
extra = <cflags>-fsanitize-blacklist=$(blacklist-file) ;
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
2019-03-24 22:14:35 +01:00
}
2019-09-15 15:56:06 +02:00
# sanitizers are not available on windows (mingw)
else if <toolset>gcc in $(properties) && ! <target-os>windows in $(properties)
2019-03-24 22:14:35 +01:00
{
2019-03-31 15:03:13 +02:00
local version = [ feature.get-values <toolset-gcc:version> : $(properties) ] ;
2019-09-15 15:56:06 +02:00
if $(version) >= 7.0 {
2019-03-31 15:03:13 +02:00
extra = <cflags>-fsanitize-address-use-after-scope ;
}
2019-09-15 15:56:06 +02:00
if $(version) >= 5.0 {
2019-03-31 15:03:13 +02:00
sanitizers = address,undefined,leak ;
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
}
2019-03-24 22:14:35 +01:00
}
else if <toolset>darwin in $(properties)
{
2019-09-15 15:56:06 +02:00
# apple's compiler is typically an old version of clang
2019-03-24 22:14:35 +01:00
sanitizers = address,undefined ;
2019-03-31 15:03:13 +02:00
flags = -fsanitize=$(sanitizers) -fno-sanitize-recover=all ;
2019-03-24 22:14:35 +01:00
}
2019-03-31 15:03:13 +02:00
result = <cflags>$(flags) <linkflags>$(flags) $(extra) ;
2019-03-24 22:14:35 +01:00
}
return $(result) ;
}
2017-10-07 15:26:46 +02:00
feature openssl-lib : : free path ;
feature openssl-include : : free path ;
2019-03-24 22:14:35 +01:00
feature sanitize : off rtc on : composite propagated link-incompatible ;
2014-02-03 04:23:17 +01:00
# RTC (runtime check) is an msvc feature
feature.compose <sanitize>rtc : <cflags>/RTCc <cflags>/RTCsu ;
2014-02-01 22:46:31 +01:00
2019-09-14 19:31:31 +02:00
feature test-coverage : off on : composite propagated link-incompatible ;
feature.compose <test-coverage>on : <cflags>--coverage <linkflags>--coverage ;
2012-07-31 18:53:37 +02:00
feature i2p : on off : composite propagated ;
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
2011-02-09 10:54:45 +01:00
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 ;
2016-07-02 01:46:59 +02:00
feature asserts : off on production system : composite propagated ;
2016-06-28 04:28:51 +02:00
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 ;
2010-05-06 04:18:08 +02:00
2018-10-12 08:15:08 +02:00
feature windows-version : vista win7 xp : composite propagated ;
2010-12-01 06:47:18 +01:00
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
feature.compose <windows-version>win7 : <define>_WIN32_WINNT=0x0601 ;
2015-07-29 20:56:31 +02:00
feature.compose <windows-version>xp : <define>_WIN32_WINNT=0x0501 ;
2010-12-01 06:47:18 +01:00
2013-04-09 04:38:11 +02:00
feature extensions : on off : composite propagated link-incompatible ;
2013-12-20 07:38:51 +01:00
feature.compose <extensions>off : <define>TORRENT_DISABLE_EXTENSIONS ;
2013-04-09 04:38:11 +02:00
2010-11-28 02:47:30 +01:00
feature asio-debugging : off on : composite propagated link-incompatible ;
feature.compose <asio-debugging>on : <define>TORRENT_ASIO_DEBUGGING ;
2014-07-06 21:18:00 +02:00
feature picker-debugging : off on : composite propagated link-incompatible ;
feature.compose <picker-debugging>on : <define>TORRENT_DEBUG_REFCOUNTS ;
2015-08-08 03:28:51 +02:00
feature simulator : off on : composite propagated link-incompatible ;
feature.compose <simulator>on : <define>TORRENT_BUILD_SIMULATOR ;
2016-07-02 01:46:59 +02:00
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 ;
2008-01-13 07:17:56 +01:00
2015-08-13 03:36:20 +02:00
feature utp-log : off on : composite propagated link-incompatible ;
2015-08-13 05:00:28 +02:00
feature.compose <utp-log>on : <define>TORRENT_UTP_LOG_ENABLE ;
2015-08-13 02:55:07 +02:00
2009-09-05 09:21:10 +02:00
feature simulate-slow-read : off on : composite propagated ;
feature.compose <simulate-slow-read>on : <define>TORRENT_SIMULATE_SLOW_READ ;
2015-04-17 03:15:33 +02:00
feature logging : on off : composite propagated link-incompatible ;
feature.compose <logging>off : <define>TORRENT_DISABLE_LOGGING ;
2004-11-01 00:16:08 +01:00
2015-05-16 21:29:49 +02:00
feature dht : on off : composite propagated link-incompatible ;
2013-04-09 03:04:43 +02:00
feature.compose <dht>off : <define>TORRENT_DISABLE_DHT ;
2004-02-04 12:00:29 +01:00
2014-12-29 17:50:22 +01:00
feature encryption : on off : composite propagated link-incompatible ;
2009-11-08 04:09:19 +01:00
feature.compose <encryption>off : <define>TORRENT_DISABLE_ENCRYPTION ;
2007-04-15 06:30:52 +02:00
2015-03-21 01:12:40 +01:00
feature mutable-torrents : on off : composite propagated link-incompatible ;
feature.compose <mutable-torrents>off : <define>TORRENT_DISABLE_MUTABLE_TORRENTS ;
2017-07-14 08:42:56 +02:00
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 ;
2016-06-23 19:20:35 +02:00
feature.compose <crypto>libcrypto : <define>TORRENT_USE_LIBCRYPTO ;
2017-07-14 08:42:56 +02:00
feature.compose <crypto>gcrypt : <define>TORRENT_USE_LIBGCRYPT ;
2016-06-23 19:20:35 +02:00
2017-07-12 09:34:48 +02:00
feature openssl-version : 1.1 pre1.1 : composite propagated ;
2008-08-03 17:14:08 +02:00
feature deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
2015-08-09 01:30:01 +02:00
feature boost-link : default static shared : propagated composite ;
2007-07-07 23:27:36 +02:00
2018-01-04 21:35:31 +01:00
# 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 ;
2019-09-15 15:56:06 +02:00
feature.compose <debug-iterators>on : <define>_GLIBCXX_DEBUG <define>_GLIBCXX_DEBUG_PEDANTIC ;
2018-01-04 21:35:31 +01:00
feature.compose <debug-iterators>off : <define>_ITERATOR_DEBUG_LEVEL=0 ;
2007-08-03 08:13:26 +02:00
2008-12-21 00:30:53 +01:00
feature fpic : off on : composite propagated link-incompatible ;
feature.compose <fpic>on : <cflags>-fPIC ;
2014-07-06 21:18:00 +02:00
feature profile-calls : off on : composite propagated link-incompatible ;
feature.compose <profile-calls>on : <define>TORRENT_PROFILE_CALLS=1 ;
2012-03-19 00:31:04 +01:00
# controls whether or not to export some internal
# libtorrent functions. Used for unit testing
feature export-extra : off on : composite propagated ;
2016-07-03 17:42:57 +02:00
# 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 ;
2012-03-19 00:31:04 +01:00
2014-11-30 11:07:19 +01:00
# this is a trick to get filename paths to targets to become shorter
# making it possible to build on windows, especially mingw seems particular
2015-07-06 23:33:17 +02:00
# for release builds, disable optimizations as they bump GCC over the edge of
# allowed memory usage on travis-ci
2015-08-02 01:55:28 +02:00
variant test_release : release
: <asserts>production <debug-symbols>on
2016-07-02 01:46:59 +02:00
<invariant-checks>full <boost-link>shared <optimization>off
2018-01-04 21:35:31 +01:00
<export-extra>on <threading>multi
2017-03-09 00:32:58 +01:00
<inlining>on <deprecated-functions>off
2014-11-30 11:07:19 +01:00
;
variant test_debug : debug
2017-01-09 02:29:24 +01:00
: <logging>on
2016-07-02 01:46:59 +02:00
<invariant-checks>full <boost-link>shared
2017-12-28 21:41:46 +01:00
<export-extra>on <threading>multi <asserts>on
2014-11-30 11:07:19 +01:00
;
variant test_barebones : debug
2018-08-15 00:02:37 +02:00
: <dht>off <extensions>off <logging>off <boost-link>shared
2016-07-02 01:46:59 +02:00
<deprecated-functions>off <invariant-checks>off
2017-12-28 21:41:46 +01:00
<export-extra>on <threading>multi <asserts>on
2016-06-26 18:01:42 +02:00
;
variant test_arm : debug
2018-08-15 00:02:37 +02:00
: <dht>off <extensions>off <logging>off
2016-07-02 01:46:59 +02:00
<deprecated-functions>off <invariant-checks>off
<export-extra>on <asserts>on
2014-11-30 11:07:19 +01:00
;
2015-11-11 20:02:52 +01:00
lib advapi32 : : <name>advapi32 ;
lib user32 : : <name>user32 ;
2007-06-13 19:36:26 +02:00
lib shell32 : : <name>shell32 ;
lib gdi32 : : <name>gdi32 ;
2017-10-09 01:21:19 +02:00
lib z : : <link>shared <name>z ;
2017-10-08 18:45:48 +02:00
2018-11-23 17:14:18 +01:00
# 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
2018-11-30 03:16:43 +01:00
lib crypto : ssl-deps : <toolset>msvc <openssl-version>1.1 <name>libcrypto
2018-11-23 17:14:18 +01:00
<conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
2018-11-30 03:16:43 +01:00
lib ssl : ssl-deps : <toolset>msvc <openssl-version>1.1 <name>libssl <use>crypto
2018-11-23 17:14:18 +01:00
<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 ;
2017-10-08 18:45:48 +02:00
2012-01-26 11:33:39 +01:00
lib dbghelp : : <name>dbghelp ;
2007-06-13 19:36:26 +02:00
2009-12-09 10:55:19 +01:00
# required for networking on beos
lib netkit : : <name>net <search>/boot/system/lib <link>shared ;
2011-07-20 07:14:25 +02:00
lib gcc : : <name>gcc <link>static ;
2009-12-09 10:55:19 +01:00
2011-02-09 10:54:45 +01:00
# when using iconv
2012-05-13 06:40:21 +02:00
lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
2011-02-09 10:54:45 +01:00
2017-09-22 14:54:22 +02:00
# openssl on linux/bsd etc.
2009-11-08 04:09:19 +01:00
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
2011-02-14 05:12:26 +01:00
lib dl : : <link>shared <name>dl ;
2007-06-13 19:36:26 +02:00
2009-11-02 02:10:05 +01:00
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 ;
2018-02-04 01:57:54 +01:00
lib libnetwork : : <name>network <link>shared ;
2009-01-27 09:24:48 +01:00
2007-06-13 19:36:26 +02:00
# socket libraries on windows
2009-11-02 02:10:05 +01:00
lib wsock32 : : <name>wsock32 <link>shared ;
lib ws2_32 : : <name>ws2_32 <link>shared ;
2010-11-29 02:33:05 +01:00
lib iphlpapi : : <name>iphlpapi <link>shared ;
2007-06-13 19:36:26 +02:00
2003-10-23 01:00:57 +02:00
SOURCES =
2007-04-17 02:23:46 +02:00
alert
2013-04-09 04:38:11 +02:00
alert_manager
2015-09-18 06:23:45 +02:00
announce_entry
2007-12-31 00:30:14 +01:00
assert
2009-09-16 06:41:35 +02:00
bandwidth_limit
bandwidth_manager
bandwidth_queue_entry
2015-03-12 06:20:12 +01:00
bdecode
2016-04-20 13:50:57 +02:00
bitfield
2014-07-06 21:18:00 +02:00
block_cache
2010-12-24 02:31:41 +01:00
bloom_filter
2011-08-14 01:01:38 +02:00
chained_buffer
2014-10-23 00:06:56 +02:00
choker
2015-02-28 20:51:15 +01:00
close_reason
2015-04-26 20:46:45 +02:00
cpuid
2014-07-06 21:18:00 +02:00
crc32c
2008-05-14 07:29:42 +02:00
create_torrent
2008-04-10 12:03:23 +02:00
disk_buffer_holder
2014-07-06 21:18:00 +02:00
disk_buffer_pool
disk_io_job
2016-06-16 02:49:28 +02:00
disk_io_thread
disk_io_thread_pool
2017-01-22 00:36:51 +01:00
disk_job_fence
2014-07-06 21:18:00 +02:00
disk_job_pool
2007-04-17 02:23:46 +02:00
entry
2008-07-18 12:22:16 +02:00
error_code
2008-05-28 10:44:40 +02:00
file_storage
2007-04-17 02:23:46 +02:00
escape_string
2012-08-26 17:26:17 +02:00
string_util
2008-07-20 13:14:54 +02:00
file
2017-04-11 06:52:46 +02:00
path
2016-10-25 14:03:26 +02:00
fingerprint
2008-01-30 19:32:13 +01:00
gzip
2013-05-08 09:57:16 +02:00
hasher
2015-04-21 02:23:00 +02:00
hex
2007-04-17 02:23:46 +02:00
http_connection
2007-04-25 20:26:35 +02:00
http_stream
2008-01-12 10:36:03 +01:00
http_parser
2007-04-17 02:23:46 +02:00
identify_client
ip_filter
2016-11-07 13:40:09 +01:00
ip_notifier
2013-01-02 00:12:16 +01:00
ip_voter
2017-07-21 05:19:28 +02:00
listen_socket_handle
2015-04-24 08:06:41 +02:00
merkle
2007-04-17 02:23:46 +02:00
peer_connection
2014-07-06 21:18:00 +02:00
platform_util
2007-04-17 02:23:46 +02:00
bt_peer_connection
2010-10-10 20:43:58 +02:00
web_connection_base
2007-04-17 02:23:46 +02:00
web_peer_connection
2008-12-30 04:54:07 +01:00
http_seed_connection
2015-07-02 06:13:26 +02:00
peer_connection_handle
2009-08-20 05:19:12 +02:00
i2p_stream
2007-04-25 20:26:35 +02:00
instantiate_connection
2018-04-26 09:01:14 +02:00
lazy_bdecode
2007-04-17 02:23:46 +02:00
natpmp
2010-11-29 02:33:05 +01:00
packet_buffer
2007-04-17 02:23:46 +02:00
piece_picker
2014-10-26 08:34:31 +01:00
peer_list
2014-07-06 21:18:00 +02:00
proxy_base
2010-03-16 07:14:22 +01:00
puff
2011-02-26 08:55:51 +01:00
random
2015-12-15 06:03:43 +01:00
read_resume_data
2017-03-05 15:31:28 +01:00
write_resume_data
2014-11-23 07:14:47 +01:00
receive_buffer
2015-03-21 01:12:40 +01:00
resolve_links
2007-04-17 02:23:46 +02:00
session
2015-06-28 23:12:27 +02:00
session_handle
2007-04-17 02:23:46 +02:00
session_impl
2014-08-26 06:51:09 +02:00
session_call
2017-04-26 05:00:41 +02:00
session_udp_sockets
2014-07-06 21:18:00 +02:00
settings_pack
2019-02-12 11:26:05 +01:00
sha1
2016-05-03 14:29:27 +02:00
sha1_hash
2009-09-16 05:46:36 +02:00
socket_io
2009-11-23 09:38:50 +01:00
socket_type
2007-04-25 20:26:35 +02:00
socks5_stream
2007-04-17 02:23:46 +02:00
stat
storage
2017-01-22 08:38:52 +01:00
storage_piece_set
2017-01-11 06:42:10 +01:00
storage_utils
2007-04-17 02:23:46 +02:00
torrent
torrent_handle
torrent_info
2014-07-06 21:18:00 +02:00
torrent_peer
torrent_peer_allocator
2016-04-08 03:44:24 +02:00
torrent_status
2009-11-25 07:55:34 +01:00
time
2007-04-17 02:23:46 +02:00
tracker_manager
http_tracker_connection
udp_tracker_connection
2010-11-29 02:33:05 +01:00
timestamp_history
2007-12-09 05:15:24 +01:00
udp_socket
2007-04-17 02:23:46 +02:00
upnp
2012-03-20 04:53:07 +01:00
utf8
2010-11-29 02:33:05 +01:00
utp_socket_manager
utp_stream
2007-04-17 02:23:46 +02:00
file_pool
lsd
2007-09-10 01:52:34 +02:00
enum_net
broadcast_socket
2007-12-03 07:03:16 +01:00
magnet_uri
2008-05-17 16:19:34 +02:00
parse_url
2008-11-13 07:39:08 +01:00
ConvertUTF
2014-05-03 23:10:44 +02:00
xml_parse
2015-11-11 06:57:51 +01:00
version
2014-07-06 21:18:00 +02:00
peer_class
peer_class_set
part_file
stat_cache
request_blocks
session_stats
performance_counters
resolver
2015-01-06 09:08:49 +01:00
session_settings
2015-08-25 04:18:10 +02:00
proxy_settings
2015-06-29 04:47:11 +02:00
file_progress
2016-08-05 21:51:37 +02:00
ffs
2017-06-07 16:41:28 +02:00
add_torrent_params
2017-07-16 20:26:00 +02:00
peer_info
2017-07-23 17:13:07 +02:00
stack_allocator
2018-07-23 09:56:09 +02:00
generate_peer_id
2007-12-18 07:04:54 +01:00
# -- extensions --
ut_pex
ut_metadata
smart_ban
2006-09-01 05:06:00 +02:00
;
2006-08-01 17:27:08 +02:00
2006-09-01 05:06:00 +02:00
KADEMLIA_SOURCES =
2016-09-17 15:42:04 +02:00
dht_state
2015-09-08 22:12:54 +02:00
dht_storage
2009-04-03 01:21:44 +02:00
dht_tracker
2015-12-06 02:27:01 +01:00
msg
2009-04-03 01:21:44 +02:00
node
2015-03-16 05:38:28 +01:00
node_entry
2009-04-03 01:21:44 +02:00
refresh
rpc_manager
find_data
node_id
routing_table
traversal_algorithm
2014-07-06 21:18:00 +02:00
dos_blocker
2013-12-27 05:28:25 +01:00
get_peers
item
get_item
2015-09-22 20:10:57 +02:00
put_data
2016-08-30 02:28:42 +02:00
ed25519
2017-06-12 11:54:11 +02:00
sample_infohashes
2017-09-02 23:58:10 +02:00
dht_settings
2004-02-21 12:52:21 +01:00
;
2004-02-08 17:04:50 +01:00
2013-08-18 18:01:20 +02:00
ED25519_SOURCES =
add_scalar
fe
ge
key_exchange
keypair
sc
sign
verify
;
2015-05-18 01:32:13 +02:00
local usage-requirements =
2006-09-01 05:06:00 +02:00
<include>./include
2008-05-20 11:45:55 +02:00
<include>./include/libtorrent
2009-01-27 09:24:48 +01:00
<include>/usr/sfw/include
2012-05-13 06:40:21 +02:00
# freebsd doesn't seem to include this automatically
# and iconv.h is installed there
<include>/usr/local/include
2006-09-01 05:06:00 +02:00
<variant>release:<define>NDEBUG
<define>_FILE_OFFSET_BITS=64
2010-11-29 02:33:05 +01:00
# enable cancel support in asio
<define>BOOST_ASIO_ENABLE_CANCELIO
2016-05-01 02:09:02 +02:00
# make sure asio uses std::chrono
<define>BOOST_ASIO_HAS_STD_CHRONO
2007-06-13 19:36:26 +02:00
<conditional>@linking
2019-03-24 22:14:35 +01:00
<conditional>@sanitizer-options
2007-09-01 06:08:39 +02:00
# msvc optimizations
2018-04-30 16:59:12 +02:00
<toolset>msvc,<variant>release:<linkflags>"/OPT:ICF=5"
<toolset>msvc,<variant>release:<linkflags>"/OPT:REF"
2015-04-18 04:33:39 +02:00
2016-05-17 15:24:06 +02:00
# disable bogus deprecation warnings on msvc8
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
2015-08-09 01:18:05 +02:00
<cxxflags>$(CXXFLAGS)
<linkflags>$(LDFLAGS)
2006-09-01 05:06:00 +02:00
;
2008-06-23 15:17:15 +02:00
project torrent ;
2007-06-13 19:36:26 +02:00
2008-06-23 15:17:15 +02:00
lib torrent
2007-06-13 03:48:24 +02:00
: # sources
2007-04-17 02:23:46 +02:00
src/$(SOURCES).cpp
2007-06-13 03:48:24 +02:00
: # requirements
2013-08-18 18:01:20 +02:00
<include>./ed25519/src
2007-06-13 03:48:24 +02:00
<threading>multi
2015-04-26 02:51:44 +02:00
<define>TORRENT_BUILDING_LIBRARY
2007-06-13 03:48:24 +02:00
<link>shared:<define>TORRENT_BUILDING_SHARED
2014-07-06 21:18:00 +02:00
<define>BOOST_NO_DEPRECATED
2012-06-12 18:38:15 +02:00
<link>shared:<define>BOOST_SYSTEM_SOURCE
2012-04-15 06:00:58 +02:00
2013-04-09 03:04:43 +02:00
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
2014-07-12 08:20:16 +02:00
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
2016-08-26 01:07:16 +02:00
<dht>on:<source>src/hasher512.cpp
2019-02-12 11:26:05 +01:00
<dht>on:<source>src/sha512.cpp
2013-08-18 18:01:20 +02:00
2007-06-13 19:36:26 +02:00
<conditional>@building
2015-04-18 04:33:39 +02:00
<conditional>@warnings
2015-08-09 01:18:05 +02:00
<cxxflags>$(CXXFLAGS)
2012-02-16 07:14:19 +01:00
2015-10-08 03:41:40 +02:00
<tag>@tag
2007-06-13 03:48:24 +02:00
$(usage-requirements)
: # default build
2008-12-28 20:15:24 +01:00
<threading>multi
2017-04-23 02:19:34 +02:00
<c++-template-depth>512
2007-06-13 03:48:24 +02:00
: # usage requirements
$(usage-requirements)
2012-06-03 07:13:08 +02:00
<link>shared:<define>TORRENT_LINKING_SHARED
2016-07-03 17:42:57 +02:00
2003-10-23 01:00:57 +02:00
;
2009-04-03 01:21:44 +02:00
headers = [ path.glob-tree include/libtorrent : *.hpp ] ;
package.install install
2015-10-11 01:04:13 +02:00
: <install-source-root>libtorrent
2015-05-18 01:32:13 +02:00
:
: torrent
: $(headers)
;
2019-05-12 02:28:48 +02:00
local header_targets ;
for local target in $(headers)
{
if ! [ path.basename $(target) ] in windows.hpp win_util.hpp win_crypto_provider.hpp torrent_impl.hpp cppint_import_export.hpp
{
# this cast tells boost build that the header files really *are* cpp files
# otherwise the object rule doesn't know which language to interpret them as
obj header-build/$(target).o : [ cast.cast _ cpp : $(target) ]
: <library>/torrent <cxxflags>-fsyntax-only ;
explicit header-build/$(target).o ;
header_targets += $(target) ;
}
}
alias check-headers : header-build/$(header_targets).o ;
explicit check-headers ;