-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[openssl] port update to OpenSSL 3.0.0 #20428
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
922afb1
[openssl3] create a new port
luncliff a4d8969
[openssl3] update version JSON
luncliff 639fc82
[openssl3] update detect_platform.cmake
luncliff a6fc0fb
[openssl3] quote path/strings
luncliff e392457
[openssl3] add port usage
luncliff ea3ebf5
[openssl] move port 'openssl' to 'openssl1'
luncliff defa074
[openssl] rename files for 'openssl3' to 'openssl'
luncliff 66610f1
[openssl] fix version files
luncliff 6bff32d
[openssl] remove 1.1.1 port files
luncliff 2ab7467
[openssl] quote path expressions
luncliff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
if(VCPKG_TARGET_IS_ANDROID) | ||
# ${SOURCE_PATH}/Configuration/15-android.conf | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "android-arm64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") | ||
set(PLATFORM "android-arm") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "android-x86_64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "android-x86") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_LINUX) | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "linux-aarch64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") | ||
set(PLATFORM "linux-armv4") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "linux-x86_64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "linux-x86") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "ppc64le") | ||
set(PLATFORM "linux-ppc64le") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_IOS) | ||
# ${SOURCE_PATH}/Configuration/15-ios.conf | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "ios64-xcrun") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") | ||
set(PLATFORM "ios-xcrun") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR | ||
VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "iossimulator-xcrun") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_OSX) | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "darwin64-arm64-cc") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "darwin64-x86_64-cc") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD) | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "BSD-x86_64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "BSD-x86") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_MINGW) | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "mingw64") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "mingw") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_UWP) | ||
# ${SOURCE_PATH}/Configuration/50-win-onecore.conf | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "VC-WIN32-UWP") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "VC-WIN64A-UWP") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") | ||
set(PLATFORM "VC-WIN32-ARM-UWP") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "VC-WIN64-ARM-UWP") | ||
endif() | ||
|
||
elseif(VCPKG_TARGET_IS_WINDOWS) | ||
# ${SOURCE_PATH}/Configuration/50-win-onecore.conf | ||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") | ||
set(PLATFORM "VC-WIN32") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") | ||
set(PLATFORM "VC-WIN64A") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") | ||
set(PLATFORM "VC-WIN32-ARM") | ||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
set(PLATFORM "VC-WIN64-ARM") | ||
endif() | ||
|
||
endif() | ||
|
||
if(NOT DEFINED PLATFORM) | ||
message(FATAL_ERROR "PLATFORM is unknown for the target platform/architecture") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,187 @@ | ||
if(EXISTS "${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h") | ||
message(FATAL_ERROR "Can't build openssl if libressl/boringssl is installed. Please remove libressl/boringssl, and try install openssl again if you need it.") | ||
endif() | ||
|
||
set(OPENSSL_VERSION 1.1.1l) | ||
vcpkg_download_distfile(ARCHIVE | ||
URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz" | ||
FILENAME "openssl-${OPENSSL_VERSION}.tar.gz" | ||
SHA512 d9611f393e37577cca05004531388d3e0ebbf714894cab9f95f4903909cd4f45c214faab664c0cbc3ad3cca309d500b9e6d0ecbf9a0a0588d1677dc6b047f9e0 | ||
) | ||
|
||
vcpkg_find_acquire_program(PERL) | ||
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) | ||
vcpkg_add_to_path("${PERL_EXE_PATH}") | ||
|
||
if(VCPKG_TARGET_IS_UWP) | ||
include("${CMAKE_CURRENT_LIST_DIR}/uwp/portfile.cmake") | ||
elseif(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) | ||
include("${CMAKE_CURRENT_LIST_DIR}/windows/portfile.cmake") | ||
else() | ||
include("${CMAKE_CURRENT_LIST_DIR}/unix/portfile.cmake") | ||
endif() | ||
|
||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) | ||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
if(EXISTS ${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h) | ||
message(FATAL_ERROR "Can't build '${PORT}' if another SSL library is installed. Please remove existing one and try install '${PORT}' again if you need it.") | ||
endif() | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO openssl/openssl | ||
REF openssl-3.0.0 | ||
SHA512 50b4fefa3e5a3359e7b06bfbc4ecc525ef9d76e13d087aa8e2d29880f08f74cc9d0c76b9bf1895c118def2bb0e4db0095e799a752b64b60721a423bd2cf989da | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") | ||
list(APPEND CONFIGURE_OPTIONS shared) | ||
else() | ||
list(APPEND CONFIGURE_OPTIONS no-shared) | ||
endif() | ||
|
||
# see ${SOURCE_PATH}/INSTALL.md | ||
list(APPEND CONFIGURE_OPTIONS | ||
no-zlib | ||
no-ui-console # Don't build with the User Interface (UI) console method | ||
no-module # Don't build any dynamically loadable engines | ||
no-makedepend # Don't generate dependencies | ||
no-tests # Don't build test programs or run any tests | ||
) | ||
if(VCPKG_TARGET_IS_UWP) | ||
list(APPEND CONFIGURE_OPTIONS no-async) | ||
endif() | ||
if(VCPKG_TARGET_IS_WINDOWS) | ||
# jom will build in parallel mode, we need /FS for PDB access | ||
list(APPEND CONFIGURE_OPTIONS -utf-8 -FS) | ||
|
||
elseif(VCPKG_TARGET_IS_IOS) | ||
# see https://github.com/microsoft/vcpkg PR 12527 | ||
# disable that makes linkage error (e.g. require stderr usage) | ||
list(APPEND CONFIGURE_OPTIONS no-stdio no-ui no-asm) | ||
|
||
endif() | ||
|
||
# Option: platform/architecture. Defined a variable 'PLATFORM' | ||
include(${CMAKE_CURRENT_LIST_DIR}/detect_platform.cmake) | ||
|
||
# Clean & copy source files for working directories | ||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" | ||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" | ||
) | ||
get_filename_component(SOURCE_DIR_NAME "${SOURCE_PATH}" NAME) | ||
file(COPY "${SOURCE_PATH}" | ||
DESTINATION "${CURRENT_BUILDTREES_DIR}") | ||
file(RENAME "${CURRENT_BUILDTREES_DIR}/${SOURCE_DIR_NAME}" | ||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") | ||
file(COPY "${SOURCE_PATH}" | ||
DESTINATION "${CURRENT_BUILDTREES_DIR}") | ||
file(RENAME "${CURRENT_BUILDTREES_DIR}/${SOURCE_DIR_NAME}" | ||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") | ||
|
||
# see ${SOURCE_PATH}/NOTES-PERL.md | ||
vcpkg_find_acquire_program(PERL) | ||
get_filename_component(PERL_EXE_PATH "${PERL}" PATH) | ||
vcpkg_add_to_path("${PERL_EXE_PATH}") | ||
|
||
if(NOT VCPKG_HOST_IS_WINDOWS) | ||
# see ${SOURCE_PATH}/NOTES-UNIX.md | ||
find_program(MAKE make REQUIRED) | ||
endif() | ||
|
||
if(VCPKG_TARGET_IS_WINDOWS) | ||
# see ${SOURCE_PATH}/NOTES-WINDOWS.md | ||
vcpkg_find_acquire_program(NASM) | ||
get_filename_component(NASM_EXE_PATH "${NASM}" PATH) | ||
vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}") | ||
# note: jom is not for `vcpkg_add_to_path` | ||
vcpkg_find_acquire_program(JOM) | ||
|
||
elseif(VCPKG_TARGET_IS_ANDROID) | ||
# see ${SOURCE_PATH}/NOTES-ANDROID.md | ||
if(NOT DEFINED ENV{ANDROID_NDK_ROOT} AND DEFINED ENV{ANDROID_NDK_HOME}) | ||
set(ENV{ANDROID_NDK_ROOT} $ENV{ANDROID_NDK_HOME}) | ||
endif() | ||
if(NOT DEFINED ENV{ANDROID_NDK_ROOT}) | ||
message(FATAL_ERROR "ENV{ANDROID_NDK_ROOT} is required by ${SOURCE_PATH}/Configurations/15-android.conf") | ||
endif() | ||
if(VCPKG_HOST_IS_LINUX) | ||
set(NDK_HOST_TAG "linux-x86_64") | ||
elseif(VCPKG_HOST_IS_OSX) | ||
set(NDK_HOST_TAG "darwin-x86_64") | ||
elseif(VCPKG_HOST_IS_WINDOWS) | ||
set(NDK_HOST_TAG "windows-x86_64") | ||
else() | ||
message(FATAL_ERROR "Unknown NDK host platform") | ||
endif() | ||
get_filename_component(NDK_TOOL_PATH "$ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}/bin" ABSOLUTE) | ||
vcpkg_add_to_path(PREPEND "${NDK_TOOL_PATH}") | ||
|
||
endif() | ||
|
||
# Configure / Install | ||
# note: we need a PERL so can't use `vcpkg_configure_make` directly... | ||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND ${PERL} Configure ${OPENSSL_SHARED} ${CONFIGURE_OPTIONS} | ||
${PLATFORM} "--prefix=${CURRENT_PACKAGES_DIR}/debug" | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" | ||
LOGNAME configure-perl-${TARGET_TRIPLET}-dbg | ||
) | ||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel") | ||
vcpkg_execute_required_process( | ||
COMMAND ${PERL} Configure ${OPENSSL_SHARED} ${CONFIGURE_OPTIONS} | ||
${PLATFORM} "--prefix=${CURRENT_PACKAGES_DIR}" | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" | ||
LOGNAME configure-perl-${TARGET_TRIPLET}-rel | ||
) | ||
|
||
if(VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_WINDOWS) | ||
message(STATUS "Building ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND ${JOM} /K /J ${VCPKG_CONCURRENCY} /F makefile install_dev | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" | ||
LOGNAME install-${TARGET_TRIPLET}-dbg | ||
) | ||
message(STATUS "Building ${TARGET_TRIPLET}-rel") | ||
vcpkg_execute_required_process( | ||
COMMAND ${JOM} /K /J ${VCPKG_CONCURRENCY} /F makefile install_dev | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" | ||
LOGNAME install-${TARGET_TRIPLET}-rel | ||
) | ||
vcpkg_copy_pdbs() | ||
|
||
else() | ||
message(STATUS "Building ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} install_dev | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" | ||
LOGNAME install-${TARGET_TRIPLET}-dbg | ||
) | ||
message(STATUS "Building ${TARGET_TRIPLET}-rel") | ||
vcpkg_execute_required_process( | ||
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} install_dev | ||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" | ||
LOGNAME install-${TARGET_TRIPLET}-rel | ||
) | ||
if(VCPKG_TARGET_IS_ANDROID AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") | ||
# install_dev copies symbolic link. overwrite them with the actual shared objects | ||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcrypto.so" | ||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libssl.so" | ||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" | ||
) | ||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libcrypto.so" | ||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libssl.so" | ||
DESTINATION "${CURRENT_PACKAGES_DIR}/lib" | ||
) | ||
endif() | ||
# rename lib64 to lib for lib/pkgconfig | ||
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib64") | ||
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib64" "${CURRENT_PACKAGES_DIR}/debug/lib") | ||
endif() | ||
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib64") | ||
file(RENAME "${CURRENT_PACKAGES_DIR}/lib64" "${CURRENT_PACKAGES_DIR}/lib") | ||
endif() | ||
vcpkg_fixup_pkgconfig() | ||
|
||
endif() | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") | ||
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libcrypto.a" | ||
"${CURRENT_PACKAGES_DIR}/debug/lib/libssl.a" | ||
"${CURRENT_PACKAGES_DIR}/lib/libcrypto.a" | ||
"${CURRENT_PACKAGES_DIR}/lib/libssl.a" | ||
) | ||
else() | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" | ||
"${CURRENT_PACKAGES_DIR}/bin" | ||
) | ||
if(VCPKG_TARGET_IS_WINDOWS) | ||
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/ossl_static.pdb" | ||
"${CURRENT_PACKAGES_DIR}/lib/ossl_static.pdb" | ||
) | ||
endif() | ||
endif() | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
|
||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" | ||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright" | ||
) | ||
file(INSTALL "${CURRENT_PORT_DIR}/usage" | ||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to use
jom
when cross-compiling to windows?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use NMake but I wanted to use parallel build with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not about jom vs nmake. It is about Linux hosts building with
VCPKG_TARGET_IS_WINDOWS
. We probably want to usemake
there. Since you start that block withif
notelse
I thought you really meanVCPKG_TARGET_IS_WINDOWS
notVCPKG_HOST_IS_WINDOWS
, didn't you?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I didn't considered cross compiling from Linux to Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try the case when I get some time. That would be an intersting case for this port 🤔