vcpkg/ports/openssl/unix/portfile.cmake

154 lines
5.5 KiB
CMake
Raw Normal View History

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)
[openssl] update to 3.0.2 (#22878) * Create package openssl3 * Create package openssl3 * Delete openssl3 * update version to 3.0.1 * Delete openssl3 * Update manifests to 3.0.1 * Fix download url * Update port version * Update version * Remove wrong port version * Fix errors * Fix license * Remove empty folders * Fix post-build errors * Add license field * Fix cmake for uwp * Remove patch file * format manifest * Update version file * Fix port version * version * Test: remove vcvarsall * version * fix version * version * Fix docs in cmake files as well * wrong branch * Add port openssl-1 * Fix directories * delete openssl-1 * [openssl-1] Add port * version * Fix UWP build * version * migrate uthenticode * version * Fix UWP build for librabbitmq * version * Fix UWP warnings * version * Fix patch * version * Disable C4996 on UWP * version * [idevicerestore] disable C4996 * remove warning fixes * Revert uthenticode * Final newlines * version * Remove winsock replace * version * [libwebsockets] Disable /WX on Windows * version * Typo * version * Disable C4996 in patch instead * version * [luasec] Use openssl-1 * version * revert luasec * migrate luasec * version * revert winsock * version * revert winsock * version * revert revert * version * Fix platform for luasec * Fix supports * version * . * version * uthenticode * libmysql * azure-c-shared-utility * version * remove azure-c-shared-utility * revert all * uthenticode * version * azure * version * libmysql * version * remove mysql * [libdatachannel] disable warnings on UWP * version * Fix patches * version * Add openssl-1 to CI baseline * openssl-1: check if copyright exists * version * revert azure * [libssh2] disable c4996 * version * [aws-sdk-cpp] -Wno-deprecated * version * fix aws patch * version * fix aws patch * version * [qpid-proton] disable warning * version * Fix patch * version * [librtmp] disable c4996 * version * [libu2f-server] disablec4996 * switch version scheme * version * [idevicerestore] disable c4996 * version * typo * version * fix cmake * version * fix cmake again * version * [uthenticode] patch to support Openssl 3 * version * fix idevicerestore * version * search for conflicting copyrights * version * Fix luasec * fix version * version * fix azure * version * Remove debug stuff * version * [open62541] patch * update port version * version * [libmysql] patch * version * Fix patch * version * Format openssl * Format openssl portfiles * Check for conflicting copyrights * Fix typo * Rename openssl-1 to openssl1 * Rename openssl-1 to openssl1 * version * Update ci baseline * version * resolve conflicting port versions * version * apply latest openssl security fix * version * Fix qpid-proton * version * retrigger Bbuild of qtbase * version * revert qtbase * Remove openssl1 * version * version * fix openssl_version_fix Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2022-04-07 02:04:46 +08:00
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()