Skip to content

Commit 80b00ef

Browse files
committed
Add the zend_vm_gen.php patch to CMake directly and fix CS
1 parent bbd55fa commit 80b00ef

File tree

9 files changed

+38
-125
lines changed

9 files changed

+38
-125
lines changed

bin/make-patches.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,19 @@ patch-cmake-8.3-aspell
1313
patch-cmake-8.3-dmalloc
1414
patch-cmake-8.3-php-config
1515
patch-cmake-8.3-phpdbg-prompt
16-
patch-cmake-8.3-zend-vm-gen
1716
patch-cmake-8.4
1817
patch-cmake-8.4-asm
1918
patch-cmake-8.4-dmalloc
2019
patch-cmake-8.4-php-config
2120
patch-cmake-8.4-phpdbg-prompt
2221
patch-cmake-8.4-timelib
23-
patch-cmake-8.4-zend-vm-gen
2422
patch-cmake-8.5
2523
patch-cmake-8.5-asm
2624
patch-cmake-8.5-dmalloc
2725
patch-cmake-8.5-docs
2826
patch-cmake-8.5-php-config
2927
patch-cmake-8.5-phpdbg-prompt
3028
patch-cmake-8.5-timelib
31-
patch-cmake-8.5-zend-vm-gen
3229
"
3330

3431
# A list of supported PHP versions.

cmake/Zend/CMakeLists.txt

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -455,29 +455,35 @@ endif()
455455
# Create files and set installation.
456456
################################################################################
457457

458-
if(PHPSystem_EXECUTABLE)
459-
set(PHP_EXECUTABLE ${PHPSystem_EXECUTABLE})
460-
elseif(NOT CMAKE_CROSSCOMPILING)
461-
set(PHP_EXECUTABLE "$<TARGET_FILE:php_cli>")
462-
elseif(CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR)
463-
set(PHP_EXECUTABLE "${CMAKE_CROSSCOMPILING_EMULATOR};$<TARGET_FILE:php_cli>")
464-
endif()
465-
466-
if(PHP_EXECUTABLE)
467-
# Run the Zend/zend_vm_gen.php script.
468-
add_custom_command(
469-
OUTPUT zend_vm
470-
COMMAND ${PHP_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/zend_vm_gen.php
471-
DEPENDS
472-
php_cli
473-
${CMAKE_CURRENT_SOURCE_DIR}/zend_vm_execute.skl
474-
COMMENT "[Zend] Regenerating zend_vm_execute.h and zend_vm_opcodes.{h,c}"
475-
VERBATIM
476-
)
477-
478-
add_custom_target(zend_generate_vm ALL DEPENDS zend_vm)
458+
# On 32-bit targets the zend_vm_gen.php script outputs deprecation warnings. As
459+
# 32-bit targets are not considered development oriented environments, where the
460+
# files need to be regenerated, executing this script is skipped.
461+
# See: https://github.com/php/php-src/issues/15899
462+
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
463+
if(PHPSystem_EXECUTABLE)
464+
set(PHP_EXECUTABLE ${PHPSystem_EXECUTABLE})
465+
elseif(NOT CMAKE_CROSSCOMPILING)
466+
set(PHP_EXECUTABLE "$<TARGET_FILE:php_cli>")
467+
elseif(CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR)
468+
set(PHP_EXECUTABLE "${CMAKE_CROSSCOMPILING_EMULATOR};$<TARGET_FILE:php_cli>")
469+
endif()
479470

480-
set_property(SOURCE zend_vm PROPERTY SYMBOLIC TRUE)
471+
if(PHP_EXECUTABLE)
472+
# Run the Zend/zend_vm_gen.php script.
473+
add_custom_command(
474+
OUTPUT zend_vm
475+
COMMAND ${PHP_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/zend_vm_gen.php
476+
DEPENDS
477+
php_cli
478+
${CMAKE_CURRENT_SOURCE_DIR}/zend_vm_execute.skl
479+
COMMENT "[Zend] Regenerating zend_vm_execute.h and zend_vm_opcodes.{h,c}"
480+
VERBATIM
481+
)
482+
483+
add_custom_target(zend_generate_vm ALL DEPENDS zend_vm)
484+
485+
set_property(SOURCE zend_vm PROPERTY SYMBOLIC TRUE)
486+
endif()
481487
endif()
482488

483489
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")

cmake/cmake/modules/PHP/Install.cmake

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#[=============================================================================[
22
Set the `CMAKE_INSTALL_*` variables inside the `install(CODE|SCRIPT)`.
33
4-
This is built on top of the CMake's `GNUInstallDirs` module. At the time of
5-
writing, CMake documentation mentions special cases where, for example, the
6-
`CMAKE_INSTALL_FULL_SYSCONFDIR` variable becomes the `/etc`, when the install
7-
prefix is `/usr`, and similar.
4+
This is built on top of the CMake's
5+
[`GNUInstallDirs`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)
6+
module and the
7+
[`install()`](https://cmake.org/cmake/help/latest/command/install.html) command.
8+
At the time of writing, CMake documentation mentions special cases where, for
9+
example, the `CMAKE_INSTALL_FULL_SYSCONFDIR` variable becomes the `/etc`, when
10+
the install prefix is `/usr`, and similar.
811
912
However, some of these special cases aren't taken into account when using the
10-
`install()` commands.
13+
`install()` commands. See: https://gitlab.kitware.com/cmake/cmake/-/issues/25852
1114
1215
This module exposes the following function:
1316
@@ -24,11 +27,6 @@ php_install(CODE "
2427
message(STATUS \"CMAKE_INSTALL_SYSCONFDIR=\${CMAKE_INSTALL_SYSCONFDIR}\")
2528
")
2629
```
27-
28-
See:
29-
30-
* https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
31-
* https://cmake.org/cmake/help/latest/command/install.html
3230
#]=============================================================================]
3331

3432
include_guard(GLOBAL)

cmake/sapi/fpm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ php_configure_file(
472472
EXPANDED_SYSCONFDIR "$<PATH:ABSOLUTE_PATH,NORMALIZE,${CMAKE_INSTALL_SYSCONFDIR},$<INSTALL_PREFIX>>"
473473
)
474474

475-
install(TARGETS php_fpm DESTINATION ${CMAKE_INSTALL_SBINDIR})
475+
install(TARGETS php_fpm RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
476476

477477
php_install(CODE "
478478
# Create log and run directories on installation.

cmake/sapi/phpdbg/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ install(
285285

286286
# Create log and run directories on installation.
287287
php_install(CODE "
288-
# Create log and run directories on installation.
289288
file(
290289
MAKE_DIRECTORY
291290
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log\"

patches/8.3/aspell.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ index 879300f992..de820684fb 100644
4343
libsasl2-dev:i386 \
4444
libsodium-dev:i386 \
4545
diff --git a/.github/actions/apt-x64/action.yml b/.github/actions/apt-x64/action.yml
46-
index 8f2f608278..c3ae0ada63 100644
46+
index bc2aa00df2..739abf8fe5 100644
4747
--- a/.github/actions/apt-x64/action.yml
4848
+++ b/.github/actions/apt-x64/action.yml
4949
@@ -34,7 +34,6 @@ runs:

patches/8.3/zend-vm-gen.patch

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

patches/8.4/zend-vm-gen.patch

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

patches/8.5/zend-vm-gen.patch

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

0 commit comments

Comments
 (0)