Skip to content

Commit ffc5453

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 1c448d5 + 58e0ac6 commit ffc5453

File tree

4 files changed

+66
-45
lines changed

4 files changed

+66
-45
lines changed

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.25)
1+
cmake_minimum_required(VERSION 3.25...3.31)
22

33
# Configure CMake behavior.
44
include(cmake/CMakeDefaults.cmake)

cmake/cmake/Version.cmake

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,69 @@
11
#[=============================================================================[
22
Set PHP version variables.
33
4-
PHP version variables are read from the configure.ac file, and PHP_VERSION_API
5-
number is retrieved from main/php.h header file.
4+
PHP version is read from the php-src configure.ac file, and PHP_VERSION_API
5+
number is retrieved from the php-src main/php.h header file.
66
77
Variables:
88
9-
PHP_VERSION
10-
PHP_VERSION_MAJOR
11-
PHP_VERSION_MINOR
12-
PHP_VERSION_PATCH
13-
PHP_VERSION_LABEL
14-
PHP_API_VERSION
15-
9+
* `PHP_API_VERSION`
10+
* `PHP_VERSION`
11+
* `PHP_VERSION_LABEL`
1612
#]=============================================================================]
1713

1814
include_guard(GLOBAL)
1915

20-
# Set the PHP_VERSION_* variables from configure.ac.
21-
file(READ ${CMAKE_CURRENT_LIST_DIR}/../configure.ac _)
22-
string(REGEX MATCH "AC_INIT\\(\\[PHP\\],\\[([0-9]+\.[0-9]+\.[0-9]+)([^\]]*)" _ "${_}")
16+
block(PROPAGATE PHP_VERSION)
17+
# Set the PHP_VERSION_* variables from configure.ac.
18+
set(regex "^AC_INIT\\(\\[PHP\\],\\[([0-9]+\.[0-9]+\.[0-9]+)([^\]]*)")
19+
file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../configure.ac _ REGEX "${regex}")
20+
21+
cmake_policy(GET CMP0159 policy)
22+
if(CMAKE_VERSION VERSION_LESS 3.29 OR NOT policy STREQUAL NEW)
23+
string(REGEX MATCH "${regex}" _ "${_}")
24+
endif()
2325

24-
set(PHP_VERSION "${CMAKE_MATCH_1}")
26+
set(PHP_VERSION "${CMAKE_MATCH_1}")
2527

26-
set(
27-
PHP_VERSION_LABEL "${CMAKE_MATCH_2}"
28-
CACHE STRING "Extra PHP version label suffix, e.g. '-dev', 'rc1', '-acme'"
29-
)
30-
mark_as_advanced(PHP_VERSION_LABEL)
28+
set(
29+
PHP_VERSION_LABEL "${CMAKE_MATCH_2}"
30+
CACHE STRING "Extra PHP version label suffix, e.g. '-dev', 'rc1', '-acme'"
31+
)
32+
mark_as_advanced(PHP_VERSION_LABEL)
33+
endblock()
3134

