1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:37:44 +00:00

Meta: Download cacert.pem at build time

This commit is contained in:
Fabian Dellwing 2023-03-14 14:12:58 +01:00 committed by Ali Mohammad Pur
parent 06340ca674
commit b07654c3c1
4 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,23 @@
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
set(CACERT_PATH "${SERENITY_CACHE_DIR}/CACERT" CACHE PATH "Download location for cacert.pem")
set(CACERT_VERSION 2023-01-10)
set(CACERT_VERSION_FILE "${CACERT_PATH}/version.txt")
set(CACERT_FILE cacert-${CACERT_VERSION}.pem)
set(CACERT_URL https://curl.se/ca/${CACERT_FILE})
set(CACERT_INSTALL_FILE cacert.pem)
if (ENABLE_CACERT_DOWNLOAD)
remove_path_if_version_changed("${CACERT_VERSION}" "${CACERT_VERSION_FILE}" "${CACERT_PATH}")
download_file("${CACERT_URL}" "${CACERT_PATH}/${CACERT_FILE}")
if (SERENITYOS)
set(CACERT_INSTALL_PATH ${CMAKE_STAGING_PREFIX}/etc/${CACERT_INSTALL_FILE})
else()
set(CACERT_INSTALL_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CACERT_INSTALL_FILE})
endif()
configure_file(${CACERT_PATH}/${CACERT_FILE} ${CACERT_INSTALL_PATH} COPYONLY)
endif()

View file

@ -18,6 +18,7 @@ serenity_option(ENABLE_TIME_ZONE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable downloa
serenity_option(ENABLE_UNICODE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of Unicode UCD and CLDR files at build time") serenity_option(ENABLE_UNICODE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of Unicode UCD and CLDR files at build time")
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite") serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
serenity_option(INCLUDE_FLAC_SPEC_TESTS OFF CACHE BOOL "Download and include the FLAC spec testsuite") serenity_option(INCLUDE_FLAC_SPEC_TESTS OFF CACHE BOOL "Download and include the FLAC spec testsuite")
serenity_option(ENABLE_CACERT_DOWNLOAD ON CACHE BOOL "Enable download of cacert.pem at build time")
serenity_option(HACKSTUDIO_BUILD OFF CACHE BOOL "Automatically enabled when building from HackStudio") serenity_option(HACKSTUDIO_BUILD OFF CACHE BOOL "Automatically enabled when building from HackStudio")

View file

@ -588,7 +588,6 @@ if (BUILD_LAGOM)
LibPDF LibPDF
LibSQL LibSQL
LibTextCodec LibTextCodec
LibTLS
LibTTF LibTTF
LibTimeZone LibTimeZone
LibUnicode LibUnicode
@ -602,6 +601,9 @@ if (BUILD_LAGOM)
add_serenity_subdirectory("Tests/${dir}") add_serenity_subdirectory("Tests/${dir}")
endforeach() endforeach()
# LibTLS needs a special working directory to find cacert.pem
lagom_test(../../Tests/LibTLS/TestTLSHandshake.cpp LibTLS LIBS LibTLS LibCrypto)
# LibCore # LibCore
lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore) lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore)
@ -717,3 +719,5 @@ if (NOT "$ENV{LAGOM_TARGET}" STREQUAL "")
VERBATIM VERBATIM
) )
endif() endif()
include(ca_certificates_data)

View file

@ -13,3 +13,5 @@ set(SOURCES
serenity_lib(LibTLS tls) serenity_lib(LibTLS tls)
target_link_libraries(LibTLS PRIVATE LibCore LibCrypto) target_link_libraries(LibTLS PRIVATE LibCore LibCrypto)
include(ca_certificates_data)