OpenSSL vcpkg update

This commit is contained in:
ksuprynowicz 2023-06-06 20:19:55 +02:00
parent 0f158977fe
commit 7d94439299
30 changed files with 729 additions and 463 deletions

View file

@ -1,157 +0,0 @@
cmake_minimum_required(VERSION 3.9)
project(openssl C)
if(NOT SOURCE_PATH)
message(FATAL_ERROR "Requires SOURCE_PATH")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(PLATFORM android)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(PLATFORM linux-generic64)
else()
set(PLATFORM linux-generic32)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(PLATFORM darwin64-x86_64-cc)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(PLATFORM BSD-generic64)
else()
message(FATAL_ERROR "Unknown platform")
endif()
get_filename_component(COMPILER_ROOT "${CMAKE_C_COMPILER}" DIRECTORY)
message("CMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
message("COMPILER_ROOT=${COMPILER_ROOT}")
message("CMAKE_SYSROOT=${CMAKE_SYSROOT}")
message("CMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}")
message("CMAKE_C_FLAGS=${CMAKE_C_FLAGS}")
message("CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}")
message("CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}")
message("CMAKE_INCLUDE_SYSTEM_FLAG_C=${CMAKE_INCLUDE_SYSTEM_FLAG_C}")
set(CFLAGS "${CMAKE_C_FLAGS}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CFLAGS "-Wno-error=unused-command-line-argument ${CMAKE_C_FLAGS}")
endif()
if(CMAKE_C_COMPILER_TARGET)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}")
endif()
if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}")
endif()
if(CMAKE_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
elseif(CMAKE_OSX_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_OSX_SYSROOT}")
endif()
string(REGEX REPLACE "^ " "" CFLAGS "${CFLAGS}")
if(CMAKE_HOST_WIN32)
file(TO_NATIVE_PATH ENV_PATH "${COMPILER_ROOT};$ENV{PATH}")
else()
file(TO_NATIVE_PATH ENV_PATH "${COMPILER_ROOT}:$ENV{PATH}")
endif()
set(ENV{ANDROID_DEV} "${CMAKE_SYSROOT}/usr")
set(ENV{CC} "${CMAKE_C_COMPILER}")
message("ENV{ANDROID_DEV}=$ENV{ANDROID_DEV}")
get_filename_component(SOURCE_PATH_NAME "${SOURCE_PATH}" NAME)
set(BUILDDIR "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_PATH_NAME}")
if(NOT EXISTS "${BUILDDIR}")
file(COPY ${SOURCE_PATH} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
get_filename_component(MSYS_BIN_DIR "${MAKE}" DIRECTORY)
file(READ "${BUILDDIR}/Configure" _contents)
string(REPLACE "-mandroid" "" _contents "${_contents}")
file(WRITE "${BUILDDIR}/Configure" "${_contents}")
if(BUILD_SHARED_LIBS)
set(SHARED shared)
file(STRINGS "${BUILDDIR}/crypto/opensslv.h" SHLIB_VERSION
REGEX "^#[\t ]*define[\t ]+SHLIB_VERSION_NUMBER[\t ]+\".*\".*")
string(REGEX REPLACE "^.*SHLIB_VERSION_NUMBER[\t ]+\"([^\"]*)\".*$" "\\1"
SHLIB_VERSION "${SHLIB_VERSION}")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(LIB_EXT dylib)
set(LIB_EXTS ${SHLIB_VERSION}.${LIB_EXT})
else()
set(LIB_EXT so)
set(LIB_EXTS ${LIB_EXT}.${SHLIB_VERSION})
endif()
list(APPEND LIB_EXTS ${LIB_EXT})
else()
set(SHARED no-shared)
set(LIB_EXTS a)
endif()
foreach(lib ssl crypto)
foreach(ext ${LIB_EXTS})
list(APPEND INSTALL_LIBS "${BUILDDIR}/lib${lib}.${ext}")
endforeach()
endforeach()
if(CMAKE_HOST_WIN32)
set(ENV_COMMAND set)
set(PATH_VAR ";%PATH%")
else()
set(ENV_COMMAND export)
set(PATH_VAR ":$ENV{PATH}")
endif()
add_custom_command(
OUTPUT "${BUILDDIR}/Makefile"
COMMAND ${ENV_COMMAND} CC=${CMAKE_C_COMPILER}
COMMAND ${ENV_COMMAND} AR=${CMAKE_AR}
COMMAND ${ENV_COMMAND} LD=${CMAKE_LINKER}
COMMAND ${ENV_COMMAND} RANLIB=${CMAKE_RANLIB}
COMMAND ${ENV_COMMAND} MAKE=${MAKE}
COMMAND ${ENV_COMMAND} MAKEDEPPROG=${CMAKE_C_COMPILER}
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${PERL}" Configure
${SHARED}
enable-static-engine
no-ssl2
no-krb5
no-idea
no-bf
no-cast
no-seed
no-md2
${PLATFORM}
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--openssldir=/etc/ssl"
${CFLAGS}
COMMAND "${CMAKE_COMMAND}" "-DDIR=${BUILDDIR}" -P "${CMAKE_CURRENT_LIST_DIR}/remove-deps.cmake"
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
)
add_custom_target(depend
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${MAKE}" links # depend MAKEDEPPROG=${CMAKE_C_COMPILER}
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
DEPENDS "${BUILDDIR}/Makefile"
)
add_custom_target(build_libs ALL
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${CMAKE_COMMAND}" -E touch "${BUILDDIR}/krb5.h"
COMMAND "${MAKE}" build_libs
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
DEPENDS depend
BYPRODUCTS ${INSTALL_LIBS}
)
install(
FILES ${INSTALL_LIBS}
DESTINATION lib
)

View file

@ -1,3 +0,0 @@
Source: openssl-unix
Version: 1.0.2s-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.

View file

@ -1,13 +0,0 @@
diff --git a/Configure b/Configure
index c98107a..77ad9d3 100644
--- a/Configure
+++ b/Configure
@@ -972,7 +972,7 @@ PROCESS_ARGS:
}
elsif (/^--with-zlib-include=(.*)$/)
{
- $withargs{"zlib-include"}="-I$1";
+ $withargs{"zlib-include"}="-I\"$1\"";
}
elsif (/^--with-fipsdir=(.*)$/)
{

View file

@ -1,25 +0,0 @@
diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl
index dba96cb..5722f6e 100644
--- a/util/pl/VC-32.pl
+++ b/util/pl/VC-32.pl
@@ -154,9 +154,17 @@ else
$cflags=$opt_cflags.$base_cflags;
}
-# generate symbols.pdb unconditionally
-$app_cflag.=" /Zi /Fd\$(TMP_D)/app";
-$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
+# generate symbols.pdb when building dlls and embed symbols when building static libs
+if ($shlib)
+ {
+ $app_cflag.=" /Zi /Fd\$(TMP_D)/app.pdb";
+ $lib_cflag.=" /Zi /Fd\$(TMP_D)/lib.pdb";
+ }
+else
+ {
+ $app_cflag.=" /Z7";
+ $lib_cflag.=" /Z7";
+ }
$lflags.=" /debug";
$obj='.obj';

View file

@ -1,23 +0,0 @@
diff --git a/crypto/cversion.c b/crypto/cversion.c
index bfff699..17b7912 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -56,6 +56,9 @@
* [including the GNU Public Licence.]
*/
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+
#include "cryptlib.h"
#ifndef NO_WINDOWS_BRAINDEATH
@@ -79,7 +82,7 @@ const char *SSLeay_version(int t)
}
if (t == SSLEAY_CFLAGS) {
#ifdef CFLAGS
- return (CFLAGS);
+ return STRINGIFY(CFLAGS);
#else
return ("compiler: information not available");
#endif

View file

@ -1,73 +0,0 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "This port is only for openssl on Unix-like systems")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h")
message(WARNING "Can't build openssl if libressl is installed. Please remove libressl, and try install openssl again if you need it. Build will continue but there might be problems since libressl is only a subset of openssl")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
return()
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
vcpkg_find_acquire_program(PERL)
set(OPENSSL_VERSION 1.0.2s)
vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.0.2/openssl-${OPENSSL_VERSION}.tar.gz"
FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
SHA512 9f745452c4f777df694158e95003cde78a2cf8199bc481a563ec36644664c3c1415a774779b9791dd18f2aeb57fa1721cb52b3db12d025955e970071d5b66d2a
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH MASTER_COPY_SOURCE_PATH
ARCHIVE ${OPENSSL_SOURCE_ARCHIVE}
REF ${OPENSSL_VERSION}
PATCHES
ConfigureIncludeQuotesFix.patch
STRINGIFYPatch.patch
EmbedSymbolsInStaticLibsZ7.patch
)
if(CMAKE_HOST_WIN32)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
set(MAKE ${MSYS_ROOT}/usr/bin/make.exe)
else()
find_program(MAKE make)
if(NOT MAKE)
message(FATAL_ERROR "Could not find make. Please install it through your package manager.")
endif()
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
PREFER_NINJA
OPTIONS
-DSOURCE_PATH=${MASTER_COPY_SOURCE_PATH}
-DPERL=${PERL}
-DMAKE=${MAKE}
OPTIONS_RELEASE
-DINSTALL_HEADERS=ON
)
vcpkg_install_cmake()
file(GLOB HEADERS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/include/openssl/*.h)
set(RESOLVED_HEADERS)
foreach(HEADER ${HEADERS})
get_filename_component(X "${HEADER}" REALPATH)
list(APPEND RESOLVED_HEADERS "${X}")
endforeach()
file(INSTALL ${RESOLVED_HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include/openssl)
file(INSTALL ${MASTER_COPY_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl-unix RENAME copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl)
endif()
vcpkg_test_cmake(PACKAGE_NAME OpenSSL MODULE)

View file

@ -1,4 +0,0 @@
The package openssl is compatible with built-in CMake targets:
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)

View file

@ -1,10 +0,0 @@
_find_package(${ARGS})
if(OPENSSL_FOUND)
find_library(OPENSSL_DL_LIBRARY NAMES dl)
if(OPENSSL_DL_LIBRARY)
list(APPEND OPENSSL_LIBRARIES "dl")
if(TARGET OpenSSL::Crypto)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
endif()
endif()
endif()

View file

@ -1,3 +0,0 @@
Source: openssl-windows
Version: 1.1.1h
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.

View file

@ -1,142 +0,0 @@
if(VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "This port is only for building openssl on Windows Desktop")
endif()
set(OPENSSL_VERSION 1.1.1h)
set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION})
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}")
vcpkg_download_distfile(OPENSSL_SOURCE_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 da50fd99325841ed7a4367d9251c771ce505a443a73b327d8a46b2c6a7d2ea99e43551a164efc86f8743b22c2bdb0020bf24a9cbd445e9d68868b2dc1d34033a
)
vcpkg_extract_source_archive(${OPENSSL_SOURCE_ARCHIVE})
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
set(ENV{PATH} "${NASM_EXE_PATH};$ENV{PATH}")
vcpkg_find_acquire_program(JOM)
set(CONFIGURE_COMMAND ${PERL} Configure
enable-static-engine
enable-capieng
no-ssl2
-utf-8
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(OPENSSL_ARCH VC-WIN32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPENSSL_ARCH VC-WIN64A)
else()
message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Configure ${TARGET_TRIPLET}-rel")
file(COPY ${MASTER_COPY_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/openssl-${OPENSSL_VERSION})
set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR})
vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}" -FS
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-rel
)
message(STATUS "Configure ${TARGET_TRIPLET}-rel done")
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)
execute_process(
COMMAND ${JOM} -k -j $ENV{NUMBER_OF_PROCESSORS}
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 nmake install
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
LOGNAME build-${TARGET_TRIPLET}-rel-1
)
message(STATUS "Build ${TARGET_TRIPLET}-rel done")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Configure ${TARGET_TRIPLET}-dbg")
file(COPY ${MASTER_COPY_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/openssl-${OPENSSL_VERSION})
set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug)
vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} --debug "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}" -FS
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-dbg
)
message(STATUS "Configure ${TARGET_TRIPLET}-dbg done")
message(STATUS "Build ${TARGET_TRIPLET}-dbg")
make_directory(${SOURCE_PATH_DEBUG}/inc32/openssl)
execute_process(
COMMAND ${JOM} -k -j $ENV{NUMBER_OF_PROCESSORS}
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 nmake install
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
LOGNAME build-${TARGET_TRIPLET}-dbg-1
)
message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/certs)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/engines-1_1)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/private)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/certs)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/engines-1_1)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/private)
file(REMOVE
${CURRENT_PACKAGES_DIR}/openssl.cnf
${CURRENT_PACKAGES_DIR}/openssl.cnf.dist
${CURRENT_PACKAGES_DIR}/ct_log_list.cnf
${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf
${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/bin/openssl.exe
)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/openssl/)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/openssl.exe ${CURRENT_PACKAGES_DIR}/tools/openssl/openssl.exe)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/openssl)
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()
vcpkg_copy_pdbs()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${MASTER_COPY_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_test_cmake(PACKAGE_NAME OpenSSL MODULE)

View file

@ -1,4 +0,0 @@
The package openssl is compatible with built-in CMake targets:
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)

View file

@ -1,4 +0,0 @@
Source: openssl
Version: 0
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.
Build-Depends: openssl-windows (windows), openssl-android (android), openssl-unix (!android&!windows)

View file

@ -0,0 +1,12 @@
diff --git a/Configure b/Configure
index 5ac4b52..ad638e8 100755
--- a/Configure
+++ b/Configure
@@ -401,6 +401,7 @@ my @dtls = qw(dtls1 dtls1_2);
my @disablables = (
"acvp-tests",
"afalgeng",
+ "apps",
"aria",
"asan",
"asm",

View file

@ -0,0 +1,26 @@
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 110ba06..5b6b1c7 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -611,7 +611,7 @@ install_sw: install_dev install_engines install_modules install_runtime
uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
-install_docs: install_man_docs install_html_docs
+install_docs:
uninstall_docs: uninstall_man_docs uninstall_html_docs
$(RM) -r $(DESTDIR)$(DOCDIR)
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index d054431..b5c1c88 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -487,7 +487,7 @@ install_sw: install_dev install_engines install_modules install_runtime
uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
-install_docs: install_html_docs
+install_docs:
uninstall_docs: uninstall_html_docs

View file

@ -0,0 +1,32 @@
function(install_pc_file name pc_data)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${name}.pc" @ONLY)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${name}.pc" @ONLY)
endif()
endfunction()
install_pc_file(openssl [[
Name: OpenSSL
Description: Secure Sockets Layer and cryptography libraries and tools
Requires: libssl libcrypto
]])
install_pc_file(libssl [[
Name: OpenSSL-libssl
Description: Secure Sockets Layer and cryptography libraries
Libs: -L"${libdir}" -llibssl
Requires: libcrypto
Cflags: -I"${includedir}"
]])
install_pc_file(libcrypto [[
Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Libs: -L"${libdir}" -llibcrypto
Libs.private: -lcrypt32 -lws2_32 -ladvapi32 -luser32
Cflags: -I"${includedir}"
]])
vcpkg_fixup_pkgconfig()

View file

@ -0,0 +1,6 @@
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Version: @VERSION@
@pc_data@

View file

@ -1,2 +1,75 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl/)
if(EXISTS "${CURRENT_INSTALLED_DIR}/share/libressl/copyright"
OR EXISTS "${CURRENT_INSTALLED_DIR}/share/boringssl/copyright")
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()
if(VCPKG_TARGET_IS_EMSCRIPTEN)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
if (NOT "${VERSION}" MATCHES [[^([0-9]+)\.([0-9]+)\.([0-9]+)$]])
message(FATAL_ERROR "Version regex did not match.")
endif()
set(OPENSSL_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(OPENSSL_VERSION_MINOR "${CMAKE_MATCH_2}")
set(OPENSSL_VERSION_FIX "${CMAKE_MATCH_3}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openssl/openssl
REF "openssl-${VERSION}"
SHA512 7073fd82ce17a63d77babb6a184c14c7341e4b1f8f5a6caeaa1a6d9c78d6a12bb6d9cbad5d39d16412be6d1c12eac60364644664a8e26e3940476973ba07fd19
PATCHES
disable-apps.patch
disable-install-docs.patch
script-prefix.patch
windows/install-layout.patch
windows/install-pdbs.patch
unix/android-cc.patch
unix/move-openssldir.patch
unix/no-empty-dirs.patch
unix/no-static-libs-for-shared.patch
)
vcpkg_list(SET CONFIGURE_OPTIONS
enable-static-engine
enable-capieng
no-ssl3
no-weak-ssl-ciphers
no-tests
)
set(INSTALL_FIPS "")
if("fips" IN_LIST FEATURES)
vcpkg_list(APPEND INSTALL_FIPS install_fips)
vcpkg_list(APPEND CONFIGURE_OPTIONS enable-fips)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_list(APPEND CONFIGURE_OPTIONS shared)
else()
vcpkg_list(APPEND CONFIGURE_OPTIONS no-shared no-module)
endif()
if(NOT "tools" IN_LIST FEATURES)
vcpkg_list(APPEND CONFIGURE_OPTIONS no-apps)
endif()
if(DEFINED OPENSSL_USE_NOPINSHARED)
vcpkg_list(APPEND CONFIGURE_OPTIONS no-pinshared)
endif()
if(OPENSSL_NO_AUTOLOAD_CONFIG)
vcpkg_list(APPEND CONFIGURE_OPTIONS no-autoload-config)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
include("${CMAKE_CURRENT_LIST_DIR}/windows/portfile.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/unix/portfile.cmake")
endif()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View file

@ -0,0 +1,22 @@
diff --git a/tools/c_rehash.in b/tools/c_rehash.in
index 343cdc1..e48038e 100644
--- a/tools/c_rehash.in
+++ b/tools/c_rehash.in
@@ -12,7 +12,7 @@
# and add symbolic links to their hash values.
my $dir = {- quotify1($config{openssldir}) -};
-my $prefix = {- quotify1($config{prefix}) -};
+use FindBin;
my $errorcount = 0;
my $openssl = $ENV{OPENSSL} || "openssl";
@@ -61,7 +61,7 @@ if (defined(&Cwd::getcwd)) {
# DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
-$ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
+$ENV{PATH} = "$FindBin::Bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
if (! -x $openssl) {
my $found = 0;

View file

@ -0,0 +1,20 @@
diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf
index 41ad922..d15e34c 100644
--- a/Configurations/15-android.conf
+++ b/Configurations/15-android.conf
@@ -102,6 +102,7 @@
my $cflags;
my $cppflags;
+if (0) {
# see if there is NDK clang on $PATH, "universal" or "standalone"
if (which("clang") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
my $host=$1;
@@ -158,6 +159,7 @@
$sysroot =~ s|^$ndk/||;
$sysroot = " --sysroot=\$($ndk_var)/$sysroot";
}
+}
$android_ndk = {
cflags => $cflags . $sysroot,
cppflags => $cppflags,

31
cmake/ports/openssl/unix/configure vendored Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
set -e
declare -a OUT_OPTIONS
INTERPRETER=perl
LAST_SEEN=
COPY_OPTIONS=no
for OPTION; do
case "${OPTION},${COPY_OPTIONS}" in
*/Configure,no)
OUT_OPTIONS+=("${OPTION}")
INTERPRETER="${LAST_SEEN}"
COPY_OPTIONS=yes
;;
--prefix=*|--openssldir=*|--libdir=*|--cross-compile-prefix=*|--debug,*)
OUT_OPTIONS+=("${OPTION}")
;;
-*|*=*)
;;
*,yes)
OUT_OPTIONS+=("${OPTION}")
;;
esac
LAST_SEEN="${OPTION}"
done
set -x
"${INTERPRETER}" ${OUT_OPTIONS[@]}