3235
# This is automatically executed with the project(PHP...) invocation.
33-
macro(_php_post_project)
34-
if(NOT DEFINED PHP_VERSION_ID)
35-
# Append extra version label suffix to PHP_VERSION.
36-
string(APPEND PHP_VERSION "${PHP_VERSION_LABEL}")
37-
message(STATUS "PHP version: ${PHP_VERSION}")
38-
39-
# Set PHP version ID.
40-
math(
41-
EXPR
42-
PHP_VERSION_ID
43-
"${PHP_VERSION_MAJOR} * 10000 \
44-
+ ${PHP_VERSION_MINOR} * 100 \
45-
+ ${PHP_VERSION_PATCH}"
46-
)
47-
message(STATUS "PHP version ID: ${PHP_VERSION_ID}")
48-
49-
# Read PHP API version.
50-
file(READ main/php.h _)
51-
string(REGEX MATCH "#[ \t]*define[ \t]+PHP_API_VERSION[ \t]+([0-9]+)" _ "${_}")
52-
set(PHP_API_VERSION "${CMAKE_MATCH_1}")
53-
message(STATUS "PHP API version: ${PHP_API_VERSION}")
36+
function(_php_post_project)
37+
if(DEFINED PHP_VERSION_ID)
38+
return()
39+
endif()
40+
41+
# Append extra version label suffix to PHP_VERSION.
42+
string(APPEND PHP_VERSION "${PHP_VERSION_LABEL}")
43+
message(STATUS "PHP version: ${PHP_VERSION}")
44+
45+
# Set PHP version ID.
46+
math(
47+
EXPR
48+
PHP_VERSION_ID
49+
"${PHP_VERSION_MAJOR} * 10000 \
50+
+ ${PHP_VERSION_MINOR} * 100 \
51+
+ ${PHP_VERSION_PATCH}"
52+
)
53+
message(STATUS "PHP version ID: ${PHP_VERSION_ID}")
54+
55+
# Read PHP API version.
56+
set(regex "^[ \t]*#[ \t]*define[ \t]+PHP_API_VERSION[ \t]+([0-9]+)")
57+
file(STRINGS main/php.h _ REGEX "^${regex}")
58+
59+
cmake_policy(GET CMP0159 policy)
60+
if(CMAKE_VERSION VERSION_LESS 3.29 OR NOT policy STREQUAL NEW)
61+
string(REGEX MATCH "${regex}" _ "${_}")
5462
endif()
55-
endmacro()
63+
64+
set(PHP_API_VERSION "${CMAKE_MATCH_1}")
65+
message(STATUS "PHP API version: ${PHP_API_VERSION}")
66+
67+
return(PROPAGATE PHP_VERSION PHP_VERSION_ID PHP_API_VERSION)
68+
endfunction()
5669
variable_watch(PHP_HOMEPAGE_URL _php_post_project)

cmake/cmake/modules/FindApache.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ block()
158158
OUTPUT_STRIP_TRAILING_WHITESPACE
159159
ERROR_QUIET
160160
)
161-
if(IS_EXECUTABLE ${path})
161+
if(CMAKE_VERSION VERSION_LESS 3.29)
162+
if(EXISTS ${path})
163+
set_property(CACHE Apache_APR_CONFIG_EXECUTABLE PROPERTY VALUE ${path})
164+
endif()
165+
elseif(IS_EXECUTABLE ${path})
162166
set_property(CACHE Apache_APR_CONFIG_EXECUTABLE PROPERTY VALUE ${path})
163167
endif()
164168
endif()
@@ -238,7 +242,11 @@ block()
238242
OUTPUT_STRIP_TRAILING_WHITESPACE
239243
ERROR_QUIET
240244
)
241-
if(IS_EXECUTABLE ${path})
245+
if(CMAKE_VERSION VERSION_LESS 3.29)
246+
if(EXISTS ${path})
247+
set_property(CACHE Apache_APU_CONFIG_EXECUTABLE PROPERTY VALUE ${path})
248+
endif()
249+
elseif(IS_EXECUTABLE ${path})
242250
set_property(CACHE Apache_APU_CONFIG_EXECUTABLE PROPERTY VALUE ${path})
243251
endif()
244252
endif()

cmake/pear/InstallPear.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if(NOT EXISTS ${phpPearCurrentBinaryDir}/install-pear-nozlib.phar)
6666
STATUS downloadStatus
6767
)
6868

69-
if(IS_EXECUTABLE "${phpPearPhpExecutable}" AND NOT downloadStatus)
69+
if(phpPearPhpExecutable AND NOT downloadStatus)
7070
# Download using fetch.php.
7171
execute_process(
7272
COMMAND ${phpPearPhpExecutable}
@@ -83,7 +83,7 @@ if(NOT EXISTS ${phpPearCurrentBinaryDir}/install-pear-nozlib.phar)
8383
endif()
8484
endif()
8585

86-
if(NOT IS_EXECUTABLE "${phpPearPhpExecutable}")
86+
if(NOT phpPearPhpExecutable)
8787
message(
8888
WARNING
8989
"The PEAR installation is not complete.\n"

0 commit comments

Comments
 (0)