Revert "Remove zlib"

This reverts commit d874a1fd14.

Conflicts:
* CMakeLists.txt:
  * ENABLE_ZLIB_SUPPORT: there has been a change immediately after
    where it was removed. Just re-add what was removed.
* tests/CMakeLists.txt:
  * ENABLE_ZLIB_SUPPORT: there has been a change immediately after
    where it was removed. Just re-add what was removed.
This commit is contained in:
Gilles Peskine 2020-02-26 19:11:43 +01:00 committed by Ronald Cron
parent 70824f2c9e
commit 5bb8bec1de
6 changed files with 32 additions and 0 deletions

View file

@ -8,6 +8,8 @@ endif()
# Set the project root directory. # Set the project root directory.
set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
option(ENABLE_PROGRAMS "Build mbed TLS programs." ON) option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)
option(UNSAFE_BUILD "Allow unsafe builds. These builds ARE NOT SECURE." OFF) option(UNSAFE_BUILD "Allow unsafe builds. These builds ARE NOT SECURE." OFF)
@ -179,6 +181,14 @@ endif()
include_directories(include/) include_directories(include/)
include_directories(library/) include_directories(library/)
if(ENABLE_ZLIB_SUPPORT)
find_package(ZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
endif(ZLIB_FOUND)
endif(ENABLE_ZLIB_SUPPORT)
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(3rdparty) add_subdirectory(3rdparty)

View file

@ -148,6 +148,10 @@ if(HAIKU)
set(libs ${libs} network) set(libs ${libs} network)
endif(HAIKU) endif(HAIKU)
if(ENABLE_ZLIB_SUPPORT)
set(libs ${libs} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB_SUPPORT)
if(LINK_WITH_PTHREAD) if(LINK_WITH_PTHREAD)
set(libs ${libs} pthread) set(libs ${libs} pthread)
endif() endif()

View file

@ -44,6 +44,11 @@ EXEXT=
SHARED_SUFFIX= SHARED_SUFFIX=
endif endif
# Zlib shared library extensions:
ifdef ZLIB
LOCAL_LDFLAGS += -lz
endif
APPS = \ APPS = \
aes/aescrypt2$(EXEXT) \ aes/aescrypt2$(EXEXT) \
aes/crypt_and_hash$(EXEXT) \ aes/crypt_and_hash$(EXEXT) \

View file

@ -2,6 +2,10 @@ set(libs
mbedtls mbedtls
) )
if(ENABLE_ZLIB_SUPPORT)
set(libs ${libs} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB_SUPPORT)
add_executable(selftest selftest.c) add_executable(selftest selftest.c)
target_link_libraries(selftest ${libs}) target_link_libraries(selftest ${libs})

View file

@ -9,6 +9,10 @@ if(NOT DEFINED MBEDTLS_DIR)
set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR}) set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR})
endif() endif()
if(ENABLE_ZLIB_SUPPORT)
set(libs ${libs} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB_SUPPORT)
find_package(PythonInterp) find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND) if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Cannot build test suites without Python 2 or 3") message(FATAL_ERROR "Cannot build test suites without Python 2 or 3")

View file

@ -55,6 +55,11 @@ SHARED_SUFFIX=
PYTHON ?= python2 PYTHON ?= python2
endif endif
# Zlib shared library extensions:
ifdef ZLIB
LOCAL_LDFLAGS += -lz
endif
# A test application is built for each suites/test_suite_*.data file. # A test application is built for each suites/test_suite_*.data file.
# Application name is same as .data file's base name and can be # Application name is same as .data file's base name and can be
# constructed by stripping path 'suites/' and extension .data. # constructed by stripping path 'suites/' and extension .data.