[php-src] PR #17545: Avoid duplicate build rules
| From: | cmb69 | Date: | Wed, 22 Jan 2025 17:12:07 +0000 |
| Subject: | [php-src] PR #17545: Avoid duplicate build rules | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30477@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17545
Author: cmb69
On Windows, the cli and phpdbg SAPIs have variants (cli-win32 and phpdbgs, respectively) which are
build by default. However, the variants share some files, what leads to duplicate build rules in
the generated Makefile. NMake throws warning U4004[1], but proceeds happily, ignoring the second
build rule. That means that different flags for duplicate rules are ignored, hinting at a potential
problem.
We solve this by introducing an additional (optional) argument to
SAPI() and
ADD_SOURCES() which can be used to avoid such duplicate build rules. It's left to
the SAPI maintainers to make sure that appropriate rules are created. We fix this for phpdbgs right
away, which currently couldn't be build without phpdbg due to the missing define; we remove the
unused PHP_PHPDBG_EXPORTS flag altogether.
[1] <https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/nmake-warning-u4004>
---
Note that I tried to solve this without even touching confutils.js, but failed. While this solution
isn't particularly great, it solves the duplicate rules problem without any BC implications for
users.
Also note that PHPDBG_API is not properly handled on Windows; due to missing
__declspec(dllimport) there is a minimal performance impact, and variables
couldn't be accessed at all (but there are none anyway). I'll try to follow up with a
"fix".