Skip to content

Commit 0373157

Browse files
committed
Fix GH-16843: Windows phpize builds ignore source subfolders
phpize builds on Windows ignore the paths of extension sources, and build all object files in the same folder. This can't work if there are multiple source files with the same base name stored in separate folders and registered as such (e.g. cls/worker.c and src/worker.c). While extension authors can work around by avoiding duplicate base names, they may not even be aware of the problem because on POSIX systems, the object files are usually placed right besides the sources. Thus we take the relative path (from `configure_module_dirname`) of the source files into account even for phpize builds. Since this may break some extension builds (especially those which use Makefile fragments), we do not apply this fix to stable branches. Closes GH-17016.
1 parent 85731e8 commit 0373157

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ PHP NEWS
8181
- Windows:
8282
. Fixed bug GH-10992 (Improper long path support for relative paths). (cmb,
8383
nielsdos)
84+
. Fixed bug GH-16843 (Windows phpize builds ignore source subfolders). (cmb)
8485

8586
- XMLWriter:
8687
. Improved performance and reduce memory consumption. (nielsdos)

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ PHP 8.5 UPGRADE NOTES
166166
PHP_RELEASE_VERSION are now always numbers. Previously, they have been
167167
strings for buildconf builds.
168168

169+
* phpize builds now reflect the source tree in the build dir (like that already
170+
worked for in-tree builds); some extension builds (especially when using
171+
Makefile.frag.w32) may need adjustments.
172+
169173
* --enable-sanitzer is now supported for MSVC builds. This enables ASan and
170174
debug assertions, and is supported as of MSVC 16.10 and Windows 10.
171175

win32/build/confutils.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,15 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
16161616
if (obj_dir == null) {
16171617
if (MODE_PHPIZE) {
16181618
/* In the phpize mode, the subdirs are always relative to BUID_DIR.
1619-
No need to differentiate by extension, only one gets built. */
1620-
var build_dir = (dirname ? dirname : "").replace(new RegExp("^..\\\\"), "");
1619+
No need to differentiate by extension, only one gets built.
1620+
We still need to cater to subfolders, though. */
1621+
if (dir.charAt(configure_module_dirname.length) === "\\" &&
1622+
dir.substr(0, configure_module_dirname.length) === configure_module_dirname) {
1623+
var reldir = dir.substr(configure_module_dirname.length + 1);
1624+
var build_dir = (dirname ? (reldir + "\\" + dirname) : reldir).replace(new RegExp("^..\\\\"), "");
1625+
} else {
1626+
var build_dir = (dirname ? dirname : "").replace(new RegExp("^..\\\\"), "");
1627+
}
16211628
} else {
16221629
var build_dir = (dirname ? (dir + "\\" + dirname) : dir).replace(new RegExp("^..\\\\"), "");
16231630
}

0 commit comments

Comments
 (0)