add boost-build feature to link against libcrypto and libssl on windows #1931

This commit is contained in:
arvidn 2017-07-12 00:34:48 -07:00 committed by Arvid Norberg
parent cc30434c52
commit ec65e12ee6
3 changed files with 35 additions and 14 deletions

29
Jamfile
View File

@ -67,27 +67,38 @@ rule linking ( properties * )
local result ; local result ;
# openssl libraries, if enabled # openssl libraries, if enabled
# exclude gcc from a regular windows build to make mingw
# link against the regular unix library name
if <crypto>openssl in $(properties) if <crypto>openssl in $(properties)
{ {
# exclude gcc from a regular windows build to make mingw if <openssl-version>pre1.1 in $(properties)
# link against the regular unix library name && <target-os>windows in $(properties)
if <target-os>windows in $(properties) && ! <toolset>gcc in $(properties)
&& ! <toolset>gcc in $(properties)
{ {
result += <library>ssleay32 result += <library>ssleay32
<library>libeay32 <library>libeay32
<library>advapi32
<library>user32
<library>shell32
<library>gdi32
; ;
} }
else else
{ {
# on windows the library names were changed to be in line with other
# system starting with OpenSSL 1.1
result += <library>crypto <library>ssl ; result += <library>crypto <library>ssl ;
} }
} }
# windows needs some more libraries when using openSSL
if <crypto>openssl in $(properties)
&& <target-os>windows in $(properties)
&& ! <toolset>gcc in $(properties)
{
result += <library>advapi32
<library>user32
<library>shell32
<library>gdi32
;
}
if <simulator>on in $(properties) if <simulator>on in $(properties)
{ {
result += <library>/libsimulator//simulator ; result += <library>/libsimulator//simulator ;
@ -471,6 +482,8 @@ feature crypto : built-in openssl gcrypt : composite propagated ;
feature.compose <crypto>openssl : <define>TORRENT_USE_OPENSSL ; feature.compose <crypto>openssl : <define>TORRENT_USE_OPENSSL ;
feature.compose <crypto>gcrypt : <define>TORRENT_USE_GCRYPT ; feature.compose <crypto>gcrypt : <define>TORRENT_USE_GCRYPT ;
feature openssl-version : 1.1 pre1.1 : composite propagated ;
feature resolve-countries : on off : composite propagated link-incompatible ; feature resolve-countries : on off : composite propagated link-incompatible ;
feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ; feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ;

View File

@ -117,12 +117,12 @@ build_script:
- if not defined x64 ( - if not defined x64 (
cd %ROOT_DIRECTORY%\examples cd %ROOT_DIRECTORY%\examples
& if %compiler% == msvc-14.0 ( & if %compiler% == msvc-14.0 (
b2.exe --hash -j2 address-model=32 %compiler% variant=%variant% debug-iterators=on picker-debugging=on invariant-checks=full linkflags=%linkflags% include=%include% link=shared bt-get bt-get2 b2.exe --hash -j2 openssl-version=pre1.1 address-model=32 %compiler% variant=%variant% debug-iterators=on picker-debugging=on invariant-checks=full linkflags=%linkflags% include=%include% link=shared bt-get bt-get2
) else ( ) else (
b2.exe --hash -j2 address-model=32 %compiler% variant=%variant% debug-iterators=on picker-debugging=on invariant-checks=full linkflags=%linkflags% include=%include% link=shared b2.exe --hash -j2 openssl-version=pre1.1 address-model=32 %compiler% variant=%variant% debug-iterators=on picker-debugging=on invariant-checks=full linkflags=%linkflags% include=%include% link=shared
) )
& cd %ROOT_DIRECTORY%\bindings\python & cd %ROOT_DIRECTORY%\bindings\python
& b2.exe --hash -j2 %compiler% stage_module install-dependencies=on variant=%variant% libtorrent-link=shared linkflags=%linkflags% include=%include% & b2.exe --hash -j2 openssl-version=pre1.1 %compiler% stage_module install-dependencies=on variant=%variant% libtorrent-link=shared linkflags=%linkflags% include=%include%
& python test.py & python test.py
& if defined python_package ( python setup.py --bjam bdist_msi ) & if defined python_package ( python setup.py --bjam bdist_msi )
) )
@ -130,13 +130,13 @@ build_script:
test_script: test_script:
- cd %ROOT_DIRECTORY%\test - cd %ROOT_DIRECTORY%\test
- if defined x64 ( - if defined x64 (
appveyor-retry b2.exe --hash -j2 address-model=64 win-tests %compiler% variant=%variant% link=shared linkflags=%linkflags% include=%include% appveyor-retry b2.exe --hash -j2 openssl-version=pre1.1 address-model=64 win-tests %compiler% variant=%variant% link=shared linkflags=%linkflags% include=%include%
) else ( ) else (
appveyor-retry b2.exe --hash -j2 address-model=32 win-tests %compiler% variant=%variant% link=shared linkflags=%linkflags% include=%include% appveyor-retry b2.exe --hash -j2 openssl-version=pre1.1 address-model=32 win-tests %compiler% variant=%variant% link=shared linkflags=%linkflags% include=%include%
) )
- if defined sim ( - if defined sim (
cd %ROOT_DIRECTORY%\simulation cd %ROOT_DIRECTORY%\simulation
& b2.exe --hash -j2 link=shared crypto=built-in %compiler% & b2.exe --hash -j2 openssl-version=pre1.1 link=shared crypto=built-in %compiler%
) )
artifacts: artifacts:

View File

@ -283,6 +283,14 @@ Build features:
| | * ``gcrypt`` - links against libgcrypt to use for | | | * ``gcrypt`` - links against libgcrypt to use for |
| | SHA-1 hashing. | | | SHA-1 hashing. |
+--------------------------+----------------------------------------------------+ +--------------------------+----------------------------------------------------+
| ``openssl-version`` | This can be used on windows to link against the |
| | special OpenSSL library names used on windows |
| | prior to OpenSSL 1.1. |
| | * ``1.1`` - link against the normal openssl |
| | library name. (default) |
| | * ``pre1.1`` - link against the old windows names |
| | (i.e. ``ssleay32`` and ``libeay32``. |
+--------------------------+----------------------------------------------------+
| ``allocator`` | * ``pool`` - default, uses pool allocators for | | ``allocator`` | * ``pool`` - default, uses pool allocators for |
| | send buffers. | | | send buffers. |
| | * ``system`` - uses ``malloc()`` and ``free()`` | | | * ``system`` - uses ``malloc()`` and ``free()`` |