forked from premiere/premiere-libtorrent
updated Jamfile to support openssl on windows, added missing files to makefiles and made test_pe_crypto build when encryption is disabled
This commit is contained in:
parent
5b5f3b3ca2
commit
fa1a37e649
137
Jamfile
137
Jamfile
|
@ -1,10 +1,10 @@
|
|||
#This Jamfile requires boost-build v2 to build.
|
||||
# This Jamfile requires boost-build v2 to build.
|
||||
# The version shipped with boost 1.34.0
|
||||
|
||||
import modules ;
|
||||
import os ;
|
||||
import errors ;
|
||||
import feature : feature ;
|
||||
#import pch ;
|
||||
|
||||
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
|
||||
|
||||
|
@ -19,6 +19,45 @@ if ! $(BOOST_ROOT)
|
|||
|
||||
use-project /boost : $(BOOST_ROOT) ;
|
||||
|
||||
# rule for linking the correct library when using openssl
|
||||
rule link-openssl ( properties * )
|
||||
{
|
||||
local result ;
|
||||
|
||||
if <openssl>sha-1 in $(properties) || <openssl>pe in $(properties)
|
||||
{
|
||||
if [ os.name ] = NT
|
||||
{
|
||||
result += <library>ssleay <library>libeay ;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += <library>crypto ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
# rule for adding the right source files when using openssl and/or PE
|
||||
rule use-openssl ( properties * )
|
||||
{
|
||||
local result ;
|
||||
|
||||
if <openssl>off in $(properties)
|
||||
{
|
||||
result += <source>src/sha1.cpp ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if <openssl>pe in $(properties)
|
||||
{
|
||||
result += <source>src/pe_crypto.cpp ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
feature logging : none default verbose : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <logging>default : <define>TORRENT_LOGGING ;
|
||||
|
@ -28,12 +67,10 @@ feature dht-support : on off logging : composite propagated symmetric link-incom
|
|||
feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
|
||||
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
|
||||
|
||||
feature pe-support : on off : composite propagated symmetric ;
|
||||
feature.compose <pe-support>on : ;
|
||||
feature.compose <pe-support>off : <define>TORRENT_DISABLE_ENCRYPTION ;
|
||||
|
||||
feature openssl : off on : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <openssl>on : <define>TORRENT_USE_OPENSSL ;
|
||||
feature openssl : pe sha-1 off : composite propagated symmetric 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 symmetric link-incompatible ;
|
||||
feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ;
|
||||
|
@ -41,7 +78,9 @@ feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRI
|
|||
feature character-set : ansi unicode : composite propagated link-incompatible ;
|
||||
feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ;
|
||||
|
||||
feature zlib : shipped system : composite ;
|
||||
feature zlib : shipped system : composite propagated link-incompatible ;
|
||||
feature.compose <zlib>shipped : ;
|
||||
feature.compose <zlib>system : ;
|
||||
|
||||
feature statistics : off on : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <statistics>on : <define>TORRENT_STATS ;
|
||||
|
@ -49,6 +88,11 @@ 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 ;
|
||||
|
||||
lib ssleay : : <name>ssleay32 ;
|
||||
lib libeay : : <name>libeay32 ;
|
||||
lib crypto : : <name>crypto ;
|
||||
lib zlib-target : : <name>z ;
|
||||
|
||||
SOURCES =
|
||||
allocate_resources
|
||||
alert
|
||||
|
@ -116,18 +160,19 @@ ZLIB_SOURCES =
|
|||
zutil
|
||||
;
|
||||
|
||||
DEFINES = ;
|
||||
LIBS = ;
|
||||
local defines ;
|
||||
local libs ;
|
||||
|
||||
if [ os.name ] = CYGWIN || [ os.name ] = NT
|
||||
{
|
||||
lib wsock32 : : <name>wsock32 ;
|
||||
lib ws2_32 : : <name>ws2_32 ;
|
||||
LIBS += ws2_32 wsock32 ;
|
||||
DEFINES += WIN32_LEAN_AND_MEAN ;
|
||||
DEFINES += _WIN32_WINNT=0x0500 ;
|
||||
DEFINES += __USE_W32_SOCKETS ;
|
||||
DEFINES += WIN32 ;
|
||||
libs += ws2_32 wsock32 ;
|
||||
defines += WIN32_LEAN_AND_MEAN ;
|
||||
defines += _WIN32_WINNT=0x0500 ;
|
||||
defines += __USE_W32_SOCKETS ;
|
||||
defines += WIN32 ;
|
||||
defines += _WIN32 ;
|
||||
SOURCES += file_win ;
|
||||
}
|
||||
else
|
||||
|
@ -135,12 +180,7 @@ else
|
|||
SOURCES += file ;
|
||||
}
|
||||
|
||||
lib crypt : : <name>crypto ;
|
||||
|
||||
project torrent
|
||||
|
||||
: requirements
|
||||
|
||||
local usage-requirements =
|
||||
<include>./include
|
||||
<include>./include/libtorrent
|
||||
<zlib>shipped:<include>./zlib
|
||||
|
@ -148,54 +188,39 @@ project torrent
|
|||
<variant>release:<define>NDEBUG
|
||||
<define>BOOST_ALL_NO_LIB
|
||||
<define>_FILE_OFFSET_BITS=64
|
||||
<define>BOOST_THREAD_USE_LIB
|
||||
<define>$(DEFINES)
|
||||
<define>$(defines)
|
||||
<library>/boost/thread//boost_thread #/<link>static
|
||||
<library>/boost/filesystem//boost_filesystem #/<link>static
|
||||
<threading>multi
|
||||
|
||||
# ======= compiler settings =======
|
||||
|
||||
<conditional>@link-openssl
|
||||
<zlib>system:<library>zlib-target
|
||||
# these compiler settings just makes the compiler standard conforming
|
||||
<toolset>msvc:<cxxflags>/Zc:wchar_t
|
||||
<toolset>msvc:<cxxflags>/Zc:forScope
|
||||
# disable bogus deprecation warnings on msvc8
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
# this should be defined when libtorrent is built as
|
||||
# a dll. It will make sure the functions and classes
|
||||
# are exported (GCC 4 and msvc)
|
||||
<link>shared:<define>TORRENT_BUILDING_SHARED
|
||||
|
||||
<link>shared:<define>TORRENT_LINKING_SHARED
|
||||
|
||||
: usage-requirements
|
||||
|
||||
<include>./include
|
||||
<include>./include/libtorrent
|
||||
<include>$(BOOST_ROOT)
|
||||
<variant>release:<define>NDEBUG
|
||||
<define>BOOST_ALL_NO_LIB
|
||||
<define>$(DEFINES)
|
||||
<link>shared:<define>TORRENT_LINKING_SHARED
|
||||
;
|
||||
|
||||
#cpp-pch pch : include/libtorrent/pch.hpp ;
|
||||
|
||||
lib torrent
|
||||
:
|
||||
|
||||
: # sources
|
||||
src/$(SOURCES).cpp
|
||||
$(LIBS)
|
||||
# pch
|
||||
:
|
||||
$(libs)
|
||||
|
||||
: # requirements
|
||||
<define>BOOST_THREAD_USE_LIB
|
||||
<threading>multi
|
||||
<link>shared:<define>TORRENT_BUILDING_SHARED
|
||||
<dht-support>on:<source>src/$(KADEMLIA_SOURCES).cpp
|
||||
<dht-support>logging:<source>src/$(KADEMLIA_SOURCES).cpp
|
||||
<zlib>shipped:<source>zlib/$(ZLIB_SOURCES).c
|
||||
<zlib>system:<library>z
|
||||
<pe-support>on:<source>src/pe_crypto.cpp
|
||||
<pe-support>on:<library>crypt
|
||||
<openssl>on:<library>crypt
|
||||
<openssl>off,<pe-support>off:<source>src/sha1.cpp
|
||||
<conditional>@use-openssl
|
||||
$(usage-requirements)
|
||||
|
||||
: # default build
|
||||
<link>static
|
||||
|
||||
: # usage requirements
|
||||
$(usage-requirements)
|
||||
;
|
||||
|
||||
|
|
|
@ -213,10 +213,16 @@ Build features:
|
|||
| | * ``shipped`` - links against the zlib bundled |
|
||||
| | with the libtorrent package. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
| ``pe-support`` | * ``on`` - turns on support for encrypted |
|
||||
| ``openssl`` | * ``pe`` - turns on support for encrypted |
|
||||
| | connections. requires openssl (libcrypto) |
|
||||
| | * ``sha-1`` - openssl will be used instead of the |
|
||||
| | public domain SHA-1 implementation shipped with |
|
||||
| | libtorrent. ``libcrypto.a`` will be required for |
|
||||
| | linking. Encryption support is still turned off. |
|
||||
| | * ``off`` - turns off support for encrypted |
|
||||
| | connections. openssl is not linked in. |
|
||||
| | connections. openssl is not linked in. The |
|
||||
| | shipped public domain SHA-1 implementation is |
|
||||
| | used. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
| ``link`` | * ``static`` - builds libtorrent as a static |
|
||||
| | library (.a / .lib) |
|
||||
|
@ -236,14 +242,6 @@ Build features:
|
|||
| | * ``profile`` - builds libtorrent with profile |
|
||||
| | information. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
| ``openssl`` | * ``on`` - openssl will be used instead of the |
|
||||
| | public domain SHA-1 implementation shipped with |
|
||||
| | libtorrent. ``crypto.lib`` or ``libcrypto.a`` |
|
||||
| | will be required for linking. |
|
||||
| | * ``off`` - the shipped SHA-1 implementation will |
|
||||
| | be used, and there will be no dependency on |
|
||||
| | openssl. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
| ``character-set`` | This setting will only have an affect on windows. |
|
||||
| | Other platforms are expected to support UTF-8. |
|
||||
| | |
|
||||
|
|
|
@ -6,7 +6,10 @@ use-project /torrent : .. ;
|
|||
use-project /boost : $(BOOST_ROOT) ;
|
||||
|
||||
project client_test
|
||||
: requirements <threading>multi <library>/torrent
|
||||
: requirements
|
||||
<threading>multi <library>/torrent//torrent
|
||||
: default-build
|
||||
<link>static
|
||||
;
|
||||
|
||||
exe client_test : client_test.cpp /boost/program_options /boost/regex ;
|
||||
|
@ -14,5 +17,3 @@ exe simple_client : simple_client.cpp ;
|
|||
exe dump_torrent : dump_torrent.cpp ;
|
||||
exe make_torrent : make_torrent.cpp ;
|
||||
|
||||
#stage . : dump_torrent make_torrent simple_client client_test ;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ libtorrent/buffer.hpp \
|
|||
libtorrent/connection_queue.hpp \
|
||||
libtorrent/config.hpp \
|
||||
libtorrent/debug.hpp \
|
||||
libtorrent/disk_io_thread.hpp \
|
||||
libtorrent/entry.hpp \
|
||||
libtorrent/escape_string.hpp \
|
||||
libtorrent/extensions.hpp \
|
||||
|
@ -19,6 +20,7 @@ libtorrent/http_stream.hpp \
|
|||
libtorrent/http_tracker_connection.hpp \
|
||||
libtorrent/identify_client.hpp \
|
||||
libtorrent/instantiate_connection.hpp \
|
||||
libtorrent/intrusive_ptr_base.hpp \
|
||||
libtorrent/invariant_check.hpp \
|
||||
libtorrent/io.hpp \
|
||||
libtorrent/ip_filter.hpp \
|
||||
|
|
|
@ -22,6 +22,7 @@ http_tracker_connection.cpp udp_tracker_connection.cpp \
|
|||
alert.cpp identify_client.cpp ip_filter.cpp file.cpp metadata_transfer.cpp \
|
||||
logger.cpp file_pool.cpp ut_pex.cpp lsd.cpp upnp.cpp instantiate_connection.cpp \
|
||||
socks5_stream.cpp socks4_stream.cpp http_stream.cpp connection_queue.cpp \
|
||||
disk_io_thread.cpp \
|
||||
$(kademlia_sources)
|
||||
|
||||
noinst_HEADERS = \
|
||||
|
@ -35,6 +36,7 @@ $(top_srcdir)/include/libtorrent/bencode.hpp \
|
|||
$(top_srcdir)/include/libtorrent/buffer.hpp \
|
||||
$(top_srcdir)/include/libtorrent/connection_queue.hpp \
|
||||
$(top_srcdir)/include/libtorrent/debug.hpp \
|
||||
$(top_srcdir)/include/libtorrent/disk_io_thread.hpp \
|
||||
$(top_srcdir)/include/libtorrent/entry.hpp \
|
||||
$(top_srcdir)/include/libtorrent/escape_string.hpp \
|
||||
$(top_srcdir)/include/libtorrent/extensions.hpp \
|
||||
|
@ -51,6 +53,7 @@ $(top_srcdir)/include/libtorrent/session_settings.hpp \
|
|||
$(top_srcdir)/include/libtorrent/http_tracker_connection.hpp \
|
||||
$(top_srcdir)/include/libtorrent/identify_client.hpp \
|
||||
$(top_srcdir)/include/libtorrent/instantiate_connection.hpp \
|
||||
$(top_srcdir)/include/libtorrent/intrusive_ptr_base.hpp \
|
||||
$(top_srcdir)/include/libtorrent/invariant_check.hpp \
|
||||
$(top_srcdir)/include/libtorrent/io.hpp \
|
||||
$(top_srcdir)/include/libtorrent/ip_filter.hpp \
|
||||
|
|
10
test/Jamfile
10
test/Jamfile
|
@ -1,13 +1,15 @@
|
|||
use-project /torrent : .. ;
|
||||
|
||||
exe test_upnp : test_upnp.cpp /torrent : <threading>multi <logging>verbose <upnp-logging>on ;
|
||||
exe test_upnp : test_upnp.cpp /torrent//torrent : <threading>multi <logging>verbose <upnp-logging>on ;
|
||||
|
||||
project
|
||||
:
|
||||
requirements <threading>multi
|
||||
<library>/torrent
|
||||
: requirements
|
||||
<threading>multi
|
||||
<library>/torrent//torrent
|
||||
<source>main.cpp
|
||||
<source>setup_transfer.cpp
|
||||
: default-build
|
||||
<link>static
|
||||
;
|
||||
|
||||
test-suite libtorrent :
|
||||
|
|
|
@ -13,7 +13,7 @@ test_ip_filter_LDADD = $(top_builddir)/src/libtorrent.la
|
|||
test_piece_picker_SOURCES = main.cpp test_piece_picker.cpp
|
||||
test_piece_picker_LDADD = $(top_builddir)/src/libtorrent.la
|
||||
|
||||
test_storage_SOURCES = main.cpp test_storage.cpp
|
||||
test_storage_SOURCES = main.cpp setup_transfer.cpp test_storage.cpp
|
||||
test_storage_LDADD = $(top_builddir)/src/libtorrent.la
|
||||
|
||||
test_buffer_SOURCES = main.cpp test_buffer.cpp
|
||||
|
@ -25,6 +25,9 @@ test_allocate_resources_LDADD = $(top_builddir)/src/libtorrent.la
|
|||
test_metadata_extension_SOURCES = main.cpp setup_transfer.cpp test_metadata_extension.cpp
|
||||
test_metadata_extension_LDADD = $(top_builddir)/src/libtorrent.la
|
||||
|
||||
test_swarm_SOURCES = main.cpp setup_transfer.cpp test_swarm.cpp
|
||||
test_swarm_LDADD = $(top_builddir)/src/libtorrent.la
|
||||
|
||||
test_pe_crypto_SOURCES = main.cpp test_pe_crypto.cpp
|
||||
test_pe_crypto_LDADD = $(top_builddir)/src/libtorrent.la $(top_builddir)/test/setup_transfer.o
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "setup_transfer.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
|
||||
void display_pe_policy(libtorrent::pe_settings::enc_policy policy)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -193,3 +195,13 @@ int test_main()
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int test_main()
|
||||
{
|
||||
std::cerr << "PE test not run because it's disabled" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue