Skip to content

Commit 83d2d22

Browse files
committed
[builtins] download instead of bundle PCRE and bump from PCRE_8.43 to PCRE2_10.47
and lift CMAKE 3.5 policy version Delete builtins/pcre/pcre-8.43.tar.bz2 [ci] test builtin_pcre also on Linux to check no conflicts with system library as suggested by dpiparo [cmake] fix library name on non unix thanks to dpiparo [cmake] simplify dependency check for pcre2 builtin matches 6.40 release notes and openssl behavior [core] depend on builtin
1 parent 4aacb18 commit 83d2d22

5 files changed

Lines changed: 49 additions & 41 deletions

File tree

.github/workflows/root-ci-config/buildconfig/alma10-clang_ninja.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ builtin_gif=ON
66
builtin_jpeg=ON
77
builtin_lz4=ON
88
builtin_lzma=ON
9+
builtin_pcre=ON
910
builtin_png=ON
1011
builtin_vdt=ON
1112
builtin_zlib=ON

builtins/pcre/CMakeLists.txt

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,53 @@
44
# For the licensing terms see $ROOTSYS/LICENSE.
55
# For the list of contributors see $ROOTSYS/README/CREDITS.
66

7+
# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
8+
# 21 Oct 2025, https://github.com/PCRE2Project/pcre2/releases/tag/pcre2-10.47
9+
set(ROOT_PCRE2_VERSION 10.47)
10+
set(ROOT_PCRE2_HASH "47fe8c99461250d42f89e6e8fdaeba9da057855d06eb7fc08d9ca03fd08d7bc7")
11+
712
include(ExternalProject)
813

9-
# Clear cache variables set by find_package(PCRE)
14+
# Clear cache variables set by find_package(PCRE) and/or find_package(PCRE2)
1015
# to ensure that we use the builtin version
11-
foreach(var PCRE_FOUND PCRE_VERSION PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_LIBRARIES)
16+
foreach(var PCRE_FOUND PCRE_VERSION PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_LIBRARIES PCRE2_FOUND PCRE2_VERSION PCRE2_INCLUDE_DIR PCRE2_PCRE2_LIBRARY PCRE2_LIBRARIES)
1217
unset(${var} CACHE)
1318
endforeach()
1419

1520
if(WIN32)
1621
if(CMAKE_GENERATOR MATCHES Ninja)
1722
if (CMAKE_BUILD_TYPE MATCHES Debug)
18-
set(PCRE_POSTFIX d)
23+
set(PCRE2_POSTFIX d)
1924
endif()
2025
else()
2126
if(winrtdebug)
22-
set(PCRE_POSTFIX $<$<CONFIG:Debug>:d>)
23-
set(pcre_config_kind "Debug")
27+
set(PCRE2_POSTFIX $<$<CONFIG:Debug>:d>)
28+
set(pcre2_config_kind "Debug")
2429
else()
25-
set(pcre_config_kind "Release")
30+
set(pcre2_config_kind "Release")
2631
endif()
27-
set(pcre_config "--config ${pcre_config_kind}")
32+
set(pcre2_config "--config ${pcre2_config_kind}")
2833
endif()
2934
endif()
3035

