mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-11 16:19:02 +08:00
f32fc13dbe
* Use vcpkg_build_nmake for windows incl. uwp Use prerun shell for configuration * [openssl] Generate OPENSSL_VERSION_MAJOR/MINOR/FIX * Update versions Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
138 lines
4.5 KiB
CMake
138 lines
4.5 KiB
CMake
vcpkg_find_acquire_program(NASM)
|
|
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
|
|
vcpkg_add_to_path(PREPEND "${NASM_EXE_PATH}")
|
|
|
|
vcpkg_list(SET CONFIGURE_OPTIONS
|
|
enable-static-engine
|
|
enable-capieng
|
|
no-ssl2
|
|
no-tests
|
|
)
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
vcpkg_list(APPEND CONFIGURE_OPTIONS shared)
|
|
else()
|
|
vcpkg_list(APPEND CONFIGURE_OPTIONS no-shared no-module)
|
|
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_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}
|
|
debug-${OPENSSL_ARCH}
|
|
"--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
|
|
LOGFILE_ROOT install
|
|
OPTIONS
|
|
"INSTALL_PDBS=${OPENSSL_BUILD_MAKES_PDBS}" # install-pdbs.patch
|
|
OPTIONS_RELEASE
|
|
install_runtime install_ssldirs # extra targets
|
|
)
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/openssl.cnf")
|
|
if(NOT VCPKG_TARGET_IS_UWP)
|
|
foreach(script IN ITEMS "bin/c_rehash.pl" "misc/CA.pl" "misc/tsget.pl")
|
|
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)
|
|
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"
|
|
)
|
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|