Skip to content

Commit cc117c9

Browse files
committed
Merge branch 'PHP-8.3'
2 parents e3d5230 + 6e5b176 commit cc117c9

File tree

9 files changed

+89
-30
lines changed

9 files changed

+89
-30
lines changed

bin/init.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,20 @@ if make -h 2>&1 | grep -q "\[-j max_jobs\]" \
228228
fi
229229
fi
230230

231+
if test -n "$jobs"; then
232+
jobs="-j $jobs"
233+
else
234+
case $generator in
235+
Ninja*);;
236+
*) jobs=-j;;
237+
esac
238+
fi
239+
231240
cd php-src
232241

233242
# Run CMake preset configuration.
234243
eval "'$cmake' --preset $preset $cmake_debug_options $options $generator_option"
235244

236245
# Run build step using preset and jobs arguments passed after the arguments for
237246
# exotic make implementations, such as dmake on illumos.
238-
eval "'$cmake' --build --preset $preset $cmake_verbose -- -j $jobs"
247+
eval "'$cmake' --build --preset $preset $cmake_verbose -- $jobs"

cmake/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Running system checks
99
")
1010

1111
message(STATUS "CMake version: ${CMAKE_VERSION}")
12+
message(STATUS "CMake generator: ${CMAKE_GENERATOR}")
1213

1314
# Set the PHP_VERSION_* variables from configure.ac.
1415
include(cmake/Version.cmake)

cmake/cmake/BuildTypes.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ include_guard(GLOBAL)
66

77
block()
88
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
9-
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
9+
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
1010

11-
if(is_multi_config)
11+
if(isMultiConfig)
1212
if(NOT "DebugAssertions" IN_LIST CMAKE_CONFIGURATION_TYPES)
1313
list(APPEND CMAKE_CONFIGURATION_TYPES DebugAssertions)
1414
endif()
1515
else()
1616
set(
17-
allowed_build_types
17+
allowedBuildTypes
1818
Debug
1919
MinSizeRel
2020
Release
@@ -25,12 +25,12 @@ block()
2525

2626
set_property(
2727
CACHE CMAKE_BUILD_TYPE
28-
PROPERTY STRINGS "${allowed_build_types}"
28+
PROPERTY STRINGS "${allowedBuildTypes}"
2929
)
3030

3131
if(NOT CMAKE_BUILD_TYPE)
3232
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
33-
elseif(NOT CMAKE_BUILD_TYPE IN_LIST allowed_build_types)
33+
elseif(NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes)
3434
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
3535
endif()
3636
endif()

cmake/cmake/Configuration.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,11 @@ block()
224224
set(extension_dir "${extension_dir}-zts")
225225
endif()
226226

227-
if(PHP_DEBUG)
228-
set(extension_dir "${extension_dir}-debug")
229-
endif()
227+
set(extension_dir "${extension_dir}$<IF:$<CONFIG:Debug>,-debug,>")
230228
else()
231229
set(extension_dir "${extension_dir}/extensions")
232230

233-
if(PHP_DEBUG)
234-
set(extension_dir "${extension_dir}/debug")
235-
else()
236-
set(extension_dir "${extension_dir}/no-debug")
237-
endif()
231+
set(extension_dir "${extension_dir}/$<IF:$<CONFIG:Debug>,debug,no-debug>")
238232

239233
if(PHP_THREAD_SAFETY)
240234
set(extension_dir "${extension_dir}-zts")

cmake/cmake/modules/PHP/ConfigureFile.cmake

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ function(_php_configure_file_parse_variables)
116116
replaced
117117
"${value}"
118118
)
119-
list(APPEND resultValues ${replaced})
119+
list(APPEND resultValues "${replaced}")
120120
else()
121-
list(APPEND resultValues ${value})
121+
list(APPEND resultValues "${value}")
122122
endif()
123123

124124
# The resultValuesInCode are for the configure_file inside the install(CODE)
@@ -184,6 +184,12 @@ function(php_configure_file)
184184
)
185185
endif()
186186