31-
set(PCRE_VERSION "8.43" CACHE INTERNAL "" FORCE)
32-
set(PCRE_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}pcre${PCRE_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
36+
set(PCRE2_VERSION ${ROOT_PCRE2_VERSION} CACHE INTERNAL "" FORCE)
37+
if(MSVC)
38+
set(PCRE2_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}pcre2-8-static${PCRE2_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
39+
else()
40+
set(PCRE2_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}pcre2-8${PCRE2_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
41+
endif()
3342

3443
# build byproducts only needed by Ninja
3544
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
36-
set(PCRE_BYPRODUCTS
37-
<BINARY_DIR>/pcre.h
38-
<BINARY_DIR>/${PCRE_LIBNAME}
45+
set(PCRE2_BYPRODUCTS
46+
<BINARY_DIR>/interface/pcre2.h
47+
<BINARY_DIR>/${PCRE2_LIBNAME}
3948
)
4049
endif()
4150

42-
ExternalProject_Add(PCRE
43-
URL ${CMAKE_CURRENT_SOURCE_DIR}/pcre-${PCRE_VERSION}.tar.bz2
44-
URL_HASH SHA256=f1026a7f455b8ba726d6fff94d5f989e55ad55f7b4eb946938803ac2aa41743c
51+
ExternalProject_Add(BUILTIN_PCRE
52+
URL ${lcgpackages}/pcre2-${PCRE2_VERSION}.tar.bz2
53+
URL_HASH SHA256=${ROOT_PCRE2_HASH}
4554

4655
LOG_DOWNLOAD TRUE
4756
LOG_CONFIGURE TRUE
@@ -56,35 +65,34 @@ ExternalProject_Add(PCRE
5665
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
5766
-DCMAKE_BUILD_SHARED_LIBS:BOOL=FALSE
5867
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
59-
-DCMAKE_POLICY_VERSION_MINIMUM:STRING=3.5
60-
-DPCRE_BUILD_TESTS:BOOL=FALSE
68+
-DPCRE2_BUILD_TESTS:BOOL=FALSE
6169

6270
BUILD_COMMAND
63-
${CMAKE_COMMAND} --build <BINARY_DIR> ${pcre_config} --target pcre
71+
${CMAKE_COMMAND} --build <BINARY_DIR> ${pcre2_config} --target pcre2-8-static
6472

6573
BUILD_BYPRODUCTS
66-
${PCRE_BYPRODUCTS}
74+
${PCRE2_BYPRODUCTS}
6775

6876
INSTALL_COMMAND ""
6977
TIMEOUT 600
7078
)
7179

72-
ExternalProject_Get_Property(PCRE BINARY_DIR)
80+
ExternalProject_Get_Property(BUILTIN_PCRE BINARY_DIR)
7381

74-
set(PCRE_FOUND TRUE CACHE INTERNAL "" FORCE)
75-
set(PCRE_INCLUDE_DIR "${BINARY_DIR}" CACHE INTERNAL "" FORCE)
82+
set(PCRE2_FOUND TRUE CACHE INTERNAL "" FORCE)
83+
set(PCRE2_INCLUDE_DIR "${BINARY_DIR}/interface" CACHE INTERNAL "" FORCE)
7684
if(WIN32)
77-
set(PCRE_PCRE_LIBRARY "${BINARY_DIR}/${pcre_config_kind}/${PCRE_LIBNAME}" CACHE INTERNAL "" FORCE)
85+
set(PCRE2_PCRE2_LIBRARY "${BINARY_DIR}/${pcre2_config_kind}/${PCRE2_LIBNAME}" CACHE INTERNAL "" FORCE)
7886
else()
79-
set(PCRE_PCRE_LIBRARY "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PCRE_LIBNAME}" CACHE INTERNAL "" FORCE)
87+
set(PCRE2_PCRE2_LIBRARY "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PCRE2_LIBNAME}" CACHE INTERNAL "" FORCE)
8088
endif()
81-
set(PCRE_LIBRARIES "${PCRE_PCRE_LIBRARY}" CACHE INTERNAL "" FORCE)
82-
set(PCRE_TARGET PCRE)
89+
set(PCRE2_LIBRARIES "${PCRE2_PCRE2_LIBRARY}" CACHE INTERNAL "" FORCE)
90+
set(PCRE2_TARGET PCRE2)
8391

84-
add_library(pcre_builtin INTERFACE)
85-
target_include_directories(pcre_builtin INTERFACE $<BUILD_INTERFACE:${PCRE_INCLUDE_DIR}>)
86-
target_link_libraries(pcre_builtin INTERFACE $<BUILD_INTERFACE:${PCRE_LIBRARIES}>)
87-
add_library(PCRE::PCRE ALIAS pcre_builtin)
88-
add_dependencies(pcre_builtin PCRE)
92+
add_library(pcre2_builtin INTERFACE)
93+
target_include_directories(pcre2_builtin INTERFACE $<BUILD_INTERFACE:${PCRE2_INCLUDE_DIR}>)
94+
target_link_libraries(pcre2_builtin INTERFACE $<BUILD_INTERFACE:${PCRE2_LIBRARIES}>)
95+
add_library(PCRE2::PCRE2 ALIAS pcre2_builtin)
96+
add_dependencies(pcre2_builtin PCRE2)
8997

90-
set_property(GLOBAL APPEND PROPERTY ROOT_BUILTIN_TARGETS PCRE)
98+
set_property(GLOBAL APPEND PROPERTY ROOT_BUILTIN_TARGETS BUILTIN_PCRE)

builtins/pcre/pcre-8.43.tar.bz2

-1.51 MB
Binary file not shown.

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ ROOT_FIND_REQUIRED_DEP(LZ4 builtin_lz4)
123123
ROOT_FIND_REQUIRED_DEP(LibLZMA builtin_lzma)
124124
ROOT_FIND_REQUIRED_DEP(ZLIB builtin_zlib)
125125
ROOT_FIND_REQUIRED_DEP(ZSTD builtin_zstd)
126+
# ROOT_FIND_REQUIRED_DEP(PCRE2 builtin_pcre) More complex due to multiple versions, dealt below
126127

127128
if(NOT "${MISSING_PACKAGES}" STREQUAL "")
128129
message(FATAL_ERROR "The following packages need to be installed or enabled to build ROOT: ${MISSING_PACKAGES}")
@@ -287,21 +288,16 @@ if(NOT builtin_pcre)
287288
endforeach()
288289
find_package(PCRE2)
289290
if(NOT PCRE2_FOUND)
290-
if(fail-on-missing)
291-
find_package(PCRE REQUIRED)
292-
else()
293-
find_package(PCRE)
294-
if(NOT PCRE_FOUND)
295-
message(STATUS "PCRE not found. Switching on builtin_pcre option")
296-
set(builtin_pcre ON CACHE BOOL "Enabled because PCRE not found (${builtin_pcre_description})" FORCE)
297-
endif()
291+
find_package(PCRE)
292+
if(NOT PCRE_FOUND)
293+
message(SEND_ERROR "PCRE2 required but not found. Install it on the system (preferred), or explicitly request the builtin version.")
298294
endif()
299295
endif()
300296
endif()
301297

302298
if(builtin_pcre)
303-
list(APPEND ROOT_BUILTINS PCRE)
304299
add_subdirectory(builtins/pcre)
300+
list(APPEND ROOT_BUILTINS BUILTIN_PCRE)
305301
endif()
306302

307303
#---Check for LZMA-------------------------------------------------------------------

core/base/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ if(PCRE2_FOUND)
265265
else()
266266
target_link_libraries(Core PRIVATE PCRE::PCRE)
267267
endif()
268+
if(builtin_xxhash)
269+
add_dependencies(Core BUILTIN_PCRE)
270+
endif()
268271

269272
ROOT_INSTALL_HEADERS(${BASE_HEADER_DIRS})
270273

0 commit comments

Comments
 (0)