Skip to content

Commit

Permalink
update to version 3.8.2 (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgauth authored Dec 1, 2023
1 parent 2048a3a commit c67aa4a
Show file tree
Hide file tree
Showing 1,064 changed files with 60,896 additions and 57,764 deletions.
101 changes: 79 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cmake_minimum_required (VERSION 3.16.4)
if(MSVC)
cmake_minimum_required (VERSION 3.16.4)
cmake_policy(SET CMP0091 NEW)
else()
cmake_minimum_required (VERSION 3.0)
endif()

project (LibreSSL C ASM)
Expand Down Expand Up @@ -41,6 +39,7 @@ option(ENABLE_ASM "Enable assembly" ON)
option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF)
option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
set(LIBRESSL_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/LibreSSL" CACHE STRING "Installation directory for the CMake targets")

option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF)
if(USE_STATIC_MSVC_RUNTIMES)
Expand All @@ -51,6 +50,20 @@ if(NOT LIBRESSL_SKIP_INSTALL)
set( ENABLE_LIBRESSL_INSTALL ON )
endif(NOT LIBRESSL_SKIP_INSTALL)

# Set a default build type if none was specified
set(default_build_type "Release")

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# Enable asserts regardless of build type
add_definitions(-UNDEBUG)

set(BUILD_NC true)

Expand Down Expand Up @@ -79,7 +92,7 @@ if(WIN32 OR (CMAKE_SYSTEM_NAME MATCHES "MINGW"))
add_definitions(-D__USE_MINGW_ANSI_STDIO)
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")

if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
if(CMAKE_C_COMPILER MATCHES "gcc")
Expand Down Expand Up @@ -121,7 +134,7 @@ if(WIN32)
if(NOT CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
add_definitions(-D_WIN32_WINNT=0x0600)
endif()
set(PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32 bcrypt)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32 ntdll bcrypt)
endif()

if(MSVC)
Expand All @@ -135,17 +148,17 @@ if(MSVC)
"C4100" # 'identifier' : unreferenced formal parameter
"C4127" # conditional expression is constant
"C4146" # unary minus operator applied to unsigned type,
# result still unsigned
# result still unsigned
"C4244" # 'argument' : conversion from 'type1' to 'type2',
# possible loss of data
# possible loss of data
"C4245" # 'conversion' : conversion from 'type1' to 'type2',
# signed/unsigned mismatch
# signed/unsigned mismatch
"C4267" # 'var' : conversion from 'size_t' to 'type',
# possible loss of data
# possible loss of data
"C4389" # 'operator' : signed/unsigned mismatch
"C4706" # assignment within conditional expression
"C4996" # The POSIX name for this item is deprecated.
# Instead, use the ISO C and C++ conformant name
# Instead, use the ISO C and C++ conformant name
)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
add_definitions(-D_CRT_SUPPRESS_RESTRICT)
Expand Down Expand Up @@ -176,6 +189,11 @@ if(HAVE_ASPRINTF)
add_definitions(-DHAVE_ASPRINTF)
endif()

check_function_exists(getopt HAVE_GETOPT)
if(HAVE_GETOPT)
add_definitions(-DHAVE_GETOPT)
endif()

check_function_exists(reallocarray HAVE_REALLOCARRAY)
if(HAVE_REALLOCARRAY)
add_definitions(-DHAVE_REALLOCARRAY)
Expand Down Expand Up @@ -306,28 +324,37 @@ if(HAVE_NETINET_IP_H)
add_definitions(-DHAVE_NETINET_IP_H)
endif()

if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64)")
# This isn't ready for universal binaries yet, since we do conditional
# compilation based on the architecture, but this makes cross compiling for a
# single architecture work on macOS at least.
#
# Don't set CMAKE_OSX_ARCHITECTURES to more than a single value for now.
if(APPLE AND (NOT CMAKE_OSX_ARCHITECTURES STREQUAL ""))
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
endif()

if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64|ARM64)")
set(HOST_AARCH64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
set(HOST_ARM true)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
set(HOST_X86_64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64)")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64|AMD64)")
set(HOST_X86_64 true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "[i?86|x86]")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|[xX]86)")
set(ENABLE_ASM false)
set(HOST_I386 true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "mips64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips64")
set(HOST_MIPS64 true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "mips")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
set(HOST_MIPS true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "powerpc")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "powerpc")
set(HOST_POWERPC true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "ppc64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc64")
set(HOST_PPC64 true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "riscv64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "riscv64")
set(HOST_RISCV64 true)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "sparc64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "sparc64")
set(HOST_SPARC64 true)
else()
set(ENABLE_ASM false)
Expand All @@ -348,7 +375,7 @@ if(ENABLE_ASM)
elseif(MSVC AND ("${CMAKE_GENERATOR}" MATCHES "Win64" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64"))
set(HOST_ASM_MASM_X86_64 true)
ENABLE_LANGUAGE(ASM_MASM)
elseif(CMAKE_SYSTEM_NAME MATCHES "MINGW" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
elseif(MINGW AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(HOST_ASM_MINGW64_X86_64 true)
endif()
endif()
Expand All @@ -374,7 +401,6 @@ if(SIZEOF_TIME_T STREQUAL "4")
message(WARNING " ** Warning, this system is unable to represent times past 2038\n"
" ** It will behave incorrectly when handling valid RFC5280 dates")
endif()
add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T})

set(OPENSSL_LIBS ssl crypto ${PLATFORM_LIBS})
set(LIBTLS_LIBS tls ${PLATFORM_LIBS})
Expand Down Expand Up @@ -416,6 +442,38 @@ if (BUILD_APPLE_XCFRAMEWORK)
endif(ENABLE_LIBRESSL_INSTALL)
endif(BUILD_APPLE_XCFRAMEWORK)

file(STRINGS "VERSION" VERSION LIMIT_COUNT 1)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"LibreSSLConfigVersion.cmake"
VERSION "${VERSION}"
COMPATIBILITY SameMajorVersion
)

set(INCLUDE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/LibreSSLConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/LibreSSLConfig.cmake"
PATH_VARS INCLUDE_DIRECTORY
INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
)

if(ENABLE_LIBRESSL_INSTALL)
set(INCLUDE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}")
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/LibreSSLConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install-config/LibreSSLConfig.cmake"
PATH_VARS INCLUDE_DIRECTORY
INSTALL_DESTINATION "${LIBRESSL_INSTALL_CMAKEDIR}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/install-config/LibreSSLConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/LibreSSLConfigVersion.cmake"
DESTINATION "${LIBRESSL_INSTALL_CMAKEDIR}"
)
endif()

if(ENABLE_LIBRESSL_INSTALL)
if(NOT MSVC)
# Create pkgconfig files.
Expand All @@ -426,7 +484,6 @@ if(ENABLE_LIBRESSL_INSTALL)
if(PLATFORM_LIBS)
string(REGEX REPLACE ";" " -l" PLATFORM_LDADD ";${PLATFORM_LIBS}")
endif()
file(STRINGS "VERSION" VERSION LIMIT_COUNT 1)
file(GLOB OPENSSL_PKGCONFIGS "*.pc.in")
foreach(file ${OPENSSL_PKGCONFIGS})
get_filename_component(filename ${file} NAME)
Expand Down
Loading

0 comments on commit c67aa4a

Please sign in to comment.