Skip to content

Commit 46cb8fd

Browse files
committed
Add various improvements
- Sync ext/skeleton bootstrap temporary file between branches - Fix FindPHP IMPORTED library type to be INTERFACE as it doesn't have any built library to link with - Fix bin/init.sh script to work without patch command and use the git when patch is not installed - Sync configuration headers further: Move all "build" related macros on Windows to the end of the file for future refactorings - Fix some nits
1 parent 32a9610 commit 46cb8fd

File tree

5 files changed

+78
-44
lines changed

5 files changed

+78
-44
lines changed

bin/init.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ done
8282
# Check requirements.
8383
which=$(which which 2>/dev/null)
8484
cmake=$(which cmake 2>/dev/null)
85-
patch=$(which patch 2>/dev/null)
8685
git=$(which git 2>/dev/null)
86+
patch=$(which patch 2>/dev/null)
8787

8888
if test -z "$which"; then
8989
echo "init.sh: The 'which' command not found." >&2
@@ -98,22 +98,22 @@ if test -z "$cmake"; then
9898
echo "" >&2
9999
fi
100100

101-
if test -z "$patch"; then
102-
echo "init.sh: The 'patch' command not found." >&2
103-
echo " Please install patch utilities:" >&2
104-
echo " http://savannah.gnu.org/projects/patch" >&2
105-
echo "" >&2
106-
fi
107-
108101
if test -z "$git"; then
109102
echo "init.sh: The 'git' command not found." >&2
110103
echo " Please install Git:" >&2
111104
echo " https://git-scm.com" >&2
112105
echo "" >&2
113106
fi
114107

108+
if test -z "$patch"; then
109+
echo "init.sh: The 'patch' command not found." >&2
110+
echo " Instead, the 'git' command will be used to apply patches." >&2
111+
echo " Optionally install patch utilities:" >&2
112+
echo " http://savannah.gnu.org/projects/patch" >&2
113+
echo "" >&2
114+
fi
115+
115116
if test -z "${cmake}" \
116-
|| test -z "${patch}" \
117117
|| test -z "${git}"
118118
then
119119
exit 1
@@ -196,8 +196,12 @@ fi
196196
for file in $patches; do
197197
case $file in
198198
*.patch)
199-
"$patch" -p1 -d php-src < $file
200-
;;
199+
if test -n "$patch"; then
200+
"$patch" -p1 -d php-src < $file
201+
else
202+
"$git" apply $file --directory php-src
203+
fi
204+
;;
201205
esac
202206
done
203207

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Set GNU standard installation directories.
2+
include(GNUInstallDirs)
3+
4+
set(CMAKE_INSTALL_INCLUDEDIR "${PHP_INSTALL_INCLUDEDIR}")
5+
6+
# Run at the end of the extension's configuration phase.
7+
cmake_language(DEFER DIRECTORY ${CMAKE_SOURCE_DIR} CALL _php_hook_end_of_configure())
8+
function(_php_hook_end_of_configure)
9+
message(STATUS "********PHP Bootstrap********")
10+
message(STATUS "This is executed at the end of the extension's configuration.")
11+
message(STATUS "********PHP Bootstrap********")
12+
endfunction(_my_hook_end_of_configure)

cmake/ext/skeleton/cmake/modules/FindPHP.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ endif()
286286
set(PHP_LIBRARIES ${PHP_EMBED_LIBRARY})
287287

288288
if(NOT TARGET PHP::PHP)
289-
add_library(PHP::PHP UNKNOWN IMPORTED)
289+
add_library(PHP::PHP INTERFACE IMPORTED)
290290

