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:
Arvid Norberg 2007-06-13 01:48:24 +00:00
parent 5b5f3b3ca2
commit fa1a37e649
8 changed files with 120 additions and 74 deletions

137
Jamfile
View File

@ -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 modules ;
import os ; import os ;
import errors ; import errors ;
import feature : feature ; import feature : feature ;
#import pch ;
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
@ -19,6 +19,45 @@ if ! $(BOOST_ROOT)
use-project /boost : $(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 logging : none default verbose : composite propagated symmetric link-incompatible ;
feature.compose <logging>default : <define>TORRENT_LOGGING ; 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>off : <define>TORRENT_DISABLE_DHT ;
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ; feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
feature pe-support : on off : composite propagated symmetric ; feature openssl : pe sha-1 off : composite propagated symmetric link-incompatible ;
feature.compose <pe-support>on : ; feature.compose <openssl>pe : <define>TORRENT_USE_OPENSSL ;
feature.compose <pe-support>off : <define>TORRENT_DISABLE_ENCRYPTION ; feature.compose <openssl>sha-1 : <define>TORRENT_USE_OPENSSL <define>TORRENT_DISABLE_ENCRYPTION ;
feature.compose <openssl>off : <define>TORRENT_DISABLE_ENCRYPTION ;
feature openssl : off on : composite propagated symmetric link-incompatible ;
feature.compose <openssl>on : <define>TORRENT_USE_OPENSSL ;
feature resolve-countries : on off : composite propagated symmetric link-incompatible ; feature resolve-countries : on off : composite propagated symmetric link-incompatible ;
feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ; 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 character-set : ansi unicode : composite propagated link-incompatible ;
feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ; 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 statistics : off on : composite propagated symmetric link-incompatible ;
feature.compose <statistics>on : <define>TORRENT_STATS ; 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 upnp-logging : off on : composite propagated link-incompatible ;
feature.compose <upnp-logging>on : <define>TORRENT_UPNP_LOGGING ; 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 = SOURCES =
allocate_resources allocate_resources
alert alert
@ -116,18 +160,19 @@ ZLIB_SOURCES =
zutil zutil
; ;
DEFINES = ; local defines ;
LIBS = ; local libs ;
if [ os.name ] = CYGWIN || [ os.name ] = NT if [ os.name ] = CYGWIN || [ os.name ] = NT
{ {
lib wsock32 : : <name>wsock32 ; lib wsock32 : : <name>wsock32 ;
lib ws2_32 : : <name>ws2_32 ; lib ws2_32 : : <name>ws2_32 ;
LIBS += ws2_32 wsock32 ; libs += ws2_32 wsock32 ;
DEFINES += WIN32_LEAN_AND_MEAN ; defines += WIN32_LEAN_AND_MEAN ;
DEFINES += _WIN32_WINNT=0x0500 ; defines += _WIN32_WINNT=0x0500 ;
DEFINES += __USE_W32_SOCKETS ; defines += __USE_W32_SOCKETS ;
DEFINES += WIN32 ; defines += WIN32 ;
defines += _WIN32 ;
SOURCES += file_win ; SOURCES += file_win ;
} }
else else
@ -135,12 +180,7 @@ else
SOURCES += file ; SOURCES += file ;
} }
lib crypt : : <name>crypto ; local usage-requirements =
project torrent
: requirements
<include>./include <include>./include
<include>./include/libtorrent <include>./include/libtorrent
<zlib>shipped:<include>./zlib <zlib>shipped:<include>./zlib
@ -148,54 +188,39 @@ project torrent
<variant>release:<define>NDEBUG <variant>release:<define>NDEBUG
<define>BOOST_ALL_NO_LIB <define>BOOST_ALL_NO_LIB
<define>_FILE_OFFSET_BITS=64 <define>_FILE_OFFSET_BITS=64
<define>BOOST_THREAD_USE_LIB <define>$(defines)
<define>$(DEFINES)
<library>/boost/thread//boost_thread #/<link>static <library>/boost/thread//boost_thread #/<link>static
<library>/boost/filesystem//boost_filesystem #/<link>static <library>/boost/filesystem//boost_filesystem #/<link>static
<threading>multi <conditional>@link-openssl
<zlib>system:<library>zlib-target
# ======= compiler settings =======
# these compiler settings just makes the compiler standard conforming # these compiler settings just makes the compiler standard conforming
<toolset>msvc:<cxxflags>/Zc:wchar_t <toolset>msvc:<cxxflags>/Zc:wchar_t
<toolset>msvc:<cxxflags>/Zc:forScope <toolset>msvc:<cxxflags>/Zc:forScope
# disable bogus deprecation warnings on msvc8 # disable bogus deprecation warnings on msvc8
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_CRT_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 lib torrent
:
: # sources
src/$(SOURCES).cpp src/$(SOURCES).cpp
$(LIBS) $(libs)
# pch
: : # requirements
<define>BOOST_THREAD_USE_LIB
<threading>multi
<link>shared:<define>TORRENT_BUILDING_SHARED
<dht-support>on:<source>src/$(KADEMLIA_SOURCES).cpp <dht-support>on:<source>src/$(KADEMLIA_SOURCES).cpp
<dht-support>logging:<source>src/$(KADEMLIA_SOURCES).cpp <dht-support>logging:<source>src/$(KADEMLIA_SOURCES).cpp
<zlib>shipped:<source>zlib/$(ZLIB_SOURCES).c <zlib>shipped:<source>zlib/$(ZLIB_SOURCES).c
<zlib>system:<library>z <conditional>@use-openssl
<pe-support>on:<source>src/pe_crypto.cpp $(usage-requirements)
<pe-support>on:<library>crypt
<openssl>on:<library>crypt : # default build
<openssl>off,<pe-support>off:<source>src/sha1.cpp <link>static
: # usage requirements
$(usage-requirements)
; ;

