[openssl] Support custom cflags on Windows (#24133)

* [openssl] Support custom cflags on Windows

* [openssl] Add vcpkg-cmake-get-vars dependency

* [openssl] Record version

Co-authored-by: Billy Robert O'Neal <bion@microsoft.com>
This commit is contained in:
Robert Schumacher 2022-05-17 16:52:27 -07:00 committed by GitHub
parent 423cf6c160
commit 61058871a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 4 deletions

View File

@ -1,6 +1,7 @@
{ {
"name": "openssl", "name": "openssl",
"version": "3.0.3", "version": "3.0.3",
"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.", "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", "homepage": "https://www.openssl.org",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -8,6 +9,15 @@
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",
"host": true "host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true,
"platform": "windows & !mingw & !uwp"
} }
] ]
} }

View File

@ -0,0 +1,22 @@
diff --git a/Configure b/Configure
index faf57b1..690a9b8 100644
--- a/Configure
+++ b/Configure
@@ -556,7 +556,7 @@ my $list_separator_re =
# (we supported those before the change to "make variable" support.
my %user = (
AR => env('AR'),
- ARFLAGS => [],
+ ARFLAGS => [ env('ARFLAGS') || () ],
AS => undef,
ASFLAGS => [],
CC => env('CC'),
@@ -569,7 +569,7 @@ my %user = (
CPPINCLUDES => [], # Alternative for -I
CROSS_COMPILE => env('CROSS_COMPILE'),
HASHBANGPERL=> env('HASHBANGPERL') || env('PERL'),
- LD => undef,
+ LD => env('LD'),
LDFLAGS => [ env('LDFLAGS') || () ], # -L, -Wl,
LDLIBS => [ env('LDLIBS') || () ], # -l
MT => undef,

View File

@ -1,6 +1,7 @@
vcpkg_extract_source_archive_ex( vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE} ARCHIVE ${ARCHIVE}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/flags.patch"
) )
vcpkg_find_acquire_program(NASM) vcpkg_find_acquire_program(NASM)
@ -10,16 +11,29 @@ vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}")
vcpkg_find_acquire_program(JOM) vcpkg_find_acquire_program(JOM)
set(OPENSSL_SHARED no-shared) set(OPENSSL_SHARED no-shared)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPENSSL_SHARED shared) set(OPENSSL_SHARED shared)
endif() endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
set(ENV{CC} "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
set(ENV{CXX} "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}")
set(ENV{AR} "${VCPKG_DETECTED_CMAKE_AR}")
set(ENV{LD} "${VCPKG_DETECTED_CMAKE_LINKER}")
# OpenSSL's buildsystem hardcodes certain PDB manipulations, so we cannot use Z7
string(REGEX REPLACE "(^| )-Z7($| )" " " VCPKG_COMBINED_C_FLAGS_RELEASE "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
string(REGEX REPLACE "(^| )-Z7($| )" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
string(REGEX REPLACE "(^| )-Z7($| )" " " VCPKG_COMBINED_CXX_FLAGS_RELEASE "${VCPKG_COMBINED_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE "(^| )-Z7($| )" " " VCPKG_COMBINED_CXX_FLAGS_DEBUG "${VCPKG_COMBINED_CXX_FLAGS_DEBUG}")
set(CONFIGURE_OPTIONS set(CONFIGURE_OPTIONS
enable-static-engine enable-static-engine
enable-capieng enable-capieng
no-ssl2 no-ssl2
no-tests no-tests
-utf-8
${OPENSSL_SHARED} ${OPENSSL_SHARED}
) )
@ -51,7 +65,6 @@ file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
# Copy openssl sources. # Copy openssl sources.
message(STATUS "Copying openssl release source files...") message(STATUS "Copying openssl release source files...")
file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*) file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*)
@ -63,6 +76,11 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR}) set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR})
set(ENV{CFLAGS} "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
set(ENV{CXXFLAGS} "${VCPKG_COMBINED_CXX_FLAGS_RELEASE}")
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}")
message(STATUS "Configure ${TARGET_TRIPLET}-rel") message(STATUS "Configure ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}" -FS COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}" -FS
@ -102,6 +120,11 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug) set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug)
set(ENV{CFLAGS} "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
set(ENV{CXXFLAGS} "${VCPKG_COMBINED_CXX_FLAGS_DEBUG}")
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}")
message(STATUS "Configure ${TARGET_TRIPLET}-dbg") message(STATUS "Configure ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} debug-${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}" -FS COMMAND ${CONFIGURE_COMMAND} debug-${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}" -FS

View File

@ -5178,7 +5178,7 @@
}, },
"openssl": { "openssl": {
"baseline": "3.0.3", "baseline": "3.0.3",
"port-version": 0 "port-version": 1
}, },
"openssl-unix": { "openssl-unix": {
"baseline": "1.1.1h", "baseline": "1.1.1h",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "1ac5c972c2c6c9af050334b2f7a41de1253c6a5e",
"version": "3.0.3",
"port-version": 1
},
{ {
"git-tree": "973408910bc03c5a350f502080548a0d1ac68352", "git-tree": "973408910bc03c5a350f502080548a0d1ac68352",
"version": "3.0.3", "version": "3.0.3",