# file : openssl/buildfile # copyright : Copyright (c) 2018-2019 Code Synthesis Ltd # license : OpenSSL and SSLeay Licenses; see accompanying LICENSE file import libs = libssl%lib{ssl} import libs += libcrypto%lib{crypto} exe{openssl}: {h c}{** -vms_* -apps/win32_init} $libs tclass = $c.target.class tsys = $c.target.system windows = ($tclass == 'windows') exe{openssl}: apps/c{win32_init}: include = $windows # Build options. # # Note that the upstream package uses -pthread compiler/linker option on # Linux and FreeBSD. The option is currently unsupported by build2, so we use # -D_REENTRANT and -lpthread preprocessor/linker options instead. # # Also note that on FreeBSD and Mac OS the upstream package also passes # -D_REENTRANT. # if! $windows c.poptions += -D_REENTRANT else c.poptions += -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE switch $tclass, $tsys { case 'bsd' c.poptions += -D_THREAD_SAFE case 'windows', 'mingw32' c.poptions += -D_MT case 'windows' { # Note that upstream also passes -DOPENSSL_USE_APPLINK if compiled with # VC. We drop this option (see libcrypto/buildfile) for details. # c.poptions += -DOPENSSL_SYS_WIN32 -D_CRT_SECURE_NO_DEPRECATE \ -D_WINSOCK_DEPRECATED_NO_WARNINGS } } switch $c.class { case 'gcc' { if ($c.target.cpu == 'i686') c.coptions += -fomit-frame-pointer # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem # to care about these and it is not easy to disable specific warnings in a # way that works across compilers/versions (some -Wno-* options are only # recognized in newer versions). There are still some warnings left that # appear for certain platforms/compilers. We pass them through but disable # treating them as errors. # c.coptions += -Wno-all -Wno-extra -Wno-error } case 'msvc' { c.coptions += /Gs0 /GF /Gy # Disable warnings that pop up with /W3. # c.coptions += /wd4090 /wd4244 /wd4267 } } c.poptions =+ "-I$src_base" switch $tclass, $tsys { case 'linux' c.libs += -ldl -lpthread case 'bsd' c.libs += -lpthread case 'windows', 'mingw32' c.libs += -lws2_32 -lgdi32 -lcrypt32 case 'windows' c.libs += ws2_32.lib gdi32.lib crypt32.lib advapi32.lib }