2016-11-08 13:54:23 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/portfile-uwp.cmake)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2016-09-19 11:50:08 +08:00
|
|
|
include(vcpkg_common_functions)
|
2017-01-29 00:25:17 +08:00
|
|
|
set(OPENSSL_VERSION 1.0.2k)
|
2017-03-21 06:48:13 +08:00
|
|
|
set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION})
|
2016-09-19 11:50:08 +08:00
|
|
|
vcpkg_find_acquire_program(PERL)
|
|
|
|
find_program(NMAKE nmake)
|
|
|
|
|
|
|
|
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
2017-03-09 02:01:56 +08:00
|
|
|
set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}")
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
|
2017-01-29 00:25:17 +08:00
|
|
|
URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
|
|
|
|
FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
|
|
|
|
SHA512 0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
|
2017-03-21 04:54:57 +08:00
|
|
|
vcpkg_extract_source_archive(${OPENSSL_SOURCE_ARCHIVE})
|
|
|
|
vcpkg_apply_patches(
|
2017-03-21 06:48:13 +08:00
|
|
|
SOURCE_PATH ${MASTER_COPY_SOURCE_PATH}
|
2017-03-21 04:54:57 +08:00
|
|
|
PATCHES ${CMAKE_CURRENT_LIST_DIR}/PerlScriptSpaceInPathFixes.patch
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch
|
|
|
|
)
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-03-21 06:48:13 +08:00
|
|
|
set(CONFIGURE_COMMAND ${PERL} Configure
|
|
|
|
enable-static-engine
|
|
|
|
enable-capieng
|
|
|
|
no-asm
|
|
|
|
no-ssl2
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
|
2017-03-21 06:48:13 +08:00
|
|
|
if(TARGET_TRIPLET MATCHES "x86-windows")
|
|
|
|
set(OPENSSL_ARCH VC-WIN32)
|
|
|
|
set(OPENSSL_DO "ms\\do_ms.bat")
|
|
|
|
elseif(TARGET_TRIPLET MATCHES "x64")
|
|
|
|
set(OPENSSL_ARCH VC-WIN64A)
|
|
|
|
set(OPENSSL_DO "ms\\do_win64a.bat")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported target triplet: ${TARGET_TRIPLET}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
|
2016-09-20 08:38:38 +08:00
|
|
|
message(STATUS "Build ${TARGET_TRIPLET}-rel")
|
2017-03-21 06:48:13 +08:00
|
|
|
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})
|
|
|
|
|
2016-09-20 08:38:38 +08:00
|
|
|
vcpkg_execute_required_process(
|
2017-03-21 06:48:13 +08:00
|
|
|
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}"
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-rel
|
2016-09-20 08:38:38 +08:00
|
|
|
)
|
2017-03-21 06:48:13 +08:00
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${OPENSSL_DO}
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-rel
|
|
|
|
)
|
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
vcpkg_execute_required_process(COMMAND ${NMAKE} -f ms\\ntdll.mak install
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-rel)
|
|
|
|
else()
|
|
|
|
vcpkg_execute_required_process(COMMAND ${NMAKE} -f ms\\nt.mak install
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-rel)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2016-09-20 08:38:38 +08:00
|
|
|
message(STATUS "Build ${TARGET_TRIPLET}-rel done")
|
|
|
|
|
|
|
|
message(STATUS "Build ${TARGET_TRIPLET}-dbg")
|
2017-03-21 06:48:13 +08:00
|
|
|
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} debug-${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}"
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
|
|
|
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-dbg
|
|
|
|
)
|
2016-09-20 08:38:38 +08:00
|
|
|
vcpkg_execute_required_process(
|
2017-03-21 06:48:13 +08:00
|
|
|
COMMAND ${OPENSSL_DO}
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
|
|
|
LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-dbg
|
2016-09-20 08:38:38 +08:00
|
|
|
)
|
2017-03-21 06:48:13 +08:00
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
vcpkg_execute_required_process(COMMAND ${NMAKE} -f ms\\ntdll.mak install
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg)
|
|
|
|
else()
|
|
|
|
vcpkg_execute_required_process(COMMAND ${NMAKE} -f ms\\nt.mak install
|
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg)
|
|
|
|
endif()
|
|
|
|
|
2016-09-20 08:38:38 +08:00
|
|
|
message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
file(REMOVE
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/bin/openssl.exe
|
|
|
|
${CURRENT_PACKAGES_DIR}/bin/openssl.exe
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf
|
|
|
|
${CURRENT_PACKAGES_DIR}/openssl.cnf
|
|
|
|
)
|
2016-10-26 07:10:43 +08:00
|
|
|
|
2016-09-19 11:50:08 +08:00
|
|
|
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
|
2016-10-26 07:10:43 +08:00
|
|
|
|
2016-11-01 03:34:04 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
2016-10-26 07:10:43 +08:00
|
|
|
# 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()
|
2016-11-01 03:34:04 +08:00
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|