Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CMAKE_CXX_STANDARD=20
builtin_civetweb=ON
builtin_vdt=ON
pythia8=ON
rootbench=ON
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CMAKE_C_COMPILER=clang
CMAKE_CXX_COMPILER=clang++
CMAKE_GENERATOR=Ninja
builtin_civetweb=ON
builtin_fftw3=ON
builtin_freetype=ON
builtin_ftgl=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CMAKE_BUILD_TYPE=Debug
CMAKE_CXX_FLAGS_DEBUG="-Og -g"
asan=ON
ccache=ON
builtin_civetweb=ON
builtin_vdt=ON
fail-on-missing=ON
minimal=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ccache=ON
builtin_civetweb=ON
builtin_vdt=ON
fail-on-missing=ON
minimal=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/alma10.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
builtin_civetweb=ON
builtin_vdt=ON
pythia8=ON
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/alma8.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
builtin_civetweb=ON
builtin_gtest=ON
builtin_nlohmannjson=ON
builtin_tbb=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
builtin_civetweb=ON
builtin_vdt=ON
pythia8=ON
runtime_cxxmodules=OFF
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/alma9.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
builtin_civetweb=ON
builtin_vdt=ON
davix=OFF
pythia8=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CMAKE_CXX_STANDARD=23
builtin_civetweb=ON
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CMAKE_CXX_STANDARD=23
builtin_civetweb=ON
experimental_adaptivecpp=ON
pythia8=ON
roofit_multiprocess=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CMAKE_CXX_STANDARD=23
builtin_civetweb=ON
experimental_adaptivecpp=ON
pythia8=ON
roofit_multiprocess=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ arrow=OFF
asan=OFF
asimage=ON
asserts=OFF
builtin_civetweb=OFF
builtin_cfitsio=OFF
builtin_clang=ON
builtin_cling=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CMAKE_CXX_STANDARD=23
builtin_cfitsio=ON
builtin_civetweb=ON
builtin_fftw3=ON
builtin_freetype=ON
builtin_ftgl=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac14.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ROOT_CTEST_CUSTOM_FLAGS="-E ^tutorial-"
asimage_tiff=OFF
builtin_cfitsio=ON
builtin_civetweb=ON
builtin_fftw3=ON
builtin_freetype=ON
builtin_ftgl=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac15.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
builtin_cfitsio=ON
builtin_civetweb=ON
builtin_fftw3=ON
builtin_freetype=ON
builtin_ftgl=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac26.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CMAKE_CXX_STANDARD=23
builtin_cfitsio=ON
builtin_civetweb=ON
builtin_fftw3=ON
builtin_freetype=ON
builtin_ftgl=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CMAKE_CXX_FLAGS=-march=native
CMAKE_C_FLAGS=-march=native
CMAKE_CXX_STANDARD=20
builtin_civetweb=ON
builtin_tbb=ON
builtin_vdt=ON
builtin_xrootd=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/rawhide.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
builtin_civetweb=ON
pythia8=ON
test_distrdf_dask=OFF
test_distrdf_pyspark=OFF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
builtin_civetweb=ON
builtin_unuran=ON
builtin_vdt=ON
test_distrdf_dask=OFF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CMAKE_BUILD_TYPE=RelWithDebInfo
builtin_civetweb=ON
cuda=ON
experimental_adaptivecpp=ON
experimental_genvectorx=ON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
builtin_civetweb=ON
experimental_adaptivecpp=ON
experimental_genvectorx=ON
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CMAKE_CXX_STANDARD=23
builtin_civetweb=ON
davix=OFF
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
asimage_tiff=OFF
builtin_cfitsio=ON
builtin_civetweb=ON
builtin_freetype=ON
builtin_ftgl=ON
builtin_gif=ON
Expand Down
45 changes: 45 additions & 0 deletions builtins/civetweb/1385.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 79077517e3d4ee648f47af12215dc1cf10e230a5 Mon Sep 17 00:00:00 2001
From: "V.Shkriabets" <vshcryabets@gmail.com>
Date: Wed, 22 Apr 2026 16:14:18 +0300
Subject: [PATCH] Fixed old variable names