187+
cmake_path(GET ___phpConfigureFileOutput FILENAME filename)
188+
set(
189+
___phpConfigureFileOutputTemporary
190+
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${filename}.cmake.in
191+
)
192+
187193
if(parsed_VARIABLES)
188194
_php_configure_file_parse_variables(
189195
"${parsed_VARIABLES}"
@@ -200,9 +206,18 @@ function(php_configure_file)
200206

201207
configure_file(
202208
${___phpConfigureFileTemplate}
203-
${___phpConfigureFileOutput}
209+
${___phpConfigureFileOutputTemporary}
204210
@ONLY
205211
)
212+
213+
# To be able to evaluate possible additional generator expressions.
214+
file(
215+
GENERATE
216+
# TODO: Multi-config generators need to write separate files.
217+
#OUTPUT $<CONFIG>/file.output
218+
OUTPUT ${___phpConfigureFileOutput}
219+
INPUT ${___phpConfigureFileOutputTemporary}
220+
)
206221
endblock()
207222

208223
install(CODE "

cmake/main/CMakeLists.txt

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,53 @@ function(_php_main_create_files)
309309

310310
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
311311
message(STATUS "Creating main/config.w32.h")
312-
configure_file(main/config.w32.cmake.h.in main/config.w32.h @ONLY)
312+
configure_file(
313+
main/config.w32.cmake.h.in
314+
main/CMakeFiles/config.w32.cmake.h.in
315+
@ONLY
316+
)
317+
318+
file(
319+
GENERATE
320+
# TODO: Multi-config generators need to write separate files.
321+
#OUTPUT $<CONFIG>/main/config.w32.h
322+
OUTPUT ${PHP_BINARY_DIR}/main/config.w32.h
323+
INPUT ${PHP_BINARY_DIR}/main/CMakeFiles/config.w32.cmake.h.in
324+
)
313325
else()
314326
message(STATUS "Creating main/build-defs.h")
315-
configure_file(main/build-defs.h.in main/build-defs.h @ONLY)
327+
configure_file(
328+
main/build-defs.h.in
329+
main/CMakeFiles/build-defs.h.in
330+
@ONLY
331+
)
332+
333+
# To be able to evaluate the generator expressions.
334+
file(
335+
GENERATE
336+
# TODO: Multi-config generators need to write separate files.
337+
#OUTPUT $<CONFIG>/main/build-defs.h
338+
OUTPUT ${PHP_BINARY_DIR}/main/build-defs.h
339+
INPUT ${PHP_BINARY_DIR}/main/CMakeFiles/build-defs.h.in
340+
)
316341

317342
set(HAVE_BUILD_DEFS_H 1)
318343

319344
message(STATUS "Creating main/php_config.h")
320-
configure_file(main/php_config.cmake.h.in main/php_config.h @ONLY)
345+
configure_file(
346+
main/php_config.cmake.h.in
347+
main/CMakeFiles/php_config.cmake.h.in
348+
@ONLY
349+
)
350+
351+
# To be able to evaluate the generator expressions.
352+
file(
353+
GENERATE
354+
# TODO: Multi-config generators need to write separate files.
355+
#OUTPUT $<CONFIG>/main/php_config.h
356+
OUTPUT ${PHP_BINARY_DIR}/main/php_config.h
357+
INPUT ${PHP_BINARY_DIR}/main/CMakeFiles/php_config.cmake.h.in
358+
)
321359
endif()
322360

323361
message(STATUS "Creating main/php_version.h")

cmake/main/config.w32.cmake.h.in

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,6 @@
17031703
/* Define to 1 if the PHP extension 'zlib' is available. */
17041704
#cmakedefine HAVE_ZLIB 1
17051705

1706-
/* Define to 1 if you have the <zlib.h> header file. */
1707-
#cmakedefine HAVE_ZLIB_H 1
1708-
17091706
/* Define to 1 if _controlfp is present and usable. */
17101707
#cmakedefine HAVE__CONTROLFP 1
17111708

@@ -2009,6 +2006,13 @@
20092006
/* Define to 1 if checking the stack limit is supported. */
20102007
#cmakedefine ZEND_CHECK_STACK_LIMIT 1
20112008

2009+
/* Define to 1 if debugging is enabled, and to 0 if not.
2010+
TODO: This is still not good enough because multi-config generators would
2011+
then need separate php_config.h files for each build type. */
2012+
#ifndef ZEND_DEBUG
2013+
# define ZEND_DEBUG $<IF:$<CONFIG:Debug>,1,0>
2014+
#endif
2015+
20122016
/* Define to 1 if Zend fiber uses ucontext instead of boost context. */
20132017
#cmakedefine ZEND_FIBER_UCONTEXT 1
20142018

cmake/main/php_config.cmake.h.in

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,9 +1694,6 @@
16941694
/* Define to 1 if the PHP extension 'zlib' is available. */
16951695
#cmakedefine HAVE_ZLIB 1
16961696

1697-
/* Define to 1 if you have the <zlib.h> header file. */
1698-
#cmakedefine HAVE_ZLIB_H 1
1699-
17001697
/* Define to 1 if _controlfp is present and usable. */
17011698
#cmakedefine HAVE__CONTROLFP 1
17021699

@@ -1975,10 +1972,11 @@
19751972
/* Define to 1 if checking the stack limit is supported. */
19761973
#cmakedefine ZEND_CHECK_STACK_LIMIT 1
19771974

1978-
/* Whether build type is Debug or DebugAssertions.
1979-
TODO: Fix this better. */
1975+
/* Define to 1 if debugging is enabled, and to 0 if not.
1976+
TODO: This is still not good enough because multi-config generators would
1977+
then need separate php_config.h files for each build type. */
19801978
#ifndef ZEND_DEBUG
1981-
#cmakedefine01 ZEND_DEBUG
1979+
# define ZEND_DEBUG $<IF:$<CONFIG:Debug>,1,0>
19821980
#endif
19831981

19841982
/* Define to 1 if Zend fiber uses ucontext instead of boost context. */

cmake/scripts/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ block()
5858
exec_prefix "$<INSTALL_PREFIX>"
5959
PHP_VERSION "${PHP_VERSION}"
6060
PHP_VERSION_ID "${PHP_VERSION_ID}"
61-
include_dir "$<PHP_EXPAND:${CMAKE_INSTALL_INCLUDEDIR}>"
61+
includedir "$<PHP_EXPAND:${CMAKE_INSTALL_INCLUDEDIR}>"
6262
# TODO:
6363
PHP_LDFLAGS ""
6464
# TODO:

0 commit comments

Comments
 (0)