291291
set_target_properties(
292292
PHP::PHP

cmake/main/config.w32.cmake.h.in

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@
260260
/* Define to 1 if the PHP extension 'zlib' is built as a dynamic module. */
261261
#cmakedefine COMPILE_DL_ZLIB 1
262262

263-
/* Configure line */
264-
#cmakedefine CONFIGURE_COMMAND "@CONFIGURE_COMMAND@"
265-
266263
/* Autotools-based build system in PHP-8.3 checked for older glibc versions (up
267264
to ~2.1.2), which used the _IO_cookie_io_functions_t symbol. However, there
268265
is a bug in PHP-8.3 check and it never got defined to anything but
@@ -1838,11 +1835,6 @@
18381835
/* Define to 1 if the pdo_mysql extension uses mysqlnd. */
18391836
#cmakedefine PDO_USE_MYSQLND 1
18401837

1841-
/* The PEAR installation directory. */
1842-
#define PEAR_INSTALLDIR "@PREFIX@\\pear"
1843-
1844-
#define PHP_BINDIR "@PREFIX@"
1845-
18461838
/* The build architecture. */
18471839
#cmakedefine PHP_BUILD_ARCH "@PHP_BUILD_ARCH@"
18481840

@@ -1861,15 +1853,6 @@
18611853
/* Compiler identification string. */
18621854
#cmakedefine PHP_COMPILER_ID "@PHP_COMPILER_ID@"
18631855

1864-
/* The path in which to look for php.ini. */
1865-
#define PHP_CONFIG_FILE_PATH ""
1866-
1867-
#define PHP_CONFIG_FILE_SCAN_DIR "@PHP_FULL_CONFIG_FILE_SCAN_DIR@"
1868-
1869-
#define PHP_DATADIR "@PREFIX@"
1870-
1871-
#define PHP_EXTENSION_DIR "@PREFIX@\\ext"
1872-
18731856
/* Whether the compiler supports AVX-512. */
18741857
#cmakedefine01 PHP_HAVE_AVX512_SUPPORTS
18751858

@@ -1941,21 +1924,15 @@
19411924
/* The iconv implementation. */
19421925
#cmakedefine PHP_ICONV_IMPL "@PHP_ICONV_IMPL@"
19431926

1944-
#define PHP_INCLUDE_PATH ".;@PREFIX@\\pear"
1945-
19461927
/* Define to 1 you have IRIX-style reentrant time functions. */
19471928
#cmakedefine PHP_IRIX_TIME_R 1
19481929

1949-
#define PHP_LIBDIR "@PREFIX@"
1950-
19511930
/* Linker major version. */
19521931
#cmakedefine PHP_LINKER_MAJOR @PHP_LINKER_MAJOR@
19531932

19541933
/* Linker minor version. */
19551934
#cmakedefine PHP_LINKER_MINOR @PHP_LINKER_MINOR@
19561935

1957-
#define PHP_LOCALSTATEDIR "@PREFIX@"
1958-
19591936
/* Define to 1 if mhash support is enabled. */
19601937
#cmakedefine PHP_MHASH_BC 1
19611938

@@ -1977,22 +1954,15 @@
19771954
/* */
19781955
#cmakedefine PHP_PDO_OCI_CLIENT_VERSION "@PHP_PDO_OCI_CLIENT_VERSION@"
19791956

1980-
#define PHP_PREFIX "@PREFIX@"
1981-
19821957
/* Define to 1 if 'pread' declaration with 'off64_t' is missing. */
19831958
#cmakedefine PHP_PREAD_64 1
19841959

19851960
/* Define to 1 if 'pwrite' declaration with 'off64_t' is missing. */
19861961
#cmakedefine PHP_PWRITE_64 1
19871962

1988-
#define PHP_SHLIB_EXT_PREFIX "php_"
1989-
#define PHP_SHLIB_SUFFIX "dll"
1990-
19911963
/* Define to 1 if PHP uses its own SIGCHLD handler, and to 0 if not. */
19921964
#cmakedefine01 PHP_SIGCHILD
19931965

1994-
#define PHP_SYSCONFDIR "@PREFIX@"
1995-
19961966
/* The 'uname -a' output. */
19971967
#cmakedefine PHP_UNAME "@PHP_UNAME@"
19981968

@@ -2096,7 +2066,8 @@
20962066
/* Define to 1 if Zend signal handling is supported and enabled. */
20972067
#cmakedefine ZEND_SIGNALS 1
20982068

2099-
/* */
2069+
/* Define to 1 if libzip is built statically on Windows. Required for static
2070+
libzip since version 1.0 to 1.3.2. */
21002071
#cmakedefine ZIP_STATIC 1
21012072

21022073
/* Define to 1 if thread safety (ZTS) is enabled. */
@@ -2105,6 +2076,52 @@
21052076
/* Define to 1 when using musl libc. */
21062077
#cmakedefine __MUSL__ 1
21072078

2079+
/* The following build system related configuration values are on *nix
2080+
systems defined in the main/build-defs.h and JScript Windows build system
2081+
defines them in the configuration header file. */
2082+
2083+
/* Configure line */
2084+
#cmakedefine CONFIGURE_COMMAND "@CONFIGURE_COMMAND@"
2085+
2086+
/* The PEAR installation directory. */
2087+
#define PEAR_INSTALLDIR "@PREFIX@\\pear"
2088+
2089+
/* The path to the bin directory. */
2090+
#define PHP_BINDIR "@PREFIX@"
2091+
2092+
/* The path in which to look for php.ini. */
2093+
#define PHP_CONFIG_FILE_PATH ""
2094+
2095+
/* The path where to scan for additional INI configuration files. */
2096+
#define PHP_CONFIG_FILE_SCAN_DIR "@PHP_FULL_CONFIG_FILE_SCAN_DIR@"
2097+
2098+
/* The path to the share directory. */
2099+
#define PHP_DATADIR "@PREFIX@"
2100+
2101+
/* Default directory for dynamically loadable PHP extensions. */
2102+
#define PHP_EXTENSION_DIR "@PREFIX@\\ext"
2103+
2104+
/* The 'include_path' PHP INI directive. */
2105+
#define PHP_INCLUDE_PATH ".;@PREFIX@\\pear"
2106+
2107+
/* The path containing system libraries (lib or lib64). */
2108+
#define PHP_LIBDIR "@PREFIX@"
2109+
2110+
/* The path to the var directory. */
2111+
#define PHP_LOCALSTATEDIR "@PREFIX@"
2112+
2113+
/* The installation prefix. */
2114+
#define PHP_PREFIX "@PREFIX@"
2115+
2116+
/* The prefix for the shared library objects. */
2117+
#define PHP_SHLIB_EXT_PREFIX "php_"
2118+
2119+
/* The shared library objects extension. */
2120+
#define PHP_SHLIB_SUFFIX "dll"
2121+
2122+
/* The path to the etc directory. */
2123+
#define PHP_SYSCONFDIR "@PREFIX@"
2124+
21082125
#if __has_include("main/config.pickle.h")
21092126
#include "main/config.pickle.h"
21102127
#endif

cmake/main/php_config.cmake.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,8 @@
20612061
/* Define to 1 if Zend signal handling is supported and enabled. */
20622062
#cmakedefine ZEND_SIGNALS 1
20632063

2064-
/* */
2064+
/* Define to 1 if libzip is built statically on Windows. Required for static
2065+
libzip since version 1.0 to 1.3.2. */
20652066
#cmakedefine ZIP_STATIC 1
20662067

20672068
/* Define to 1 if thread safety (ZTS) is enabled. */

0 commit comments

Comments
 (0)