Skip to content

Commit

Permalink
[openssl] Support static builds on UWP (#19636)
Browse files Browse the repository at this point in the history
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
  • Loading branch information
pabusse and BillyONeal authored Sep 3, 2021
1 parent 39d0da3 commit 887cc9c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
15 changes: 12 additions & 3 deletions ports/openssl/uwp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
vcpkg_fail_port_install(MESSAGE "${PORT} is only for Windows Universal Platform" ON_TARGET "Linux" "OSX")

vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_find_acquire_program(JOM)
get_filename_component(JOM_EXE_PATH ${JOM} DIRECTORY)
vcpkg_add_to_path("${PERL_EXE_PATH}")

set(OPENSSL_SHARED no-shared)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPENSSL_SHARED shared)
endif()

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
Expand All @@ -26,7 +29,7 @@ set(CONFIGURE_COMMAND ${PERL} Configure
no-uplink
no-tests
-utf-8
shared
${OPENSSL_SHARED}
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
Expand Down Expand Up @@ -143,6 +146,12 @@ file(REMOVE
"${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist"
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
# They should be empty, only the exes deleted above were in these directories
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin/")
endif()

file(READ "${CURRENT_PACKAGES_DIR}/include/openssl/dtls1.h" _contents)
string(REPLACE "<winsock.h>" "<winsock2.h>" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/openssl/dtls1.h" "${_contents}")
Expand Down
1 change: 1 addition & 0 deletions ports/openssl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "openssl",
"version-string": "1.1.1l",
"port-version": 1,
"description": "OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.",
"homepage": "https://www.openssl.org"
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4734,7 +4734,7 @@
},
"openssl": {
"baseline": "1.1.1l",
"port-version": 0
"port-version": 1
},
"openssl-unix": {
"baseline": "1.1.1h",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/openssl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6d19a647704efae9398b178a0012140c1f1ee8b8",
"version-string": "1.1.1l",
"port-version": 1
},
{
"git-tree": "1916410d0a836cb70be2341fa3ec3cce74d25267",
"version-string": "1.1.1l",
Expand Down

0 comments on commit 887cc9c

Please sign in to comment.