Skip to content

Commit 80f1d4c

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 615511a + 571c2a2 commit 80f1d4c

File tree

7 files changed

+42
-8
lines changed

7 files changed

+42
-8
lines changed

cmake/cmake/Bootstrap.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ define_property(
1010
BRIEF_DOCS "Whether the PHP SAPI or extension is CLI-based"
1111
)
1212

13+
define_property(
14+
TARGET
15+
PROPERTY PHP_SAPI_FASTCGI
16+
BRIEF_DOCS "Whether the PHP SAPI is FastCGI-based"
17+
)
18+
1319
# Optionally enable CXX for extensions.
1420
include(CheckLanguage)
1521
check_language(CXX)

cmake/main/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ target_sources(
1919
php_main
2020
PRIVATE
2121
$<$<NOT:$<PLATFORM_ID:Windows>>:explicit_bzero.c>
22-
fastcgi.c
2322
fopen_wrappers.c
2423
getopt.c
2524
main.c
@@ -153,6 +152,17 @@ target_include_directories(
153152
target_link_libraries(php_sapi INTERFACE PHP::main)
154153
target_sources(php_sapi INTERFACE $<TARGET_OBJECTS:PHP::main>)
155154

155+
################################################################################
156+
# Add FastCGI target with objects for use in PHP SAPIs such as CGI and FPM.
157+
################################################################################
158+
add_library(php_main_fastcgi OBJECT fastcgi.c)
159+
160+
target_sources(
161+
php_sapi
162+
INTERFACE
163+
$<$<BOOL:$<TARGET_PROPERTY:PHP_SAPI_FASTCGI>>:$<TARGET_OBJECTS:php_main_fastcgi>>
164+
)
165+
156166
################################################################################
157167
# Create main/internal_functions*.c files with a list of static enabled PHP
158168
# extensions based on the PHP SAPI type.

cmake/sapi/cgi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ set_target_properties(
5757
OUTPUT_NAME ${PHP_PROGRAM_PREFIX}php-cgi${PHP_PROGRAM_SUFFIX}
5858
ENABLE_EXPORTS TRUE # TODO: Check if there's a better solution.
5959
PHP_CLI TRUE
60+
PHP_SAPI_FASTCGI TRUE
6061
)
6162

6263
# BSD systems.

cmake/sapi/cli/CMakeLists.txt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,20 @@ set_target_properties(
128128
PHP_CLI TRUE
129129
)
130130

131+
# Link editline library conditionally based on readline extension.
131132
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
132-
# Link readline extension interface library if enabled and built statically.
133-
target_link_libraries(
134-
php_sapi_cli
135-
PRIVATE
136-
$<$<AND:$<TARGET_EXISTS:PHP::ext::readline>,$<NOT:$<IN_LIST:$<TARGET_PROPERTY:PHP::ext::readline,TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>>:$<TARGET_PROPERTY:PHP::ext::readline,IMPORTED_LINK_INTERFACE_LIBRARIES>>
137-
)
133+
set(type "")
134+
if(PHP_EXT_READLINE)
135+
get_target_property(type PHP::ext::readline TYPE)
136+
endif()
137+
138+
if(NOT PHP_EXT_READLINE OR NOT type MATCHES "^(MODULE|SHARED)_LIBRARY$")
139+
find_package(Editline)
140+
if(Editline_FOUND)
141+
target_link_libraries(php_sapi_cli PRIVATE Editline::Editline)
142+
set(HAVE_LIBEDIT TRUE)
143+
endif()
144+
endif()
138145
endif()
139146

140147
# Man documentation.
@@ -196,7 +203,7 @@ if(PHP_SAPI_CLI_WIN_NO_CONSOLE)
196203
target_link_options(
197204
php_sapi_cli_win
198205
PRIVATE
199-
/stack:67108864
206+
$<$<COMPILE_LANG_AND_ID:C,MSVC>:/stack:67108864>
200207
)
201208
endif()
202209

cmake/sapi/cli/cmake/config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* Define to 1 if PHP uses the 'libedit' library. */
2+
#cmakedefine HAVE_LIBEDIT 1
3+
14
/* Define if the PS_STRINGS exists. */
25
#cmakedefine HAVE_PS_STRINGS
36

cmake/sapi/fpm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ set_target_properties(
242242
PROPERTIES
243243
OUTPUT_NAME ${PHP_PROGRAM_PREFIX}php-fpm${PHP_PROGRAM_SUFFIX}
244244
ENABLE_EXPORTS TRUE # TODO: Check if there's a better solution.
245+
PHP_SAPI_FASTCGI TRUE
245246
)
246247

247248
################################################################################

docs/cmake/cmake.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,12 @@ A list of PHP CMake modules:
424424
configuration. Extensions are sorted by their dependencies (extensions added
425425
with CMake command `add_dependencies()`).
426426

427+
* `PHP_SAPI_FASTCGI`
428+
429+
Target property that marks the selected PHP SAPI target as FastCGI-related.
430+
These SAPIs get the `main/fastcgi.c` object linked in the binary. For example,
431+
PHP CGI and PHP FPM SAPIs.
432+
427433
* `PHP_SAPIS`
428434

429435
Global property with a list of all enabled PHP SAPIs for the current

0 commit comments

Comments
 (0)