---
src/civetweb.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/civetweb.c b/src/civetweb.c
index f6a60e214..006fa7a2b 100644
--- a/src/civetweb.c
+++ b/src/civetweb.c
@@ -19201,15 +19201,15 @@ get_request(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
conn->accept_gzip = 1;
}
#endif
- h_chunk = get_header(conn->request_info.http_headers,
+ h_chunk = get_header(conn->request_info.http_headers,
conn->request_info.num_headers,
"Transfer-Encoding");
- h_len = get_header(conn->request_info.http_headers,
+ h_len = get_header(conn->request_info.http_headers,
conn->request_info.num_headers,
"Content-Length");
- if (h_chunk != NULL)
- && mg_strcasecmp(cl, "identity")) {
- if ((0!=mg_strcasecmp(cl, "chunked")) || (h_len!=NULL)) {
+ if ((h_chunk != NULL)
+ && mg_strcasecmp(h_chunk, "identity")) {
+ if ((0!=mg_strcasecmp(h_chunk, "chunked")) || (h_len!=NULL)) {
mg_snprintf(conn,
NULL, /* No truncation check for ebuf */
ebuf,
@@ -19224,8 +19224,8 @@ get_request(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
} else if (h_len != NULL) {
/* Request has content length set */
char *endptr = NULL;
- conn->content_len = strtoll(cl, &endptr, 10);
- if ((endptr == cl) || (conn->content_len < 0)) {
+ conn->content_len = strtoll(h_len, &endptr, 10);
+ if ((endptr == h_len) || (conn->content_len < 0)) {
mg_snprintf(conn,
NULL, /* No truncation check for ebuf */
ebuf,
26 changes: 26 additions & 0 deletions builtins/civetweb/1389.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From b8f93aafd3229fff5acea786b74b573202b169f3 Mon Sep 17 00:00:00 2001
From: ferdymercury <ferdymercury@users.noreply.github.com>
Date: Mon, 27 Apr 2026 12:13:45 +0200
Subject: [PATCH] Only include deprecated header when really necessary

deprecated ENGINE API is only used #if !defined(OPENSSL_API_1_1) && !defined(OPENSSL_API_3_0)
---
src/civetweb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/civetweb.c b/src/civetweb.c
index f6a60e214..ecbd1a8a4 100644
--- a/src/civetweb.c
+++ b/src/civetweb.c
@@ -1797,7 +1797,10 @@ typedef struct SSL_CTX SSL_CTX;
#include <openssl/conf.h>
#include <openssl/crypto.h>
#include <openssl/dh.h>
-#include <openssl/engine.h>
+
+#if defined(OPENSSL_API_1_0)
+#include <openssl/engine.h> // deprecated later on
+#endif
#include <openssl/err.h>
#include <openssl/opensslv.h>
#include <openssl/pem.h>
174 changes: 174 additions & 0 deletions builtins/civetweb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
# 10 Apr 2023, https://github.com/civetweb/civetweb/releases/tag/v1.16
set(ROOT_CIVETWEB_VERSION 1.16) # with some patches, so almost 1.17
# set(ROOT_CIVETWEB_HASH "f0e471c1bf4e7804a6cfb41ea9d13e7d623b2bcc7bc1e2a4dd54951a24d60285")
set(ROOT_CIVETWEB_PREFIX ${CMAKE_BINARY_DIR}/builtins/CIVETWEB-prefix)
set(ROOT_CIVETWEB_LIBRARY ${ROOT_CIVETWEB_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}civetweb${CMAKE_STATIC_LIBRARY_SUFFIX})

if (NOT DEFINED GIT_EXECUTABLE)
set(GIT_EXECUTABLE "git")
endif()
# check if the patch has already been applied
if(NOT EXISTS "${ROOT_CIVETWEB_PREFIX}/src/BUILTIN_CIVETWEB/._patched")
set(ROOT_CIVETWEB_PATCH_COMMAND PATCH_COMMAND ${GIT_EXECUTABLE} init COMMAND ${GIT_EXECUTABLE} apply
${CMAKE_CURRENT_SOURCE_DIR}/1385.patch # https://github.com/civetweb/civetweb/pull/1385
${CMAKE_CURRENT_SOURCE_DIR}/1389.patch # https://github.com/civetweb/civetweb/pull/1389
${CMAKE_CURRENT_SOURCE_DIR}/civetweb-marker.diff)
endif()

include(ExternalProject)

# Clear cache variables set by find_package(CIVETWEB)
# to ensure that we use the builtin version
foreach(var CIVETWEB_LIBRARIES CIVETWEB_LIBRARY CIVETWEB_LIBRARY_DEBUG CIVETWEB_LIBRARY_RELEASE CIVETWEB_FOUND CIVETWEB_VERSION CIVETWEB_INCLUDE_DIR CIVETWEB_LIBRARY CIVETWEB_LIBRARIES)
unset(${var})
unset(${var} CACHE)
endforeach()

if(WIN32 AND NOT CMAKE_GENERATOR MATCHES Ninja)
if(winrtdebug)
set(ROOT_CIVETWEB_BUILD_COMMAND_FLAGS "--config Debug")
else()
set(ROOT_CIVETWEB_BUILD_COMMAND_FLAGS "--config $<IF:$<CONFIG:Debug,RelWithDebInfo>,RelWithDebInfo,Release>")
endif()
endif()

if(ssl)
if(OPENSSL_VERSION)
string(REPLACE "." ";" lst ${OPENSSL_VERSION})
list(GET lst 0 ssl_major)
list(GET lst 1 ssl_minor)
else()
MESSAGE(SEND_ERROR "No openSSL version defined.")
endif()

if((${ssl_major} EQUAL "1") AND (${ssl_minor} EQUAL "1"))
MESSAGE(STATUS "Use SSL API VERSION 1.1 for civetweb")
set(ROOT_SSL_API "-DCIVETWEB_SSL_OPENSSL_API_1_1=ON" "-DCIVETWEB_SSL_OPENSSL_API_3_0=OFF" "-DCIVETWEB_SSL_OPENSSL_API_1_0=OFF" "-DCIVETWEB_ENABLE_SSL=ON")
elseif((${ssl_major} EQUAL "3"))
MESSAGE(STATUS "Use SSL API VERSION 3.${ssl_minor} for civetweb")
set(ROOT_SSL_API "-DCIVETWEB_SSL_OPENSSL_API_3_0=ON" "-DCIVETWEB_SSL_OPENSSL_API_1_1=OFF" "-DCIVETWEB_SSL_OPENSSL_API_1_0=OFF" "-DCIVETWEB_ENABLE_SSL=ON")
elseif((${ssl_major} EQUAL "1") AND (${ssl_minor} EQUAL "0"))
MESSAGE(STATUS "Use SSL API VERSION 1.0 for civetweb")
set(ROOT_SSL_API "-DCIVETWEB_SSL_OPENSSL_API_1_0=ON" "-DCIVETWEB_SSL_OPENSSL_API_3_0=OFF" "-DCIVETWEB_SSL_OPENSSL_API_1_1=OFF" "-DCIVETWEB_ENABLE_SSL=ON")
else()
MESSAGE(WARNING "Not able to recognize SSL version ${OPENSSL_VERSION}, disable SSL")
set(ROOT_SSL_API "-DCIVETWEB_ENABLE_SSL=OFF")
endif()
else()
set(ROOT_SSL_API "-DCIVETWEB_ENABLE_SSL=OFF")
endif()
set(ROOT_C_FLAGS ${CMAKE_C_FLAGS})
if (CMAKE_OSX_SYSROOT)
set(ROOT_C_FLAGS "${ROOT_C_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
if(NOT MSVC) # on Windows, one would need to add a patch to #include <afunix.h> and WSAStartup ifdefs...
set(ROOT_X_DOM_SOCKET "-DCIVETWEB_ENABLE_X_DOM_SOCKET=ON")
endif()

# We copy what libpng does for ZLIB
if(builtin_zlib)
set(ZLIB_ROOT_OPTION "-DZLIB_ROOT=${ROOT_ZLIB_PREFIX}")
endif()

if(NOT asan OR MSVC)
set(ROOT_CIVETWEB_ASAN_CMD "-DCIVETWEB_ENABLE_ASAN=OFF")
else()
set(ROOT_CIVETWEB_ASAN_CMD "-DCIVETWEB_ENABLE_ASAN=ON")
endif()

ExternalProject_Add(BUILTIN_CIVETWEB
PREFIX ${ROOT_CIVETWEB_PREFIX}
# URL ${lcgpackages}/civetweb-${ROOT_CIVETWEB_VERSION}.tar.gz
# URL_HASH SHA256=${ROOT_CIVETWEB_HASH}
# TODO: once 1.17 released, bump SearchInstalledSoftware find_package to 1.17 plus remove patches
# and potentially install civetweb in root-ci-images via homebrew and change builtin to OFF in ci-configs
GIT_REPOSITORY https://github.com/civetweb/civetweb.git
GIT_TAG 588860e30721bf5453b0440c390865a8e85dcae5 # v1.17.0 not yet released, v1.16.0 has missing CVE fixes
${ROOT_CIVETWEB_PATCH_COMMAND}
UPDATE_COMMAND ""
LOG_DOWNLOAD TRUE
LOG_CONFIGURE FALSE
LOG_BUILD FALSE
LOG_PATCH FALSE
LOG_INSTALL FALSE
LOG_OUTPUT_ON_FAILURE FALSE
USES_TERMINAL_DOWNLOAD true
USES_TERMINAL_UPDATE true
USES_TERMINAL_BUILD true
USES_TERMINAL_INSTALL true
USES_TERMINAL_TEST true
INSTALL_DIR ${ROOT_CIVETWEB_PREFIX}
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_INSTALL_LIBDIR:PATH=<INSTALL_DIR>/lib
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_FLAGS=${ROOT_C_FLAGS}
-DCMAKE_CXX_FLAGS=${ROOT_EXTERNAL_CXX_FLAGS}
-DCMAKE_C_VISIBILITY_PRESET=hidden
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DBUILD_SHARED_LIBS:BOOL=FALSE
-DBUILD_TESTING=FALSE
-DCIVETWEB_BUILD_TESTING=FALSE
-DCIVETWEB_ENABLE_ASAN=OFF # If set to ON, you need to set below link_library interface to UBSAN libs
-DCIVETWEB_ENABLE_CXX=ON
${ROOT_SSL_API}
-DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=OFF # If set to ON, you need to set below link_library interface to CMAKE_DL_LIBS
-DCIVETWEB_ENABLE_WEBSOCKETS=ON
${ROOT_X_DOM_SOCKET}
-DCIVETWEB_ENABLE_ZLIB=ON
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
-DOPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY}
-DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES}
#-DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX}
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}
#-DOPENSSL_FOUND=TRUE
#-DOpenSSL_FOUND=TRUE
#-DOpenSSL_ROOT=${OPENSSL_ROOT} #For CMake <3.27
#-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
#-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
# -DCMAKE_INSTALL_RPATH:STRING=${rpath_origin}
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
${ZLIB_ROOT_OPTION}
BUILD_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_CIVETWEB_BUILD_COMMAND_FLAGS}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_CIVETWEB_BUILD_COMMAND_FLAGS} --target install
BUILD_BYPRODUCTS
${ROOT_CIVETWEB_LIBRARY}
TIMEOUT 600
)

file(MAKE_DIRECTORY ${ROOT_CIVETWEB_PREFIX}/include)
add_library(civetweb::civetweb IMPORTED STATIC GLOBAL)
add_dependencies(civetweb::civetweb BUILTIN_CIVETWEB)
if(builtin_openssl)
add_dependencies(BUILTIN_CIVETWEB BUILTIN_OPENSSL)
endif()
if(builtin_zlib)
add_dependencies(BUILTIN_CIVETWEB BUILTIN_ZLIB)
endif()
set_target_properties(civetweb::civetweb PROPERTIES
IMPORTED_LOCATION ${ROOT_CIVETWEB_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_CIVETWEB_PREFIX}/include)
target_compile_definitions(civetweb::civetweb INTERFACE CIVETWEB_LIBRARY_STATIC) # needed for Win32 since public flag is not correctly propagated to parent scope (BUILD_SHARED_LIBS works fine for building but when installing, flag info is lost)
if (ssl)
target_link_libraries(civetweb::civetweb INTERFACE OpenSSL::SSL ZLIB::ZLIB)
endif()

# Set the canonical output of find_package according to
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
set(civetweb_INCLUDE_DIRS ${ROOT_CIVETWEB_PREFIX}/include PARENT_SCOPE)
set(civetweb_LIBRARIES ${ROOT_CIVETWEB_LIBRARY} PARENT_SCOPE)
set(civetweb_FOUND TRUE PARENT_SCOPE)
set(civetweb_VERSION ${ROOT_CIVETWEB_VERSION} PARENT_SCOPE)
4 changes: 4 additions & 0 deletions builtins/civetweb/civetweb-marker.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--- /dev/null 2026-03-12 08:23:04
+++ ._patched 2026-04-28 08:20:11
@@ -0,0 +1,1 @@
+civetweb has been patched
Loading
Loading