View File

@ -213,10 +213,16 @@ Build features:
| | * ``shipped`` - links against the zlib bundled | | | * ``shipped`` - links against the zlib bundled |
| | with the libtorrent package. | | | with the libtorrent package. |
+------------------------+----------------------------------------------------+ +------------------------+----------------------------------------------------+
| ``pe-support`` | * ``on`` - turns on support for encrypted | | ``openssl`` | * ``pe`` - turns on support for encrypted |
| | connections. requires openssl (libcrypto) | | | 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 | | | * ``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 | | ``link`` | * ``static`` - builds libtorrent as a static |
| | library (.a / .lib) | | | library (.a / .lib) |
@ -236,14 +242,6 @@ Build features:
| | * ``profile`` - builds libtorrent with profile | | | * ``profile`` - builds libtorrent with profile |
| | information. | | | 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. | | ``character-set`` | This setting will only have an affect on windows. |
| | Other platforms are expected to support UTF-8. | | | Other platforms are expected to support UTF-8. |
| | | | | |

View File

@ -6,7 +6,10 @@ use-project /torrent : .. ;
use-project /boost : $(BOOST_ROOT) ; use-project /boost : $(BOOST_ROOT) ;
project client_test 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 ; 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 dump_torrent : dump_torrent.cpp ;
exe make_torrent : make_torrent.cpp ; exe make_torrent : make_torrent.cpp ;
#stage . : dump_torrent make_torrent simple_client client_test ;

View File

