Skip to content

Commit df752c6

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 2125470 + 626e3d1 commit df752c6

File tree

3 files changed

+58
-38
lines changed

3 files changed

+58
-38
lines changed

cmake/ext/mbstring/CMakeLists.txt

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ if(NOT EXT_MBSTRING)
7171
return()
7272
endif()
7373

74+
################################################################################
75+
# Configure mbstring extension.
76+
################################################################################
77+
7478
if(EXT_MBSTRING_SHARED)
7579
add_library(php_mbstring SHARED)
7680
else()
@@ -145,8 +149,20 @@ target_sources(
145149
${CMAKE_CURRENT_BINARY_DIR}/libmbfl/config.h
146150
)
147151

152+
target_compile_definitions(php_mbstring PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
153+
154+
# The mbstring extension doesn't seem to support interprocedural optimization
155+
# (IPO).
156+
set_target_properties(php_mbstring PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
157+
148158
add_dependencies(php_mbstring php_pcre)
149159

160+
set(HAVE_MBSTRING TRUE)
161+
162+
################################################################################
163+
# Configure libmbfl.
164+
################################################################################
165+
150166
# TODO: Fix this better. See also https://github.com/php/php-src/pull/13713
151167
# TODO: Should status message be here?
152168
message(STATUS "Creating ext/mbstring/libmbfl/config.h")
@@ -160,9 +176,17 @@ file(CONFIGURE OUTPUT libmbfl/config.h CONTENT [[
160176
#endif
161177
]])
162178

163-
# The mbstring extension doesn't seem to support interprocedural optimization
164-
# (IPO).
165-
set_target_properties(php_mbstring PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
179+
target_include_directories(
180+
php_mbstring
181+
PRIVATE
182+
${CMAKE_CURRENT_SOURCE_DIR}/libmbfl
183+
${CMAKE_CURRENT_BINARY_DIR}/libmbfl
184+
${CMAKE_CURRENT_SOURCE_DIR}/libmbfl/mbfl
185+
)
186+
187+
################################################################################
188+
# Multibyte regex.
189+
################################################################################
166190

167191
if(EXT_MBSTRING_MBREGEX)
168192
find_package(Oniguruma)
@@ -176,7 +200,7 @@ if(EXT_MBSTRING_MBREGEX)
176200
target_link_libraries(php_mbstring PRIVATE Oniguruma::Oniguruma)
177201

178202
if(TARGET Oniguruma::Oniguruma)
179-
message(CHECK_START "Checking if Oniguruma has invalid entry for KOI8 encoding")
203+
message(CHECK_START "Checking for invalid KOI8 encoding entry in Oniguruma")
180204
cmake_push_check_state(RESET)
181205
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
182206
set(CMAKE_REQUIRED_LIBRARIES Oniguruma::Oniguruma)
@@ -195,7 +219,6 @@ if(EXT_MBSTRING_MBREGEX)
195219
message(CHECK_PASS "no")
196220
else()
197221
message(CHECK_FAIL "yes")
198-
199222
set(PHP_ONIG_BAD_KOI8_ENTRY TRUE)
200223
endif()
201224
endif()
@@ -210,8 +233,6 @@ if(EXT_MBSTRING_MBREGEX)
210233
$<$<PLATFORM_ID:Windows>:ONIG_EXTERN=extern>
211234
)
212235

213-
set(HAVE_MBREGEX TRUE)
214-
215236
target_sources(
216237
php_mbstring
217238
PRIVATE
@@ -222,18 +243,8 @@ if(EXT_MBSTRING_MBREGEX)
222243
php_mbregex.h
223244
php_onig_compat.h
224245
)
225-
endif()
226-
227-
target_compile_definitions(php_mbstring PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE)
228246

229-
target_include_directories(
230-
php_mbstring
231-
PRIVATE
232-
${CMAKE_CURRENT_SOURCE_DIR}/libmbfl
233-
${CMAKE_CURRENT_BINARY_DIR}/libmbfl
234-
${CMAKE_CURRENT_SOURCE_DIR}/libmbfl/mbfl
235-
)
236-
237-
set(HAVE_MBSTRING TRUE)
247+
set(HAVE_MBREGEX TRUE)
248+
endif()
238249

239250
configure_file(cmake/config.h.in config.h)

cmake/main/CMakeLists.txt

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,29 @@ if(PHP_DMALLOC)
298298
endif()
299299
endif()
300300

301+
################################################################################
302+
# Create main/php_version.h. Template is based on the configure.ac.
303+
################################################################################
304+
305+
cmake_path(
306+
RELATIVE_PATH
307+
CMAKE_CURRENT_SOURCE_DIR
308+
BASE_DIRECTORY ${CMAKE_SOURCE_DIR}
309+
OUTPUT_VARIABLE relativeSourceDir
310+
)
311+
312+
message(STATUS "Creating ${relativeSourceDir}/php_version.h")
313+
file(CONFIGURE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/php_version.h CONTENT [[
314+
/* automatically generated by configure */
315+
/* edit configure.ac to change version number */
316+
#define PHP_MAJOR_VERSION @PHP_VERSION_MAJOR@
317+
#define PHP_MINOR_VERSION @PHP_VERSION_MINOR@
318+
#define PHP_RELEASE_VERSION @PHP_VERSION_PATCH@
319+
#define PHP_EXTRA_VERSION "@PHP_VERSION_LABEL@"
320+
#define PHP_VERSION "@PHP_VERSION@"
321+
#define PHP_VERSION_ID @PHP_VERSION_ID@
322+
]])
323+
301324
################################################################################
302325
# Create main/internal_functions*.c files with a list of static enabled PHP
303326
# extensions based on the PHP SAPI type.
@@ -346,17 +369,17 @@ block()
346369
RELATIVE_PATH
347370
CMAKE_CURRENT_BINARY_DIR
348371
BASE_DIRECTORY ${CMAKE_BINARY_DIR}
349-
OUTPUT_VARIABLE relativeDir
372+
OUTPUT_VARIABLE relativeBinaryDir
350373
)
351374

352375
set(EXT_INCLUDE_CODE "${includes}")
353376
set(EXT_MODULE_PTRS "${pointers}")
354-
message(STATUS "Creating ${relativeDir}/internal_functions.c")
377+
message(STATUS "Creating ${relativeBinaryDir}/internal_functions.c")
355378
configure_file(internal_functions.c.in internal_functions.c)
356379

357380
set(EXT_INCLUDE_CODE "${includesCli}")
358381
set(EXT_MODULE_PTRS "${pointersCli}")
359-
message(STATUS "Creating ${relativeDir}/internal_functions_cli.c")
382+
message(STATUS "Creating ${relativeBinaryDir}/internal_functions_cli.c")
360383
configure_file(internal_functions.c.in internal_functions_cli.c)
361384
endblock()
362385

@@ -447,12 +470,6 @@ function(_php_main_create_files)
447470
set(DEFAULT_SHORT_OPEN_TAG "0")
448471
endif()
449472

450-
message(STATUS "Creating main/php_version.h")
451-
configure_file(
452-
main/cmake/php_version.h.in
453-
${PHP_SOURCE_DIR}/main/php_version.h
454-
)
455-
456473
# Add sapis configuration.
457474
set(config "")
458475
get_property(sapis GLOBAL PROPERTY PHP_SAPIS)
@@ -502,7 +519,7 @@ function(_php_main_create_files)
502519
GENERATE
503520
# TODO: Multi-config generators need to write separate files.
504521
#OUTPUT $<CONFIG>/main/build-defs.h
505-
OUTPUT ${PHP_BINARY_DIR}/main/build-defs.h
522+
OUTPUT main/build-defs.h
506523
CONTENT "${content}"
507524
)
508525

@@ -553,7 +570,7 @@ function(_php_main_create_files)
553570
GENERATE
554571
# TODO: Multi-config generators need to write separate files.
555572
#OUTPUT $<CONFIG>/main/${file}
556-
OUTPUT ${PHP_BINARY_DIR}/main/${file}
573+
OUTPUT main/${file}
557574
CONTENT "${content}"
558575
)
559576
endfunction()

cmake/main/cmake/php_version.h.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)