[openssl] Enable building statically. Also remove zlib dependency

This commit is contained in:
Alexander Karatarakis 2016-10-25 16:10:43 -07:00
parent 516a1680aa
commit b6a31ab430
3 changed files with 30 additions and 23 deletions

View File

@ -5,7 +5,6 @@ include(vcpkg_execute_required_process)
include(vcpkg_apply_patches)
set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-1.0.2h)
find_package(ZLIB REQUIRED)
find_program(PERL perl)
find_program(NMAKE nmake)
@ -24,12 +23,10 @@ vcpkg_apply_patches(
)
set(CONFIGURE_COMMAND ${PERL} Configure
no-idea
no-mdc2
no-rc5
enable-static-engine
enable-capieng
no-asm
zlib-dynamic
"--with-zlib-include=${ZLIB_INCLUDE_DIRS}"
no-ssl2
)
if(TARGET_TRIPLET MATCHES "x86-windows")
@ -44,18 +41,18 @@ endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR}/debug)
list(GET ZLIB_LIBRARIES -1 ZLIB_DEBUG_LIBRARY)
list(APPEND CONFIGURE_COMMAND
debug-${OPENSSL_ARCH}
"--prefix=${OPENSSLDIR}"
"--openssldir=${OPENSSLDIR}"
"--with-zlib-lib=${ZLIB_DEBUG_LIBRARY}"
)
else()
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR})
list(APPEND CONFIGURE_COMMAND
${OPENSSL_ARCH}
"--prefix=${OPENSSLDIR}"
"--openssldir=${OPENSSLDIR}"
"--with-zlib-lib=${ZLIB_LIBRARIES}"
)
endif()
@ -70,8 +67,16 @@ vcpkg_execute_required_process(
LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}
)
add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll
COMMAND ${NMAKE} -f ms\\ntdll.mak install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION}
)
add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll)
if(BUILD_SHARED_LIBS)
add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll
COMMAND ${NMAKE} -f ms\\ntdll.mak install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION}
)
add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll)
else()
add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib
COMMAND ${NMAKE} -f ms\\nt.mak install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION}
)
add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib)
endif()

View File

@ -1,4 +1,3 @@
Source: openssl
Version: 1.0.2h
Build-Depends: zlib
Version: 1.0.2h-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,3 +1,4 @@
include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h)
vcpkg_find_acquire_program(PERL)
@ -56,11 +57,13 @@ file(REMOVE
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf
${CURRENT_PACKAGES_DIR}/openssl.cnf
)
if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/engines)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/engines ${CURRENT_PACKAGES_DIR}/bin/engines)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/engines)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/engines ${CURRENT_PACKAGES_DIR}/debug/bin/engines)
endif()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_copy_pdbs()
else()
# 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()