@ -7,6 +7,7 @@ libtorrent/buffer.hpp \
libtorrent/connection_queue.hpp \ libtorrent/connection_queue.hpp \
libtorrent/config.hpp \ libtorrent/config.hpp \
libtorrent/debug.hpp \ libtorrent/debug.hpp \
libtorrent/disk_io_thread.hpp \
libtorrent/entry.hpp \ libtorrent/entry.hpp \
libtorrent/escape_string.hpp \ libtorrent/escape_string.hpp \
libtorrent/extensions.hpp \ libtorrent/extensions.hpp \
@ -19,6 +20,7 @@ libtorrent/http_stream.hpp \
libtorrent/http_tracker_connection.hpp \ libtorrent/http_tracker_connection.hpp \
libtorrent/identify_client.hpp \ libtorrent/identify_client.hpp \
libtorrent/instantiate_connection.hpp \ libtorrent/instantiate_connection.hpp \
libtorrent/intrusive_ptr_base.hpp \
libtorrent/invariant_check.hpp \ libtorrent/invariant_check.hpp \
libtorrent/io.hpp \ libtorrent/io.hpp \
libtorrent/ip_filter.hpp \ libtorrent/ip_filter.hpp \

View File

@ -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 \ 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 \ 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 \ socks5_stream.cpp socks4_stream.cpp http_stream.cpp connection_queue.cpp \
disk_io_thread.cpp \
$(kademlia_sources) $(kademlia_sources)
noinst_HEADERS = \ noinst_HEADERS = \
@ -35,6 +36,7 @@ $(top_srcdir)/include/libtorrent/bencode.hpp \
$(top_srcdir)/include/libtorrent/buffer.hpp \ $(top_srcdir)/include/libtorrent/buffer.hpp \
$(top_srcdir)/include/libtorrent/connection_queue.hpp \ $(top_srcdir)/include/libtorrent/connection_queue.hpp \
$(top_srcdir)/include/libtorrent/debug.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/entry.hpp \
$(top_srcdir)/include/libtorrent/escape_string.hpp \ $(top_srcdir)/include/libtorrent/escape_string.hpp \
$(top_srcdir)/include/libtorrent/extensions.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/http_tracker_connection.hpp \
$(top_srcdir)/include/libtorrent/identify_client.hpp \ $(top_srcdir)/include/libtorrent/identify_client.hpp \
$(top_srcdir)/include/libtorrent/instantiate_connection.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/invariant_check.hpp \
$(top_srcdir)/include/libtorrent/io.hpp \ $(top_srcdir)/include/libtorrent/io.hpp \
$(top_srcdir)/include/libtorrent/ip_filter.hpp \ $(top_srcdir)/include/libtorrent/ip_filter.hpp \

View File

@ -1,13 +1,15 @@
use-project /torrent : .. ; 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 project
: : requirements
requirements <threading>multi <threading>multi
<library>/torrent <library>/torrent//torrent
<source>main.cpp <source>main.cpp
<source>setup_transfer.cpp <source>setup_transfer.cpp
: default-build
<link>static
; ;
test-suite libtorrent : test-suite libtorrent :

View File

@ -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_SOURCES = main.cpp test_piece_picker.cpp
test_piece_picker_LDADD = $(top_builddir)/src/libtorrent.la 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_storage_LDADD = $(top_builddir)/src/libtorrent.la
test_buffer_SOURCES = main.cpp test_buffer.cpp 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_SOURCES = main.cpp setup_transfer.cpp test_metadata_extension.cpp
test_metadata_extension_LDADD = $(top_builddir)/src/libtorrent.la 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_SOURCES = main.cpp test_pe_crypto.cpp
test_pe_crypto_LDADD = $(top_builddir)/src/libtorrent.la $(top_builddir)/test/setup_transfer.o test_pe_crypto_LDADD = $(top_builddir)/src/libtorrent.la $(top_builddir)/test/setup_transfer.o

View File

@ -40,6 +40,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "setup_transfer.hpp" #include "setup_transfer.hpp"
#include "test.hpp" #include "test.hpp"
#ifndef TORRENT_DISABLE_ENCRYPTION
void display_pe_policy(libtorrent::pe_settings::enc_policy policy) void display_pe_policy(libtorrent::pe_settings::enc_policy policy)
{ {
using namespace libtorrent; using namespace libtorrent;
@ -193,3 +195,13 @@ int test_main()
return 0; return 0;
} }
#else
int test_main()
{
std::cerr << "PE test not run because it's disabled" << std::endl;
return 0;
}
#endif