View file

@ -0,0 +1,15 @@
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index dd96254..c4458ca 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -689,6 +689,10 @@ install_ssldirs:
cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
fi
+ $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR)
+ for I in $(DESTDIR)$(OPENSSLDIR)/*; do \
+ mv $$I $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR)/; \
+ done
install_dev: install_runtime_libs
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)

View file

@ -0,0 +1,22 @@
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 5b6b1c7..4c8c916 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -818,7 +818,7 @@ _install_modules_deps: install_runtime_libs build_modules
install_engines: _install_modules_deps
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
- @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
+ @[ -z "$(INSTALL_ENGINES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
@$(ECHO) "*** Installing engines"
@set -e; for e in dummy $(INSTALL_ENGINES); do \
if [ "$$e" = "dummy" ]; then continue; fi; \
@@ -842,7 +842,7 @@ uninstall_engines:
install_modules: _install_modules_deps
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
- @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
+ @[ -z "$(INSTALL_MODULES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
@$(ECHO) "*** Installing modules"
@set -e; for e in dummy $(INSTALL_MODULES); do \
if [ "$$e" = "dummy" ]; then continue; fi; \

View file

@ -0,0 +1,12 @@
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 4c8c916..dd96254 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -708,6 +708,7 @@ install_dev: install_runtime_libs
done
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
@set -e; for l in $(INSTALL_LIBS); do \
+ if [ -n "$(INSTALL_SHLIBS)" ] ; then continue ; fi ; \
fn=`basename $$l`; \
$(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
cp $$l $(DESTDIR)$(libdir)/$$fn.new; \

View file

@ -0,0 +1,153 @@
if (VCPKG_TARGET_IS_LINUX)
message(NOTICE [[
openssl requires Linux kernel headers from the system package manager.
They can be installed on Alpine systems via `apk add linux-headers`.
They can be installed on Ubuntu systems via `apt install linux-libc-dev`.
]])
endif()
if(CMAKE_HOST_WIN32)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl)
set(MAKE "${MSYS_ROOT}/usr/bin/make.exe")
set(PERL "${MSYS_ROOT}/usr/bin/perl.exe")
else()
find_program(MAKE make)
if(NOT MAKE)
message(FATAL_ERROR "Could not find make. Please install it through your package manager.")
endif()
vcpkg_find_acquire_program(PERL)
endif()
set(INTERPRETER "${PERL}")
execute_process(
COMMAND "${PERL}" -e "use IPC::Cmd;"
RESULT_VARIABLE perl_ipc_cmd_result
)
if(NOT perl_ipc_cmd_result STREQUAL "0")
message(FATAL_ERROR "\nPerl cannot find IPC::Cmd. Please install it through your system package manager.\n")
endif()
# Ideally, OpenSSL should use `CC` from vcpkg as is (absolute path).
# But in reality, OpenSSL expects to locate the compiler via `PATH`,
# and it makes its own choices e.g. for Android.
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER PARENT_PATH compiler_path)
cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER FILENAME compiler_name)
find_program(compiler_in_path NAMES "${compiler_name}" PATHS ENV PATH NO_DEFAULT_PATH)
if(NOT compiler_in_path)
vcpkg_host_path_list(APPEND ENV{PATH} "${compiler_path}")
elseif(NOT compiler_in_path STREQUAL VCPKG_DETECTED_CMAKE_C_COMPILER)
vcpkg_host_path_list(PREPEND ENV{PATH} "${compiler_path}")
endif()
vcpkg_list(SET MAKEFILE_OPTIONS)
if(VCPKG_TARGET_IS_ANDROID)
set(ENV{ANDROID_NDK_ROOT} "${VCPKG_DETECTED_CMAKE_ANDROID_NDK}")
set(OPENSSL_ARCH "android-${VCPKG_DETECTED_CMAKE_ANDROID_ARCH}")
if(VCPKG_DETECTED_CMAKE_ANDROID_ARCH STREQUAL "arm" AND NOT VCPKG_DETECTED_CMAKE_ANDROID_ARM_NEON)
vcpkg_list(APPEND CONFIGURE_OPTIONS no-asm)
endif()
elseif(VCPKG_TARGET_IS_LINUX)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(OPENSSL_ARCH linux-aarch64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(OPENSSL_ARCH linux-armv4)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(OPENSSL_ARCH linux-x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(OPENSSL_ARCH linux-x86)
else()
set(OPENSSL_ARCH linux-generic32)
endif()
elseif(VCPKG_TARGET_IS_IOS)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(OPENSSL_ARCH ios64-xcrun)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(OPENSSL_ARCH ios-xcrun)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(OPENSSL_ARCH iossimulator-xcrun)
else()
message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
# disable that makes linkage error (e.g. require stderr usage)
list(APPEND CONFIGURE_OPTIONS no-ui no-asm)
elseif(VCPKG_TARGET_IS_OSX)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(OPENSSL_ARCH darwin64-arm64)
else()
set(OPENSSL_ARCH darwin64-x86_64)
endif()
elseif(VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD)
set(OPENSSL_ARCH BSD-generic64)
elseif(VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPENSSL_ARCH mingw64)
else()
set(OPENSSL_ARCH mingw)
endif()
elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
vcpkg_list(APPEND CONFIGURE_OPTIONS
threads
no-engine
no-asm
no-sse2
no-srtp
--cross-compile-prefix=
)
else()
message(FATAL_ERROR "Unknown platform")
endif()
file(MAKE_DIRECTORY "${SOURCE_PATH}/vcpkg")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}/vcpkg")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH "vcpkg"
NO_ADDITIONAL_PATHS
OPTIONS
"${INTERPRETER}"
"${SOURCE_PATH}/Configure"
${OPENSSL_ARCH}
${CONFIGURE_OPTIONS}
"--openssldir=/etc/ssl"
"--libdir=lib"
OPTIONS_DEBUG
--debug
)
vcpkg_install_make(
${MAKEFILE_OPTIONS}
BUILD_TARGET build_sw
)
vcpkg_fixup_pkgconfig()
if("tools" IN_LIST FEATURES)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/c_rehash" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/c_rehash")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/c_rehash")
vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/etc/ssl/misc")
endif()
file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/certs/.keep")
file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/private/.keep")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/etc"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
# For consistency of mingw build with nmake build
file(GLOB engines "${CURRENT_PACKAGES_DIR}/lib/ossl-modules/*.dll")
if(NOT engines STREQUAL "")
file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/ossl-modules")
endif()
file(GLOB engines "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules/*.dll")
if(NOT engines STREQUAL "")
file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules")
endif()

View file

@ -0,0 +1,82 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
set(OPENSSL_VERSION_MAJOR @OPENSSL_VERSION_MAJOR@)
set(OPENSSL_VERSION_MINOR @OPENSSL_VERSION_MINOR@)
set(OPENSSL_VERSION_FIX @OPENSSL_VERSION_FIX@)
if(OPENSSL_USE_STATIC_LIBS)
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "dynamic")
message(WARNING "OPENSSL_USE_STATIC_LIBS is set, but vcpkg port openssl was built with dynamic linkage")
endif()
set(OPENSSL_USE_STATIC_LIBS_BAK "${OPENSSL_USE_STATIC_LIBS}")
set(OPENSSL_USE_STATIC_LIBS FALSE)
endif()
if(DEFINED OPENSSL_ROOT_DIR)
set(OPENSSL_ROOT_DIR_BAK "${OPENSSL_ROOT_DIR}")
endif()
get_filename_component(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" DIRECTORY)
find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h PATH "${OPENSSL_ROOT_DIR}/include" NO_DEFAULT_PATH)
if(MSVC)
find_library(LIB_EAY_DEBUG NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(LIB_EAY_RELEASE NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH)
find_library(SSL_EAY_DEBUG NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(SSL_EAY_RELEASE NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH)
elseif(WIN32)
find_library(LIB_EAY NAMES libcrypto crypto NAMES_PER_DIR)
find_library(SSL_EAY NAMES libssl ssl NAMES_PER_DIR)
else()
find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto)
find_library(OPENSSL_SSL_LIBRARY NAMES ssl)
endif()
_find_package(${ARGS})
unset(OPENSSL_ROOT_DIR)
if(DEFINED OPENSSL_ROOT_DIR_BAK)
set(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR_BAK}")
unset(OPENSSL_ROOT_DIR_BAK)
endif()
if(DEFINED OPENSSL_USE_STATIC_LIBS_BAK)
set(OPENSSL_USE_STATIC_LIBS "${OPENSSL_USE_STATIC_LIBS_BAK}")
unset(OPENSSL_USE_STATIC_LIBS_BAK)
endif()
if(OPENSSL_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(WIN32)
list(APPEND OPENSSL_LIBRARIES crypt32 ws2_32)
if(TARGET OpenSSL::Crypto)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
endif()
if(TARGET OpenSSL::SSL)
set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
endif()
else()
find_library(OPENSSL_DL_LIBRARY NAMES dl)
if(OPENSSL_DL_LIBRARY)
list(APPEND OPENSSL_LIBRARIES "dl")
if(TARGET OpenSSL::Crypto)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
endif()
endif()
if("REQUIRED" IN_LIST ARGS)
find_package(Threads REQUIRED)
else()
find_package(Threads)
endif()
list(APPEND OPENSSL_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if(TARGET OpenSSL::Crypto)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
endif()
if(TARGET OpenSSL::SSL)
set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
endif()
endif()
endif()
cmake_policy(POP)

View file

@ -0,0 +1,31 @@
{
"name": "openssl",
"version": "3.1.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",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-cmake-get-vars",
"host": true
}
],
"features": {
"fips": {
"description": "Enable fips",
"supports": "!static"
},
"tools": {
"description": "Install openssl executable and scripts",
"supports": "!uwp"
}
}
}

View file

@ -0,0 +1,13 @@
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index f71f3bf..116954f 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -223,7 +223,7 @@ MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath);
splitpath($modulesprefix, 1);
our $modulesdir_dev = $modulesprefix_dev;
our $modulesdir_dir =
- catdir($modulesprefix_dir, "ossl-modules");
+ catdir($modulesprefix_dir, "../bin");
our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir);
our $enginesdir_dev = $modulesprefix_dev;
our $enginesdir_dir =

View file

@ -0,0 +1,44 @@
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 5946c89..f71f3bf 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -556,6 +556,7 @@ install_dev: install_runtime_libs
@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
@if "$(SHLIBS)"=="" \
+ @if "$(INSTALL_PDBS)"=="ON" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
uninstall_dev:
@@ -569,6 +570,7 @@ install_engines: _install_modules_deps
@if not "$(INSTALL_ENGINES)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
@if not "$(INSTALL_ENGINES)"=="" \
+ @if "$(INSTALL_PDBS)"=="ON" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
uninstall_engines:
@@ -580,6 +582,7 @@ install_modules: _install_modules_deps
@if not "$(INSTALL_MODULES)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)"
@if not "$(INSTALL_MODULES)"=="" \
+ @if "$(INSTALL_PDBS)"=="ON" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)"
uninstall_modules:
@@ -593,6 +596,7 @@ install_runtime_libs: build_libs
@if not "$(SHLIBS)"=="" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
@if not "$(SHLIBS)"=="" \
+ @if "$(INSTALL_PDBS)"=="ON" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
"$(INSTALLTOP)\bin"
@@ -605,6 +609,7 @@ install_programs: install_runtime_libs build_programs
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
"$(INSTALLTOP)\bin"
@if not "$(INSTALL_PROGRAMS)"=="" \
+ @if "$(INSTALL_PDBS)"=="ON" \
"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
"$(INSTALLTOP)\bin"
@if not "$(INSTALL_PROGRAMS)"=="" \

View file

@ -0,0 +1,133 @@
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}")
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH "${PERL}" DIRECTORY)
vcpkg_add_to_path("${PERL_EXE_PATH}")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(OPENSSL_ARCH VC-WIN32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPENSSL_ARCH VC-WIN64A)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(OPENSSL_ARCH VC-WIN32-ARM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(OPENSSL_ARCH VC-WIN64-ARM)
else()
message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
if(VCPKG_TARGET_IS_UWP)
vcpkg_list(APPEND CONFIGURE_OPTIONS
no-unit-test
no-asm
no-uplink
)
string(APPEND OPENSSL_ARCH "-UWP")
endif()
if(VCPKG_CONCURRENCY GREATER "1")
vcpkg_list(APPEND CONFIGURE_OPTIONS no-makedepend)
endif()
cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR NORMALIZE install_dir_native)
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
# Clang always uses /Z7; Patching /Zi /Fd<Name> out of openssl requires more work.
set(OPENSSL_BUILD_MAKES_PDBS ON)
if (VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang" OR VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(OPENSSL_BUILD_MAKES_PDBS OFF)
endif()
cmake_path(NATIVE_PATH NASM NORMALIZE as)
cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_C_COMPILER NORMALIZE cc)
cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_AR NORMALIZE ar)
cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_LINKER NORMALIZE ld)
vcpkg_build_nmake(
SOURCE_PATH "${SOURCE_PATH}"
PREFER_JOM
CL_LANGUAGE NONE
PRERUN_SHELL_RELEASE "${PERL}" Configure
${CONFIGURE_OPTIONS}
${OPENSSL_ARCH}
"--prefix=${install_dir_native}"
"--openssldir=${install_dir_native}"
"AS=${as}"
"CC=${cc}"
"CFLAGS=${VCPKG_COMBINED_C_FLAGS_RELEASE}"
"AR=${ar}"
"ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}"
"LD=${ld}"
"LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}"
PRERUN_SHELL_DEBUG "${PERL}" Configure
${CONFIGURE_OPTIONS}
${OPENSSL_ARCH}
--debug
"--prefix=${install_dir_native}\\debug"
"--openssldir=${install_dir_native}\\debug"
"AS=${as}"
"CC=${cc}"
"CFLAGS=${VCPKG_COMBINED_C_FLAGS_DEBUG}"
"AR=${ar}"
"ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}"
"LD=${ld}"
"LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}"
PROJECT_NAME "makefile"
TARGET install_dev install_modules ${INSTALL_FIPS}
LOGFILE_ROOT install
OPTIONS
"INSTALL_PDBS=${OPENSSL_BUILD_MAKES_PDBS}" # install-pdbs.patch
OPTIONS_RELEASE
install_runtime install_ssldirs # extra targets
)
set(scripts "bin/c_rehash.pl" "misc/CA.pl" "misc/tsget.pl")
if("tools" IN_LIST FEATURES)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/openssl.cnf")
if("fips" IN_LIST FEATURES)
file(RENAME "${CURRENT_PACKAGES_DIR}/fipsmodule.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/fipsmodule.cnf")
endif()
foreach(script IN LISTS scripts)
file(COPY "${CURRENT_PACKAGES_DIR}/${script}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/${script}" "${CURRENT_PACKAGES_DIR}/debug/${script}")
endforeach()
vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN)
else()
file(REMOVE "${CURRENT_PACKAGES_DIR}/openssl.cnf")
file(REMOVE "${CURRENT_PACKAGES_DIR}/fipsmodule.cnf")
foreach(script IN LISTS scripts)
file(REMOVE "${CURRENT_PACKAGES_DIR}/${script}" "${CURRENT_PACKAGES_DIR}/debug/${script}")
endforeach()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
endif()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/certs"
"${CURRENT_PACKAGES_DIR}/misc"
"${CURRENT_PACKAGES_DIR}/private"
"${CURRENT_PACKAGES_DIR}/lib/engines-3"
"${CURRENT_PACKAGES_DIR}/debug/certs"
"${CURRENT_PACKAGES_DIR}/debug/misc"
"${CURRENT_PACKAGES_DIR}/debug/lib/engines-3"
"${CURRENT_PACKAGES_DIR}/debug/private"
"${CURRENT_PACKAGES_DIR}/debug/include"
)
file(REMOVE
"${CURRENT_PACKAGES_DIR}/ct_log_list.cnf"
"${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist"
"${CURRENT_PACKAGES_DIR}/openssl.cnf.dist"
"${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf"
"${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist"
"${CURRENT_PACKAGES_DIR}/debug/openssl.cnf"
"${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist"
"${CURRENT_PACKAGES_DIR}/debug/fipsmodule.cnf"
)