Skip to content

Commit 383f2fa

Browse files
committed
Merge branch 'PHP-8.4'
2 parents c89986a + b9ad979 commit 383f2fa

File tree

6 files changed

+59
-12
lines changed

6 files changed

+59
-12
lines changed

cmake/cmake/ConfigureChecks.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ include(PHP/CheckAVX512)
252252
################################################################################
253253

254254
check_symbol_exists(alphasort "dirent.h" HAVE_ALPHASORT)
255-
check_symbol_exists(chroot "unistd.h" HAVE_CHROOT)
256255
check_symbol_exists(explicit_memset "string.h" HAVE_EXPLICIT_MEMSET)
257256
check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
258257
# The fdatasync declaration on macOS is missing in headers, yet is in C library.

cmake/ext/standard/CMakeLists.txt

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ target_sources(
6868
array.c
6969
assert.c
7070
base64.c
71-
basic_functions.c
7271
basic_functions.stub.php
7372
browscap.c
7473
crc32.c
7574
credits.c
7675
crypt.c
7776
css.c
7877
datetime.c
79-
dir.c
8078
dir.stub.php
8179
dl.c
8280
dl.stub.php
@@ -525,8 +523,55 @@ block()
525523
add_dependencies(php_standard php_standard_credits)
526524
endblock()
527525

528-
# TODO: Check whether to enable the chroot() function by checking which SAPI is
529-
# being built.
530-
set(ENABLE_CHROOT_FUNC TRUE)
526+
################################################################################
527+
# Add chroot() based on the SAPI type. It should be enabled only for the
528+
# CLI-based SAPIs. This enables building all SAPIs in a single build invocation.
529+
# Here, a build-time solution is integrated, although this would be better
530+
# resolved as mentioned in the issue report.
531+
# See: https://github.com/php/php-src/issues/11984
532+
################################################################################
533+
534+
check_symbol_exists(chroot "unistd.h" HAVE_CHROOT)
535+
536+
add_library(php_standard_functions_cli OBJECT)
537+
add_library(php_standard_functions OBJECT)
538+
539+
target_sources(php_standard_functions_cli PRIVATE basic_functions.c dir.c)
540+
target_sources(php_standard_functions PRIVATE basic_functions.c dir.c)
541+
542+
target_compile_definitions(php_standard_functions_cli PRIVATE )
543+
544+
target_include_directories(
545+
php_standard_functions_cli
546+
PRIVATE
547+
$<TARGET_PROPERTY:php_standard,INCLUDE_DIRECTORIES>
548+
)
549+
target_include_directories(
550+
php_standard_functions
551+
PRIVATE
552+
$<TARGET_PROPERTY:php_standard,INCLUDE_DIRECTORIES>
553+
)
554+
target_compile_definitions(
555+
php_standard_functions_cli
556+
PRIVATE
557+
$<TARGET_PROPERTY:php_standard,COMPILE_DEFINITIONS>
558+
ENABLE_CHROOT_FUNC
559+
)
560+
target_compile_definitions(
561+
php_standard_functions
562+
PRIVATE $<TARGET_PROPERTY:php_standard,COMPILE_DEFINITIONS>
563+
)
564+
target_link_libraries(
565+
php_standard_functions_cli
566+
PRIVATE $<TARGET_PROPERTY:php_standard,LINK_LIBRARIES>
567+
)
568+
target_link_libraries(
569+
php_standard_functions
570+
PRIVATE $<TARGET_PROPERTY:php_standard,LINK_LIBRARIES>
571+
)
572+
573+
################################################################################
574+
# Configuration header
575+
################################################################################
531576

532577
configure_file(config.cmake.h.in config.h)

cmake/ext/standard/config.cmake.h.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
/* Define to 1 if crypt_r uses struct crypt_data. */
88
#cmakedefine CRYPT_R_STRUCT_CRYPT_DATA 1
99

10-
/* Define to 1 to enable the 'chroot' function. */
11-
#cmakedefine ENABLE_CHROOT_FUNC 1
12-
1310
/* Define to 1 when aarch64 CRC32 API is available. */
1411
#cmakedefine HAVE_AARCH64_CRC32 1
1512

1613
/* Define to 1 if the system has the 'libargon2' library. */
1714
#cmakedefine HAVE_ARGON2LIB 1
1815

16+
/* Define to 1 if you have the 'chroot' function. */
17+
#cmakedefine HAVE_CHROOT 1
18+
1919
/* Define to 1 if you have the 'elf_aux_info' function. */
2020
#cmakedefine HAVE_ELF_AUX_INFO 1
2121

cmake/main/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ target_sources(
216216
$<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>,$<STREQUAL:$<TARGET_PROPERTY:Zend::Zend,TYPE>,STATIC_LIBRARY>>:$<TARGET_OBJECTS:Zend::Zend>>
217217

218218
$<$<TARGET_EXISTS:PHP::windows>:$<TARGET_OBJECTS:PHP::windows>>
219+
220+
# ext/standard functions objects based on the SAPI type.
221+
$<IF:$<BOOL:$<TARGET_PROPERTY:PHP_SAPI_CLI>>,$<TARGET_OBJECTS:php_standard_functions_cli>,$<TARGET_OBJECTS:php_standard_functions>>
219222
)
220223

221224
################################################################################

cmake/main/php_config.cmake.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@
8181
/* Define to 1 if PHP has the <main/build-defs.h> header file. */
8282
#cmakedefine HAVE_BUILD_DEFS_H 1
8383

84-
/* Define to 1 if you have the 'chroot' function. */
85-
#cmakedefine HAVE_CHROOT 1
86-
8784
/* Define to 1 if you have the 'copy_file_range' function. */
8885
#cmakedefine HAVE_COPY_FILE_RANGE 1
8986

docs/cmake/differences.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ build system:
126126
127127
* Zend/zend_vm_gen.php deprecation warnings on 32-bit systems.
128128
See: https://github.com/php/php-src/issues/15899
129+
130+
* The `chroot()` PHP function is enabled/disabled based on the SAPI type:
131+
See: https://github.com/php/php-src/issues/11984

0 commit comments

Comments
 (0)