mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
[openssl] Enable builds with clang-cl (#25869)
* allow clang-cl builds * v db * should always wait for the debug build to finishe ..... * v db * fix static builds not having pdbs * v db * Add a variable and comment to describe why we are removing PDB copy rules. Co-authored-by: Billy O'Neal <bion@microsoft.com>
This commit is contained in:
parent
2343dc8bed
commit
10d105c8c4
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "openssl",
|
||||
"version": "3.0.5",
|
||||
"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",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -18,12 +18,6 @@ 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
|
||||
enable-static-engine
|
||||
enable-capieng
|
||||
@ -59,17 +53,30 @@ set(OPENSSL_MAKEFILE "makefile")
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
|
||||
# Clang always uses /Z7; Patching /Zi /Fd<Name> out of openssl requires more work.
|
||||
if (VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang" OR VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
set(OPENSSL_BUILD_MAKES_PDBS OFF)
|
||||
else()
|
||||
set(OPENSSL_BUILD_MAKES_PDBS ON)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
# Copy openssl sources.
|
||||
message(STATUS "Copying openssl release source files...")
|
||||
file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*)
|
||||
foreach(SOURCE_FILE ${OPENSSL_SOURCE_FILES})
|
||||
file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
endforeach()
|
||||
file(COPY "${SOURCE_PATH}/" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
|
||||
message(STATUS "Copying openssl release source files... done")
|
||||
set(SOURCE_PATH_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
|
||||
set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR})
|
||||
set(OPENSSLDIR_RELEASE "${CURRENT_PACKAGES_DIR}")
|
||||
|
||||
# Remove install rules for pdbs if they don't exist
|
||||
if(NOT OPENSSL_BUILD_MAKES_PDBS)
|
||||
file(READ "${SOURCE_PATH_RELEASE}/Configurations/windows-makefile.tmpl" contents)
|
||||
string(REGEX REPLACE [["\$\(PERL\)" "\$\(SRCDIR\)\\util\\copy.pl" \$\(INSTALL_(ENGINE|MODULE|SHLIB|PROGRAM)PDBS\)]] "echo " contents "${contents}")
|
||||
string(REGEX REPLACE [["\$\(PERL\)" "\$\(SRCDIR\)\\util\\copy.pl" ossl_static.pdb]] "echo " contents "${contents}")
|
||||
file(WRITE "${SOURCE_PATH_RELEASE}/Configurations/windows-makefile.tmpl" "${contents}")
|
||||
endif()
|
||||
|
||||
set(ENV{CFLAGS} "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
|
||||
set(ENV{CXXFLAGS} "${VCPKG_COMBINED_CXX_FLAGS_RELEASE}")
|
||||
@ -79,7 +86,7 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Configure ${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}" -FS
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}"
|
||||
LOGNAME configure-perl-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
message(STATUS "Configure ${TARGET_TRIPLET}-rel done")
|
||||
@ -87,16 +94,16 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Build ${TARGET_TRIPLET}-rel")
|
||||
# Openssl's buildsystem has a race condition which will cause JOM to fail at some point.
|
||||
# This is ok; we just do as much work as we can in parallel first, then follow up with a single-threaded build.
|
||||
make_directory(${SOURCE_PATH_RELEASE}/inc32/openssl)
|
||||
make_directory("${SOURCE_PATH_RELEASE}/inc32/openssl")
|
||||
execute_process(
|
||||
COMMAND "${JOM}" -k -j "${VCPKG_CONCURRENCY}" -f "${OPENSSL_MAKEFILE}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}"
|
||||
OUTPUT_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-out.log"
|
||||
ERROR_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-err.log"
|
||||
)
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${JOM}" -j 1 -f "${OPENSSL_MAKEFILE}" install_sw install_ssldirs
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_RELEASE}"
|
||||
LOGNAME build-${TARGET_TRIPLET}-rel-1)
|
||||
|
||||
message(STATUS "Build ${TARGET_TRIPLET}-rel done")
|
||||
@ -106,14 +113,20 @@ endif()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
# Copy openssl sources.
|
||||
message(STATUS "Copying openssl debug source files...")
|
||||
file(GLOB OPENSSL_SOURCE_FILES ${SOURCE_PATH}/*)
|
||||
foreach(SOURCE_FILE ${OPENSSL_SOURCE_FILES})
|
||||
file(COPY ${SOURCE_FILE} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
endforeach()
|
||||
file(COPY "${SOURCE_PATH}/" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
|
||||
message(STATUS "Copying openssl debug source files... done")
|
||||
set(SOURCE_PATH_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
|
||||
set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug)
|
||||
# Remove install rules for pdbs if they don't exist
|
||||
if(NOT OPENSSL_BUILD_MAKES_PDBS)
|
||||
file(READ "${SOURCE_PATH_DEBUG}/Configurations/windows-makefile.tmpl" contents)
|
||||
string(REGEX REPLACE [["\$\(PERL\)" "\$\(SRCDIR\)\\util\\copy.pl" \$\(INSTALL_(ENGINE|MODULE|SHLIB|PROGRAM)PDBS\)]] "echo " contents "${contents}")
|
||||
string(REGEX REPLACE [["\$\(PERL\)" "\$\(SRCDIR\)\\util\\copy.pl" ossl_static.pdb]] "echo " contents "${contents}")
|
||||
file(WRITE "${SOURCE_PATH_DEBUG}/Configurations/windows-makefile.tmpl" "${contents}")
|
||||
endif()
|
||||
|
||||
set(OPENSSLDIR_DEBUG "${CURRENT_PACKAGES_DIR}/debug")
|
||||
|
||||
set(ENV{CFLAGS} "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
set(ENV{CXXFLAGS} "${VCPKG_COMBINED_CXX_FLAGS_DEBUG}")
|
||||
@ -123,7 +136,7 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Configure ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${CONFIGURE_COMMAND} debug-${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}" -FS
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}"
|
||||
LOGNAME configure-perl-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
message(STATUS "Configure ${TARGET_TRIPLET}-dbg done")
|
||||
@ -132,18 +145,18 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
make_directory("${SOURCE_PATH_DEBUG}/inc32/openssl")
|
||||
execute_process(
|
||||
COMMAND "${JOM}" -k -j "${VCPKG_CONCURRENCY}" -f "${OPENSSL_MAKEFILE}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}"
|
||||
OUTPUT_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-out.log"
|
||||
ERROR_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-err.log"
|
||||
)
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${JOM}" -j 1 -f "${OPENSSL_MAKEFILE}" install_sw install_ssldirs
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH_DEBUG}"
|
||||
LOGNAME build-${TARGET_TRIPLET}-dbg-1)
|
||||
|
||||
message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND NOT VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules/legacy.pdb" "${CURRENT_PACKAGES_DIR}/debug/bin/legacy.pdb")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/ossl-modules/legacy.pdb" "${CURRENT_PACKAGES_DIR}/bin/legacy.pdb")
|
||||
endif()
|
||||
|
@ -5250,7 +5250,7 @@
|
||||
},
|
||||
"openssl": {
|
||||
"baseline": "3.0.5",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"openssl-unix": {
|
||||
"baseline": "1.1.1h",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "3b7cc4dec346a7593959636aa8cc266240d92b7f",
|
||||
"version": "3.0.5",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "6f3d4db3ea7bcbac9c79e8beb24c0a33c4da3e96",
|
||||
"version": "3.0.5",
|
||||
|
Loading…
x
Reference in New Issue
Block a user