Skip to content

Commit

Permalink
libressl: add version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-pierre authored and Frenzie committed Dec 29, 2024
1 parent 81fd2e9 commit b0c2c89
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ declare_project(thirdparty/libk2pdfopt DEPENDS leptonica libpng tesseract zlib)
# libpng
declare_project(thirdparty/libpng DEPENDS zlib EXCLUDE_FROM_ALL)

# libressl
# NOTE: `EXCLUDE_FROM_ALL` is not used because `ffi/crypto` needs `libcrypto`.
declare_project(thirdparty/libressl)

# libunibreak
declare_project(thirdparty/libunibreak EXCLUDE_FROM_ALL)

Expand Down
14 changes: 14 additions & 0 deletions thirdparty/cmake_modules/koreader_thirdparty_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ declare_dependency(libk2pdfopt::k2pdfopt INCLUDES k2pdfopt leptonica MONOLIBTIC
# libpng
declare_dependency(libpng::png16 MONOLIBTIC png16)

# libressl
set(CRYPTO_LIBS)
set(SSL_LIBS)
if(MONOLIBTIC)
list(APPEND CRYPTO_LIBS pthread)
list(APPEND SSL_LIBS pthread)
if(NOT ANDROID)
list(APPEND CRYPTO_LIBS rt)
list(APPEND SSL_LIBS rt)
endif()
endif()
declare_dependency(libressl::crypto MONOLIBTIC crypto LIBRARIES ${CRYPTO_LIBS})
declare_dependency(libressl::ssl MONOLIBTIC ssl LIBRARIES ${SSL_LIBS})

# libunibreak
declare_dependency(libunibreak::unibreak MONOLIBTIC unibreak)

Expand Down
30 changes: 30 additions & 0 deletions thirdparty/libressl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
list(APPEND PATCH_FILES
cmake_tweaks.patch
)

list(APPEND CMAKE_ARGS
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DBUILD_SHARED_LIBS=$<NOT:$<BOOL:${MONOLIBTIC}>>
# Project options.
-DLIBRESSL_APPS=OFF
-DLIBRESSL_TESTS=OFF
-DENABLE_ASM=${WANT_SIMD}
)

list(APPEND BUILD_CMD COMMAND ninja)

list(APPEND INSTALL_CMD COMMAND ${CMAKE_COMMAND} --install .)

if(NOT MONOLIBTIC)
append_shared_lib_install_commands(INSTALL_CMD crypto VERSION 55)
append_shared_lib_install_commands(INSTALL_CMD ssl VERSION 58)
endif()

external_project(
DOWNLOAD URL 4775b6b187a93c527eeb95a13e6ebd64
https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/libressl-4.0.0.tar.gz
PATCH_FILES ${PATCH_FILES}
CMAKE_ARGS ${CMAKE_ARGS}
BUILD_COMMAND ${BUILD_CMD}
INSTALL_COMMAND ${INSTALL_CMD}
)
19 changes: 19 additions & 0 deletions thirdparty/libressl/cmake_tweaks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- i/CMakeLists.txt
+++ w/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.16.4)
+cmake_minimum_required (VERSION 3.16.3)
if(MSVC)
cmake_policy(SET CMP0091 NEW)
endif()
@@ -516,8 +516,8 @@
# Create pkgconfig files.
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
- set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
- set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
+ set(libdir \${exec_prefix}/lib)
+ set(includedir \${prefix}/include)
if(PLATFORM_LIBS)
string(REGEX REPLACE ";" " -l" PLATFORM_LDADD ";${PLATFORM_LIBS}")
endif()

0 comments on commit b0c2c89

Please sign in to comment.