Skip to content

Commit 68f50a8

Browse files
committed
Fix nits
- Added required ext_skel.php adjustments to be able to copy files in subdirectories - Comments updated - CMake syntax synced
1 parent 8f019ef commit 68f50a8

File tree

9 files changed

+53
-26
lines changed

9 files changed

+53
-26
lines changed

bin/check-cmake.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function checkCMakeInclude(Iterator $files, array $modules): int
327327
};
328328

329329
/**
330-
* Check if given string is regular expression.
330+
* Check if given string is a regular expression.
331331
*/
332332
function isRegularExpression(string $string): bool
333333
{

cmake/cmake/CMakeDefaults.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html
77

88
include_guard(GLOBAL)
99

10-
# Set CMake module paths where include() and find_package() look for modules.
11-
if(NOT ${CMAKE_CURRENT_LIST_DIR}/modules IN_LIST CMAKE_MODULE_PATH)
12-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
13-
endif()
10+
# Add paths where include() and find_package() look for modules.
11+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
1412

1513
# Automatically include current source or build tree for the current target.
1614
set(CMAKE_INCLUDE_CURRENT_DIR ON)

cmake/cmake/Platform.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include(PHP/SystemExtensions)
2323
# _GNU_SOURCE.
2424
target_link_libraries(php_config INTERFACE PHP::SystemExtensions)
2525

26-
# Set installation directories.
26+
# Define GNU standard installation directories.
2727
include(GNUInstallDirs)
2828

2929
# Detect C standard library implementation.

cmake/cmake/modules/PHP/Extensions.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ function(php_extensions_configure_headers)
483483
get_target_property(type php_ext_${extension} TYPE)
484484
if(type MATCHES "^(MODULE|SHARED)_LIBRARY$")
485485
set(${macro} TRUE)
486+
else()
487+
set(${macro} FALSE)
486488
endif()
487489

488490
# Prepare config.h template.

cmake/ext/skeleton/CMakeLists.txt.in

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ Build extension as shared.
2121
# CMakeLists.txt file for the %EXTNAME% extension.
2222

2323
# Set minimum required CMake version.
24-
cmake_minimum_required(VERSION 3.25)
24+
cmake_minimum_required(VERSION 3.25...3.31)
2525

26-
# Append extension's local CMake modules.
27-
if(NOT ${CMAKE_CURRENT_LIST_DIR}/cmake/modules IN_LIST CMAKE_MODULE_PATH)
28-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules)
29-
endif()
26+
# Add paths where include() and find_package() look for modules.
27+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules)
3028

