Skip to content

Commit f31fe00

Browse files
committed
Merge branch 'PHP-8.4'
2 parents dff9100 + 3794b69 commit f31fe00

File tree

8 files changed

+65
-51
lines changed

8 files changed

+65
-51
lines changed

cmake/cmake/Requirements.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ if(
119119
set(RE2C_USE_COMPUTED_GOTOS TRUE)
120120
endif()
121121

122-
set(RE2C_ENABLE_DOWNLOAD TRUE)
123122
set(
124123
RE2C_DEFAULT_OPTIONS
125124
--no-generation-date # Suppress date output in the generated file.

cmake/cmake/modules/FindRE2C.cmake

+56-42
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ Custom target:
3636
`find_package(RE2C)`. Options are prepended to additional options passed with
3737
`re2c_target()` arguments.
3838
39-
* `RE2C_ENABLE_DOWNLOAD` - This module can also download and build re2c from its
40-
Git repository using the `FetchContent` module. Set to `TRUE` to enable
41-
downloading re2c, when not found on the system or system version is not
42-
suitable.
39+
* `RE2C_DISABLE_DOWNLOAD` - This module can also download and build re2c from
40+
its Git repository using the `ExternalProject` module. Set to `TRUE` to
41+
disable downloading re2c, when it is not found on the system or system version
42+
is not suitable.
4343
4444
* `RE2C_USE_COMPUTED_GOTOS` - Set to `TRUE` before calling `find_package(RE2C)`
4545
to enable the re2c `--computed-gotos` option if the non-standard C
@@ -103,16 +103,16 @@ if(RE2C_EXECUTABLE)
103103
execute_process(
104104
COMMAND ${RE2C_EXECUTABLE} --vernum
105105
OUTPUT_VARIABLE RE2C_VERSION_NUM
106-
ERROR_VARIABLE _re2c_version_error
107-
RESULT_VARIABLE _re2c_version_result
106+
ERROR_VARIABLE _re2cVersionError
107+
RESULT_VARIABLE _re2cVersionResult
108108
OUTPUT_STRIP_TRAILING_WHITESPACE
109109
)
110110

111-
if(NOT _re2c_version_result EQUAL 0)
111+
if(NOT _re2cVersionResult EQUAL 0)
112112
message(
113113
SEND_ERROR
114114
"Command \"${RE2C_EXECUTABLE} --vernum\" failed with output:\n"
115-
"${_re2c_version_error}"
115+
"${_re2cVersionError}"
116116
)
117117
elseif(RE2C_VERSION_NUM)
118118
math(
@@ -127,61 +127,75 @@ if(RE2C_EXECUTABLE)
127127

128128
math(
129129
EXPR RE2C_VERSION_PATCH
130-
"${RE2C_VERSION_NUM} - ${RE2C_VERSION_MAJOR} * 10000 - ${RE2C_VERSION_MINOR} * 100"
130+
"${RE2C_VERSION_NUM} \
131+
- ${RE2C_VERSION_MAJOR} * 10000 \
132+
- ${RE2C_VERSION_MINOR} * 100"
131133
)
132134

133-
set(RE2C_VERSION "${RE2C_VERSION_MAJOR}.${RE2C_VERSION_MINOR}.${RE2C_VERSION_PATCH}")
135+
set(
136+
RE2C_VERSION
137+
"${RE2C_VERSION_MAJOR}.${RE2C_VERSION_MINOR}.${RE2C_VERSION_PATCH}"
138+
)
134139

135-
find_package_check_version("${RE2C_VERSION}" _re2c_version_valid)
140+
find_package_check_version("${RE2C_VERSION}" _re2cVersionValid)
136141
endif()
137142
endif()
138143

139-
if(RE2C_ENABLE_DOWNLOAD AND (NOT RE2C_EXECUTABLE OR NOT _re2c_version_valid))
140-
include(FetchContent)
144+
set(_re2cRequiredVars RE2C_EXECUTABLE RE2C_VERSION)
141145

146+
if(NOT RE2C_DISABLE_DOWNLOAD AND (NOT RE2C_EXECUTABLE OR NOT _re2cVersionValid))
142147
# Set the re2c version to download.
143-
set(RE2C_VERSION 3.1)
144-
145-
# Configure re2c.
146-
set(RE2C_BUILD_RE2GO OFF CACHE INTERNAL "")
147-
set(RE2C_BUILD_RE2RUST OFF CACHE INTERNAL "")
148-
149-
# Disable searching for Python as it is not needed in FetchContent build.
150-
set(CMAKE_DISABLE_FIND_PACKAGE_Python3 TRUE)
151-
set(Python3_VERSION 3.12)
152-
153-
set(FETCHCONTENT_QUIET FALSE)
154-
155-
FetchContent_Declare(
156-
RE2C
157-
URL https://github.com/skvadrik/re2c/archive/refs/tags/${RE2C_VERSION}.tar.gz
148+
set(RE2C_VERSION 4.0.2)
149+
150+
include(ExternalProject)
151+
152+
ExternalProject_Add(
153+
re2c
154+
URL
155+
https://github.com/skvadrik/re2c/archive/refs/tags/${RE2C_VERSION}.tar.gz
156+
CMAKE_ARGS
157+
-DRE2C_BUILD_RE2D=OFF
158+
-DRE2C_BUILD_RE2D=OFF
159+
-DRE2C_BUILD_RE2GO=OFF
160+
-DRE2C_BUILD_RE2HS=OFF
161+
-DRE2C_BUILD_RE2JAVA=OFF
162+
-DRE2C_BUILD_RE2JS=OFF
163+
-DRE2C_BUILD_RE2OCAML=OFF
164+
-DRE2C_BUILD_RE2PY=OFF
165+
-DRE2C_BUILD_RE2RUST=OFF
166+
-DRE2C_BUILD_RE2V=OFF
167+
-DRE2C_BUILD_RE2ZIG=OFF
168+
-DRE2C_BUILD_TESTS=OFF
169+
INSTALL_COMMAND ""
158170
)
159171

160-
message(STATUS "Downloading RE2C")
161-
FetchContent_MakeAvailable(RE2C)
162-
163-
# Set executable to re2c target name.
164-
set(RE2C_EXECUTABLE re2c)
172+
# Set re2c executable.
173+
ExternalProject_Get_property(re2c BINARY_DIR)
174+
add_executable(RE2C::RE2C IMPORTED)
175+
set_target_properties(
176+
RE2C::RE2C
177+
PROPERTIES IMPORTED_LOCATION ${BINARY_DIR}/re2c
178+
)
179+
add_dependencies(RE2C::RE2C re2c)
180+
set_property(CACHE RE2C_EXECUTABLE PROPERTY VALUE RE2C::RE2C)
165181

166-
# Unset temporary variables.
167-
unset(CMAKE_DISABLE_FIND_PACKAGE_Python3)
168-
unset(Python3_VERSION)
169-
unset(FETCHCONTENT_QUIET)
182+
list(PREPEND _re2cRequiredVars _re2cMsg)
183+
set(_re2cMsg "downloading at build")
170184
endif()
171185

172186
mark_as_advanced(RE2C_EXECUTABLE)
173187

174188
find_package_handle_standard_args(
175189
RE2C
176-
REQUIRED_VARS
177-
RE2C_EXECUTABLE
178-
RE2C_VERSION
190+
REQUIRED_VARS ${_re2cRequiredVars}
179191
VERSION_VAR RE2C_VERSION
180192
HANDLE_VERSION_RANGE
181193
REASON_FAILURE_MESSAGE "re2c not found. Please install re2c."
182194
)
183195

184-
unset(_re2c_version_valid)
196+
unset(_re2cMsg)
197+
unset(_re2cRequiredVars)
198+
unset(_re2cVersionValid)
185199

186200
if(NOT RE2C_FOUND)
187201
return()
@@ -287,7 +301,7 @@ function(re2c_target)
287301
${options}
288302
--output ${output}
289303
${input}
290-
DEPENDS ${input} ${parsed_DEPENDS}
304+
DEPENDS ${input} ${parsed_DEPENDS} $<TARGET_NAME_IF_EXISTS:RE2C::RE2C>
291305
COMMENT "[RE2C][${ARGV0}] Building lexer with re2c ${RE2C_VERSION}"
292306
VERBATIM
293307
COMMAND_EXPAND_LISTS

cmake/cmake/modules/PHP/Stubs.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function(_php_stubs_get_php_command result)
1616
# tokenizer extension.
1717
if(
1818
NOT PHPSystem_EXECUTABLE
19-
AND (NOT SAPI_CLI OR (SAPI_CLI AND NOT EXT_TOKENIZER))
19+
AND (NOT TARGET PHP::SAPI::cli OR (TARGET PHP::SAPI::cli AND NOT EXT_TOKENIZER))
2020
)
2121
return(PROPAGATE ${result})
2222
endif()

cmake/ext/hash/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ option(
3434
EXT_HASH_MHASH
3535
"Enable the mhash emulation support (deprecated as of PHP 8.1)"
3636
)
37-
37+
mark_as_advanced(EXT_HASH_MHASH)
3838
add_feature_info(
3939
"ext/hash mhash"
4040
EXT_HASH_MHASH

cmake/ext/session/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ cmake_dependent_option(
5959
"EXT_SESSION;NOT PHP_THREAD_SAFETY"
6060
OFF
6161
)
62-
62+
mark_as_advanced(EXT_SESSION_MM)
6363
add_feature_info(
6464
"ext/session mm"
6565
EXT_SESSION_MM

cmake/ext/standard/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ option(
5252
EXT_STANDARD_CRYPT_EXTERNAL
5353
"Use external libcrypt/libxcrypt library instead of the bundled PHP crypt"
5454
)
55+
mark_as_advanced(EXT_STANDARD_CRYPT_EXTERNAL)
5556
add_feature_info(
5657
"ext/standard crypt external"
5758
EXT_STANDARD_CRYPT_EXTERNAL

cmake/pear/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ message(
9797

9898
# Check PEAR dependencies.
9999
block()
100-
if(NOT SAPI_CLI)
100+
if(NOT TARGET PHP::SAPI::cli)
101101
message(
102102
FATAL_ERROR
103103
"The 'PHP_PEAR' option requires PHP CLI SAPI. Please, set 'SAPI_CLI' to "

docs/cmake/modules/FindRE2C.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Custom target:
3838
`find_package(RE2C)`. Options are prepended to additional options passed with
3939
`re2c_target()` arguments.
4040

41-
* `RE2C_ENABLE_DOWNLOAD` - This module can also download and build re2c from its
42-
Git repository using the `FetchContent` module. Set to `TRUE` to enable
43-
downloading re2c, when not found on the system or system version is not
44-
suitable.
41+
* `RE2C_DISABLE_DOWNLOAD` - This module can also download and build re2c from
42+
its Git repository using the `ExternalProject` module. Set to `TRUE` to
43+
disable downloading re2c, when it is not found on the system or system version
44+
is not suitable.
4545

4646
* `RE2C_USE_COMPUTED_GOTOS` - Set to `TRUE` before calling `find_package(RE2C)`
4747
to enable the re2c `--computed-gotos` option if the non-standard C

0 commit comments

Comments
 (0)