Some cleanups. No code changes. (0.40.5)
This commit is contained in:
parent
bb704a3778
commit
d8540a33eb
4 changed files with 0 additions and 193 deletions
|
|
@ -1,100 +0,0 @@
|
|||
## LibreSSL optional integration (MD5, etc.)
|
||||
|
||||
option(FUN_WITH_LIBRESSL "Enable LibreSSL-based features (e.g., md5)" OFF)
|
||||
|
||||
set(LIBRESSL_INCLUDE_DIRS "")
|
||||
set(LIBRESSL_LINK_LIBS "")
|
||||
|
||||
if(FUN_WITH_LIBRESSL)
|
||||
# We must NOT depend on OpenSSL being installed. Detect LibreSSL directly.
|
||||
# Strategy (in order):
|
||||
# 1) Prefer pkg-config 'libressl' if available (brings ssl+crypto and headers)
|
||||
# 2) Else, prefer explicit LibreSSL include prefix (/usr/include/libressl)
|
||||
# 3) Else, fall back to generic OpenSSL-compatible headers, but only if they
|
||||
# are provided by LibreSSL (detected heuristically via opensslv.h content)
|
||||
# 4) Link against libcrypto (from LibreSSL). No OpenSSL::Crypto usage.
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(FindPkgConfig)
|
||||
|
||||
set(_libressl_found FALSE)
|
||||
|
||||
# 1) Try pkg-config: libressl (meta) or libtls (often implies LibreSSL presence)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(LIBRESSL_PKG QUIET libressl)
|
||||
if(LIBRESSL_PKG_FOUND)
|
||||
list(APPEND LIBRESSL_INCLUDE_DIRS ${LIBRESSL_PKG_INCLUDE_DIRS})
|
||||
list(APPEND LIBRESSL_LINK_LIBS ${LIBRESSL_PKG_LIBRARIES})
|
||||
set(_libressl_found TRUE)
|
||||
else()
|
||||
# Some distros provide only crypto/ssl pc files from LibreSSL
|
||||
pkg_check_modules(LIBRESSL_CRYPTO QUIET libcrypto)
|
||||
pkg_check_modules(LIBRESSL_SSL QUIET libssl)
|
||||
if(LIBRESSL_CRYPTO_FOUND)
|
||||
list(APPEND LIBRESSL_INCLUDE_DIRS ${LIBRESSL_CRYPTO_INCLUDE_DIRS})
|
||||
list(APPEND LIBRESSL_LINK_LIBS ${LIBRESSL_CRYPTO_LIBRARIES})
|
||||
if(LIBRESSL_SSL_FOUND)
|
||||
list(APPEND LIBRESSL_INCLUDE_DIRS ${LIBRESSL_SSL_INCLUDE_DIRS})
|
||||
list(APPEND LIBRESSL_LINK_LIBS ${LIBRESSL_SSL_LIBRARIES})
|
||||
endif()
|
||||
set(_libressl_found TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 2) Prefer explicit LibreSSL include prefix if present
|
||||
if(EXISTS "/usr/include/libressl")
|
||||
list(PREPEND LIBRESSL_INCLUDE_DIRS "/usr/include/libressl")
|
||||
set(_libressl_found TRUE)
|
||||
endif()
|
||||
|
||||
# 3) Heuristic: check if the generic openssl headers are from LibreSSL
|
||||
if(NOT _libressl_found)
|
||||
# Try to find opensslv.h and see if it defines LIBRESSL_VERSION_NUMBER
|
||||
find_path(_GEN_OPENSSL_INCLUDE_DIR openssl/opensslv.h
|
||||
PATHS /usr/include /usr/local/include)
|
||||
if(_GEN_OPENSSL_INCLUDE_DIR)
|
||||
file(READ "${_GEN_OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" _opensslv_h CONTENT_STRIP_TRAILING_WHITESPACE)
|
||||
string(FIND "${_opensslv_h}" "LIBRESSL_VERSION_NUMBER" _idx)
|
||||
if(NOT _idx EQUAL -1)
|
||||
list(APPEND LIBRESSL_INCLUDE_DIRS "${_GEN_OPENSSL_INCLUDE_DIR}")
|
||||
set(_libressl_found TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 4) Find the crypto library (from LibreSSL). Avoid CMake's OpenSSL package and target.
|
||||
if(NOT LIBRESSL_LINK_LIBS)
|
||||
# Try to locate libcrypto first
|
||||
find_library(LIBRESSL_CRYPTO_LIB NAMES crypto libcrypto PATHS
|
||||
/usr/lib /usr/local/lib /lib)
|
||||
if(LIBRESSL_CRYPTO_LIB)
|
||||
list(APPEND LIBRESSL_LINK_LIBS ${LIBRESSL_CRYPTO_LIB})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _libressl_found OR NOT LIBRESSL_LINK_LIBS)
|
||||
message(FATAL_ERROR "FUN_WITH_LIBRESSL=ON but LibreSSL headers and/or libcrypto not found.\n"
|
||||
"Tried pkg-config (libressl/libcrypto), /usr/include/libressl, and generic openssl headers from LibreSSL.")
|
||||
endif()
|
||||
|
||||
# Ensure the compile definition is visible even if targets are created later
|
||||
add_compile_definitions(FUN_WITH_LIBRESSL=1)
|
||||
|
||||
# Propagate to main targets if they exist in this scope
|
||||
if(TARGET fun_core)
|
||||
target_link_libraries(fun_core PRIVATE ${LIBRESSL_LINK_LIBS})
|
||||
target_include_directories(fun_core PRIVATE ${LIBRESSL_INCLUDE_DIRS})
|
||||
target_compile_definitions(fun_core PRIVATE FUN_WITH_LIBRESSL=1)
|
||||
endif()
|
||||
if(TARGET fun)
|
||||
target_link_libraries(fun PRIVATE ${LIBRESSL_LINK_LIBS})
|
||||
target_include_directories(fun PRIVATE ${LIBRESSL_INCLUDE_DIRS})
|
||||
target_compile_definitions(fun PRIVATE FUN_WITH_LIBRESSL=1)
|
||||
endif()
|
||||
if(TARGET fun_test)
|
||||
target_link_libraries(fun_test PRIVATE ${LIBRESSL_LINK_LIBS})
|
||||
target_include_directories(fun_test PRIVATE ${LIBRESSL_INCLUDE_DIRS})
|
||||
target_compile_definitions(fun_test PRIVATE FUN_WITH_LIBRESSL=1)
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# libsql
|
||||
option(FUN_WITH_LIBSQL "Enable libsql (Turso) client support" OFF)
|
||||
set(LIBSQL_INCLUDE_DIRS "")
|
||||
set(LIBSQL_LINK_LIBS "")
|
||||
if(FUN_WITH_LIBSQL)
|
||||
add_definitions(-DFUN_WITH_LIBSQL)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(LIBSQL QUIET libsql)
|
||||
if(NOT LIBSQL_FOUND)
|
||||
pkg_check_modules(LIBSQL_CLIENT QUIET libsql-client)
|
||||
if(LIBSQL_CLIENT_FOUND)
|
||||
set(LIBSQL_FOUND TRUE)
|
||||
set(LIBSQL_INCLUDE_DIRS ${LIBSQL_CLIENT_INCLUDE_DIRS})
|
||||
set(LIBSQL_LINK_LIBS ${LIBSQL_CLIENT_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT LIBSQL_FOUND)
|
||||
find_library(LIBSQL_LIB sqlite3)
|
||||
if(LIBSQL_LIB)
|
||||
list(APPEND LIBSQL_LINK_LIBS ${LIBSQL_LIB})
|
||||
else()
|
||||
message(FATAL_ERROR "libsql not found. Install libsql (or compatible sqlite3 client) or disable FUN_WITH_LIBSQL.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# Notcurses
|
||||
option(FUN_WITH_NOTCURSES "Enable Notcurses TUI support" OFF)
|
||||
set(NOTCURSES_INCLUDE_DIRS "")
|
||||
set(NOTCURSES_LINK_LIBS "")
|
||||
if(FUN_WITH_NOTCURSES)
|
||||
add_definitions(-DFUN_WITH_NOTCURSES)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(NOTCURSES QUIET notcurses)
|
||||
if(NOT NOTCURSES_FOUND)
|
||||
pkg_check_modules(NOTCURSES QUIET notcurses-core)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT NOTCURSES_FOUND)
|
||||
message(FATAL_ERROR "FUN_WITH_NOTCURSES=ON but notcurses was not found via pkg-config (tried notcurses and notcurses-core). Install notcurses or configure with -DFUN_WITH_NOTCURSES=OFF")
|
||||
else()
|
||||
list(APPEND NOTCURSES_INCLUDE_DIRS ${NOTCURSES_INCLUDE_DIRS} ${NOTCURSES_INCLUDE_DIRS})
|
||||
list(APPEND NOTCURSES_LINK_LIBS ${NOTCURSES_LINK_LIBS} ${NOTCURSES_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# Tcl/Tk GUI support
|
||||
option(FUN_WITH_TCLTK "Enable Tcl/Tk GUI support" OFF)
|
||||
set(TCL_INCLUDE_DIRS "")
|
||||
set(TCL_LINK_LIBS "")
|
||||
if(FUN_WITH_TCLTK)
|
||||
add_definitions(-DFUN_WITH_TCLTK)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(TCL QUIET tcl)
|
||||
pkg_check_modules(TK QUIET tk)
|
||||
endif()
|
||||
if(TCL_FOUND OR TK_FOUND)
|
||||
if(TCL_FOUND)
|
||||
list(APPEND TCL_INCLUDE_DIRS ${TCL_INCLUDE_DIRS} ${TCL_INCLUDE_DIRS})
|
||||
list(APPEND TCL_LINK_LIBS ${TCL_LINK_LIBS} ${TCL_LIBRARIES})
|
||||
endif()
|
||||
if(TK_FOUND)
|
||||
list(APPEND TCL_INCLUDE_DIRS ${TCL_INCLUDE_DIRS} ${TK_INCLUDE_DIRS})
|
||||
list(APPEND TCL_LINK_LIBS ${TCL_LINK_LIBS} ${TK_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
find_path(TCL_INCLUDE_DIR tcl.h PATH_SUFFIXES tcl8.7 tcl8.6 include)
|
||||
find_library(TCL_LIB NAMES tcl8.7 tcl8.6 tcl)
|
||||
find_library(TK_LIB NAMES tk8.7 tk8.6 tk)
|
||||
if(TCL_INCLUDE_DIR)
|
||||
list(APPEND TCL_INCLUDE_DIRS ${TCL_INCLUDE_DIR})
|
||||
endif()
|
||||
if(TCL_LIB)
|
||||
list(APPEND TCL_LINK_LIBS ${TCL_LIB})
|
||||
endif()
|
||||
if(TK_LIB)
|
||||
list(APPEND TCL_LINK_LIBS ${TK_LIB})
|
||||
endif()
|
||||
if(APPLE)
|
||||
# macOS frameworks often unnecessary when using Homebrew tcl/tk
|
||||
elseif(WIN32)
|
||||
list(APPEND TCL_LINK_LIBS user32 gdi32 comctl32)
|
||||
else()
|
||||
find_package(X11 QUIET)
|
||||
if(X11_FOUND)
|
||||
list(APPEND TCL_INCLUDE_DIRS ${X11_INCLUDE_DIR})
|
||||
list(APPEND TCL_LINK_LIBS ${X11_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
Loading…
Add table
Add a link
Reference in a new issue