31-
# Set the extension project metadata.
29+
# Define the PHP extension project and its metadata.
3230
project(
3331
%EXTNAME%
3432
VERSION 0.1.0

cmake/pear/cmake/InstallPear.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ file(
141141
${phpPearStageTempDir}/temp
142142
)
143143

144-
# Add options for PHP executable, when dependent extensions are shared, they
145-
# need to be loaded for the PHP_EXECUTABLE.
144+
# Add PHP command-line options for shared dependent extensions.
146145
set(phpPearOptions -d extension_dir=${PHP_BINARY_DIR}/modules)
147146

148147
if(PHP_EXT_OPENSSL_SHARED)

patches/8.3/cmake.patch

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Subject: Add CMake changes for PHP-8.3 branch
99
---
1010
.editorconfig | 2 +-
1111
.gitignore | 50 ++++++++++++++++++++++++++++++++++++++
12-
ext/ext_skel.php | 2 ++
12+
ext/ext_skel.php | 7 ++++++
1313
ext/skeleton/.gitignore.in | 23 ++++++++++++++++++
1414
run-tests.php | 24 +++++++++++++-----
15-
5 files changed, 94 insertions(+), 7 deletions(-)
15+
5 files changed, 99 insertions(+), 7 deletions(-)
1616

1717
diff --git a/.editorconfig b/.editorconfig
1818
index 7911bf8490..1d9b530947 100644
@@ -99,10 +99,10 @@ index 449963153f..913ed3d96d 100644
9999
!/ext/fileinfo/libmagic/config.h
100100
!/ext/fileinfo/libmagic.patch
101101
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
102-
index ae7a3a987c..a9e0dd1b51 100755
102+
index ae7a3a987c..a67901a2c9 100755
103103
--- a/ext/ext_skel.php
104104
+++ b/ext/ext_skel.php
105-
@@ -302,6 +302,8 @@ function copy_config_scripts() {
105+
@@ -302,11 +302,18 @@ function copy_config_scripts() {
106106
$files[] = 'config.w32';
107107
}
108108

@@ -111,6 +111,16 @@ index ae7a3a987c..a9e0dd1b51 100755
111111
$files[] = '.gitignore';
112112

113113
foreach($files as $config_script) {
114+
$new_config_script = $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $config_script;
115+
116+
+ $directory = dirname($new_config_script);
117+
+ if (!is_dir($directory) && !mkdir($directory, 0777, true)) {
118+
+ error('Unable to create ' . $directory . ' directory in the output directory');
119+
+ }
120+
+
121+
if (!copy($options['skel'] . $config_script . '.in', $new_config_script)) {
122+
error('Unable to copy config script: ' . $config_script);
123+
}
114124
diff --git a/ext/skeleton/.gitignore.in b/ext/skeleton/.gitignore.in
115125
index ae434fef97..87545d9162 100644
116126
--- a/ext/skeleton/.gitignore.in

patches/8.4/cmake.patch

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Subject: Add CMake changes for PHP-8.4 branch
99
---
1010
.editorconfig | 2 +-
1111
.gitignore | 50 ++++++++++++++++++++++++++++++++++++++
12-
ext/ext_skel.php | 2 ++
12+
ext/ext_skel.php | 7 ++++++
1313
ext/skeleton/.gitignore.in | 23 ++++++++++++++++++
1414
run-tests.php | 24 +++++++++++++-----
15-
5 files changed, 94 insertions(+), 7 deletions(-)
15+
5 files changed, 99 insertions(+), 7 deletions(-)
1616

1717
diff --git a/.editorconfig b/.editorconfig
1818
index 7911bf8490..1d9b530947 100644
@@ -99,10 +99,10 @@ index 52dde98ed4..d698b5a19c 100644
9999
!/ext/fileinfo/libmagic/config.h
100100
!/ext/fileinfo/libmagic.patch
101101
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
102-
index ae7a3a987c..a9e0dd1b51 100755
102+
index ae7a3a987c..a67901a2c9 100755
103103
--- a/ext/ext_skel.php
104104
+++ b/ext/ext_skel.php
105-
@@ -302,6 +302,8 @@ function copy_config_scripts() {
105+
@@ -302,11 +302,18 @@ function copy_config_scripts() {
106106
$files[] = 'config.w32';
107107
}
108108

@@ -111,6 +111,16 @@ index ae7a3a987c..a9e0dd1b51 100755
111111
$files[] = '.gitignore';
112112

113113
foreach($files as $config_script) {
114+
$new_config_script = $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $config_script;
115+
116+
+ $directory = dirname($new_config_script);
117+
+ if (!is_dir($directory) && !mkdir($directory, 0777, true)) {
118+
+ error('Unable to create ' . $directory . ' directory in the output directory');
119+
+ }
120+
+
121+
if (!copy($options['skel'] . $config_script . '.in', $new_config_script)) {
122+
error('Unable to copy config script: ' . $config_script);
123+
}
114124
diff --git a/ext/skeleton/.gitignore.in b/ext/skeleton/.gitignore.in
115125
index e691bd3964..191fcd70eb 100644
116126
--- a/ext/skeleton/.gitignore.in

patches/8.5/cmake.patch

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Subject: Add CMake changes for PHP-8.5 branch
99
---
1010
.editorconfig | 2 +-
1111
.gitignore | 50 ++++++++++++++++++++++++++++++++++++++
12-
ext/ext_skel.php | 2 ++
12+
ext/ext_skel.php | 7 ++++++
1313
ext/skeleton/.gitignore.in | 23 ++++++++++++++++++
1414
run-tests.php | 24 +++++++++++++-----
15-
5 files changed, 94 insertions(+), 7 deletions(-)
15+
5 files changed, 99 insertions(+), 7 deletions(-)
1616

1717
diff --git a/.editorconfig b/.editorconfig
1818
index 19be96087d..58a83dfb68 100644
@@ -99,10 +99,10 @@ index 52dde98ed4..d698b5a19c 100644
9999
!/ext/fileinfo/libmagic/config.h
100100
!/ext/fileinfo/libmagic.patch
101101
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
102-
index cd82abb346..74ee94c7e2 100755
102+
index cd82abb346..19f55f4673 100755
103103
--- a/ext/ext_skel.php
104104
+++ b/ext/ext_skel.php
105-
@@ -289,6 +289,8 @@ function copy_config_scripts() {
105+
@@ -289,11 +289,18 @@ function copy_config_scripts() {
106106
$files[] = 'config.w32';
107107
}
108108

@@ -111,6 +111,16 @@ index cd82abb346..74ee94c7e2 100755
111111
$files[] = '.gitignore';
112112

113113
foreach($files as $config_script) {
114+
$new_config_script = $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $config_script;
115+
116+
+ $directory = dirname($new_config_script);
117+
+ if (!is_dir($directory) && !mkdir($directory, 0777, true)) {
118+
+ error('Unable to create ' . $directory . ' directory in the output directory');
119+
+ }
120+
+
121+
if (!copy($options['skel'] . $config_script . '.in', $new_config_script)) {
122+
error('Unable to copy config script: ' . $config_script);
123+
}
114124
diff --git a/ext/skeleton/.gitignore.in b/ext/skeleton/.gitignore.in
115125
index e691bd3964..191fcd70eb 100644
116126
--- a/ext/skeleton/.gitignore.in

0 commit comments

Comments
 (0)