Skip to content

Commit 28a7a99

Browse files
sdarwinmadmongo1
authored andcommittedJul 24, 2020
simplify openssl on windows

File tree

4 files changed

+70
-17
lines changed

4 files changed

+70
-17
lines changed
 

‎.dockers/windows-vs-32/Dockerfile

-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ RUN choco install -y python --version 3.8.3
2727
# chocolaty install of openssl 1.1.1
2828
# RUN choco install -y openssl --x86 --version 1.1.1.700
2929
# RUN mklink /D "OpenSSL" "Program Files (x86)\\OpenSSL-Win32"
30-
# RUN copy "C:\\OpenSSL\\lib\\libcrypto.lib" "C:\\OpenSSL\\lib\\libeay32.lib"
31-
# RUN copy "C:\\OpenSSL\\lib\\libssl.lib" "C:\\OpenSSL\\lib\\ssleay32.lib"
3230

3331
# scoop install of openssl 1.0.2u
3432
# RUN powershell -Command scoop install openssl@1.0.2u -a 32bit -g
@@ -37,8 +35,6 @@ RUN choco install -y python --version 3.8.3
3735
# scoop install of openssl 1.1.1g
3836
RUN powershell -Command scoop install openssl@1.1.1g -a 32bit -g
3937
RUN mklink /D "OpenSSL" "ProgramData\\scoop\\apps\\openssl\\current"
40-
RUN copy "C:\\OpenSSL\\lib\\libcrypto.lib" "C:\\OpenSSL\\lib\\libeay32.lib"
41-
RUN copy "C:\\OpenSSL\\lib\\libssl.lib" "C:\\OpenSSL\\lib\\ssleay32.lib"
4238

4339
RUN mkdir C:\devel
4440

‎.dockers/windows-vs-32/user-config.jam

+9-11
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ feature.compose <asio.mode>nodep-ts : <define>"BOOST_ASIO_NO_DEPRECATED" <define
1010
#using clang : : clang++ : <stdlib>"libc++" <cxxflags>"-Wno-c99-extensions" ;
1111
#using gcc : : g++ : <cxxflags>"-Wno-c99-extensions" ;
1212

13-
import os ;
14-
15-
local OPENSSL_ROOT = [ os.environ OPENSSL_ROOT ] ;
16-
17-
project
18-
: requirements
19-
<include>$(OPENSSL_ROOT)/include
20-
<variant>debug:<library-path>$(OPENSSL_ROOT)/lib
21-
<target-os>windows<variant>debug:<library-path>$(OPENSSL_ROOT)/debug/lib
22-
<variant>release:<library-path>$(OPENSSL_ROOT)/lib
23-
;
13+
#import os ;
14+
#local OPENSSL_ROOT = [ os.environ OPENSSL_ROOT ] ;
15+
#project
16+
# : requirements
17+
# <include>$(OPENSSL_ROOT)/include
18+
# <variant>debug:<library-path>$(OPENSSL_ROOT)/lib
19+
# <target-os>windows<variant>debug:<library-path>$(OPENSSL_ROOT)/debug/lib
20+
# <variant>release:<library-path>$(OPENSSL_ROOT)/lib
21+
# ;

‎Jamfile

+44-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import ac ;
1111
import os ;
12+
import path ;
1213
import feature ;
1314
import boost ;
1415
import modules ;
@@ -28,8 +29,49 @@ lib ssl ;
2829
lib crypto ;
2930
lib crypt32 ;
3031

31-
lib ssl : : <target-os>windows <name>ssleay32 ;
32-
lib crypto : : <target-os>windows <name>libeay32 ;
32+
# Microsoft Windows section. Refer to FAQ "Windows and OpenSSL"
33+
if [ os.name ] = NT
34+
{
35+
local OPENSSL_ROOT_DEFAULT = "C:/OpenSSL" ;
36+
local OPENSSL_ROOT_ENV = [ os.environ OPENSSL_ROOT ] ;
37+
local OPENSSL_ROOT = "" ;
38+
if $(OPENSSL_ROOT_ENV)
39+
{
40+
OPENSSL_ROOT = $(OPENSSL_ROOT_ENV) ;
41+
}
42+
else
43+
{
44+
OPENSSL_ROOT = $(OPENSSL_ROOT_DEFAULT) ;
45+
}
46+
project
47+
: requirements
48+
<include>$(OPENSSL_ROOT)/include
49+
<variant>debug:<library-path>$(OPENSSL_ROOT)/lib
50+
<target-os>windows<variant>debug:<library-path>$(OPENSSL_ROOT)/debug/lib
51+
<variant>release:<library-path>$(OPENSSL_ROOT)/lib
52+
;
53+
54+
if [ path.exists $(OPENSSL_ROOT)/lib/libssl.lib ]
55+
{
56+
echo "OpenSSL > 1.1.0. Including libssl" ;
57+
lib ssl : : <target-os>windows <name>libssl ;
58+
}
59+
if [ path.exists $(OPENSSL_ROOT)/lib/libcrypto.lib ]
60+
{
61+
echo "OpenSSL > 1.1.0. Including libcrypto" ;
62+
lib crypto : : <target-os>windows <name>libcrypto ;
63+
}
64+
if [ path.exists $(OPENSSL_ROOT)/lib/ssleay32.lib ]
65+
{
66+
echo "OpenSSL < 1.1.0. Including ssleay32" ;
67+
lib ssl : : <target-os>windows <name>ssleay32 ;
68+
}
69+
if [ path.exists $(OPENSSL_ROOT)/lib/libeay32.lib ]
70+
{
71+
echo "OpenSSL < 1.1.0. Including libeay32" ;
72+
lib crypto : : <target-os>windows <name>libeay32 ;
73+
}
74+
}
3375

3476
feature.feature boost.beast.allow-deprecated : on off : propagated composite ;
3577
feature.compose <boost.beast.allow-deprecated>on : <define>BOOST_BEAST_ALLOW_DEPRECATED ;

‎doc/qbk/08_design/4_faq.qbk

+17
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,24 @@ about Beast and other HTTP libraries that have gone through formal review.
279279
for TLS streams. Callers may provide their own overloads of these functions
280280
for user-defined next layer types.
281281
]]
282+
[[
283+
Windows and OpenSSL: How do I install and build with OpenSSL on Microsoft Windows?
284+
][
285+
An easy method is to use command-line package installers chocolatey or scoop. Examples:
286+
"choco install -y openssl --x86 --version 1.1.1.700" or
287+
"scoop install openssl@1.1.1g -a 32bit -g"
288+
289+
If you've installed OpenSSL to a directory with spaces in the name, it's often
290+
preferable to create a symbolic link so that you may use a simpler path, such as:
291+
292+
mklink /D "OpenSSL" "Program Files (x86)\\OpenSSL-Win32"
282293

294+
Set the environment variable OPENSSL_ROOT to the location of the new install:
295+
296+
set OPENSSL_ROOT=C:/OpenSSL
297+
298+
Then, proceed to build. Refer to beast/.dockers/windows-vs-32/Dockerfile for an example of building the test cases with OpenSSL.
299+
]]
283300
]
284301

285302
[endsect]

0 commit comments

Comments
 (0)
Please sign in to comment.