Skip to content

php8: fix and enhance configuration and dependencies#28234

Merged
mhei merged 4 commits intoopenwrt:masterfrom
danielfdickinson:pr-fix-php8-gettext-icu-always-selected
Jan 16, 2026
Merged

php8: fix and enhance configuration and dependencies#28234
mhei merged 4 commits intoopenwrt:masterfrom
danielfdickinson:pr-fix-php8-gettext-icu-always-selected

Conversation

@danielfdickinson
Copy link
Contributor

@danielfdickinson danielfdickinson commented Jan 1, 2026

📦 Package Details

Maintainer: @mhei

Description:

This commit cleans up and enhances the changes from 6d6233b, f9591b8, e6c59b5, and properly implements the attempt from 996046e.

By reasoning carefully about the impact of combinations of configuration options, and thoroughly setting config options and checking actual dynamic dependencies using readelf --dynamic, the configuration and dependency handling of these options has been improved.

In addition, cleanups and enhancements like reorganizing CONFIG_DEPENDS, adding more Kconfig help text, and cleaning up some whitespace have been performed.

  • A missing conditional BUILD_DEPENDS on package icu when PHP8_GETTEXT is defined has been added.
  • The PHP8_GETTEXT, PHP8_INTL, PHP8_FULLICUDATA, php8-mod-gettext, and php8-mod-intl interactions have been verified, fixed, and improved.
  • A circular dependency with php8-mod-xmlreader, PHP8_DOM, and php8-mod-dom when php8-mod-xmlreader is depended on by another package (e.g. zabbix-server-frontend) has been corrected
  • As these changes potentially impact binaries, there is a PKG_RELEASE bump.

🧪 Run Testing Details

  • OpenWrt Version: SNAPSHOT (r32450-8b93c563ad)
  • OpenWrt Target/Subtarget: bcm27xx/bcm2712
  • OpenWrt Device: rpi-5

The following have been tested using Zabbix server frontend as the PHP test application:

  1. Included php8-mod-gettext but not php8-mod-intl, set PHP8_GETTEXT and PHP8_INTL, but not PHP8_FULLICU_DATA.
  2. Included php8-mod-gettext but not php8-mod-intl, set PHP8_GETTEXT, not PHP8_INTL, and not PHP8_FULLICU_DATA.
  3. Included php8-mod-gettext (compiled and in image) and php8-mod-intl (compiled only), set PHP8_GETTEXT and PHP8_INTL, but not PHP8_FULLICU_DATA.
  4. Included php8-mod-gettext (compiled and in image) and php8-mod-intl (compiled and in image), set PHP8_GETTEXT and PHP8_INTL, and PHP8_FULLICU_DATA.
  5. Included php8-mod-gettext (compiled and in image) and php8-mod-intl (compiled and in image), set PHP8_GETTEXT and PHP8_INTL, but not PHP8_FULLICU_DATA.

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

@danielfdickinson danielfdickinson marked this pull request as ready for review January 1, 2026 10:41
@mhei
Copy link
Member

mhei commented Jan 3, 2026

Nice! At first glance, it looks good to me. I would like to have a deeper look tomorrow evening.

@danielfdickinson danielfdickinson force-pushed the pr-fix-php8-gettext-icu-always-selected branch from 72ef85e to be62019 Compare January 4, 2026 03:43
@danielfdickinson danielfdickinson force-pushed the pr-fix-php8-gettext-icu-always-selected branch from be62019 to faae8bd Compare January 4, 2026 03:53
@danielfdickinson
Copy link
Contributor Author

Noticed an issue with configuring with openssl when php8-mod-openssl is not selected, so fixed that.

@danielfdickinson danielfdickinson force-pushed the pr-fix-php8-gettext-icu-always-selected branch from bf8f4bc to 23ae03c Compare January 4, 2026 05:04
@danielfdickinson
Copy link
Contributor Author

I've dropped the openssl changes - this looks like another can of worms.

depends on PHP8_LIBXML
default y
help
Without the mod-dom, this option does not provide a PHP8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I'd use "Without the dom module,..." or we could use the complete package names, e.g. "Without php8-mod-dom, this..."

CONFIG_PHP8_INTL \
CONFIG_PHP8_SYSTEMTZDATA

PKG_BUILD_DEPENDS:= PHP8_GETTEXT:icu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean PHP8_INTL here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, due to this configure line, which needs icu to compile, but icu does not become a php8 dependency for php8-mod-gettext because of it, nor is php8-mod-gettext required to be built (in the case php8-mod-gettext is not built, it affects php8-cli, php8-*cgi, and apache-mod-php8, so is still relevant).

ifeq ($(CONFIG_PHP8_GETTEXT),y)
  CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
else
  CONFIGURE_ARGS+= --without-gettext
endif

prior to 6d6233b

this was

ifneq ($(SDK)$(CONFIG_PACKAGE_php8-mod-gettext),)
  CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
else
  CONFIGURE_ARGS+= --without-gettext
endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'm still confused because:

  • before we had: PACKAGE_php8-mod-intl--enable-intl=shared and +PACKAGE_php8-mod-intl:icu which added the runtime dep and thus kind of automatically added a build-dep only when the module was selected, parallel CONFIG_PACKAGE_php8-mod-gettext--with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full" and the corresponding runtime dep to libintl-full, but without any reference to icu

  • now we have PHP8_INTL depends on PHP8_GETTEXT with: PHP8_INTL--enable-intl=shared and PHP8_GETTEXT--with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"; independent of whether the modules are selected or not

In my tests, even when I don't declare the build dependency, then icu is built (I don't know why yet). But gettext seems to not have a runtime dep on icu (at least readelf does not show it), only intl does. So I assumed that it would make more sense to use PKG_BUILD_DEPENDS:= PHP8_INTL:icu here.

This is why I'm still confused - do you have other results/findings?

Copy link
Contributor Author

@danielfdickinson danielfdickinson Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • For me the GETTEXT "$(STAGING_DIR)/usr/lib/libintl-full fails with complaint about missing icu unless I use PKG_BUILD_DEPENDS:=PHP8_GETTEXT:icu.
  • gettext does not acquire a runtime dependency on icu despite that.

Copy link
Contributor Author

@danielfdickinson danielfdickinson Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tried to build mod-gettext without that config - perhaps it could be moved to PHP8_INTL? It was there from the original version, and I didn't try to change that part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I see with the package as it is in master now:

checking whether to enable internationalization support... yes, shared
checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

Package 'icu-uc' not found
Package 'icu-io' not found
Package 'icu-i18n' not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is with PHP8_GETTEXT and PHP8_INTL both =y, and PACKAGE_php8-mod-gettext=y but PACKAGE_php8-mod-intl not set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, thanks for spending time on this and sorting the issues out - appreciated.
Yes, I can confirm this and this is expected. Adding PKG_BUILD_DEPENDS:= PHP8_INTL:icu fixes the issue.
Even for the configuration PHP8_GETTEXT=y and PHP8_INTL not set, PACKAGE_php8-mod-gettext and PACKAGE_php8-mod-intl both not set.

I've cherry-picked your commit from your branch here, rebased & applied to current master and slightly adapted according to what I think should work. Maybe you can have a look at https://github.com/mhei/packages/commits/pr-fix-php8-gettext-icu-always-selected It works for me and I hope that it also works on your side as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check tonight. Thank you for working with me on this - appreciated here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed it works for me.


config PHP8_FULLICUDATA
bool "Add dependency to full ICU Data"
depends on PHP8_INTL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP8_INTL already depends on PHP8_GETTEXT so this should not be required? And after looking at 72dd9ee again, since this flag is only affecting the php8-mod-intl, I think we should revert to use Package/php8-mod-intl/config stuff, so that this option is displayed near the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it because Kconfig did not want to behave properly with it as Package/php8-mod-intl/config. I don't know if it's just the vagaries of Kconfig or if there is a bug to chase down, and in another couple of instances.

$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php8-mod-gmp:libgmp))
$(eval $(call BuildModule,iconv,iConv,$(ICONV_DEPENDS)))
$(eval $(call BuildModule,intl,Internationalization Functions,@PHP8_INTL +PACKAGE_php8-mod-intl:icu +PHP8_FULLICUDATA:icu-full-data))
$(eval $(call BuildModule,intl,Internationalization Functions,@PHP8_GETTEXT @PHP8_INTL +PACKAGE_php8-mod-intl:php8-mod-gettext +PHP8_FULLICUDATA:icu-full-data +!PHP8_FULLICUDATA:icu))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • @PHP_GETTEXT should not be required here since @PHP8_INTL already depends on it, right?
  • I'd prefer to leave the dependency to icu and icu-full-data as is: the dependency to icu is always required, and the dependency with PHP8_FULLICUDATA to icu-full-data is in my eyes just a "convenience" helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kconfig issues again.

config PHP8_INTL
bool "Enable Internationalization"
depends on PHP8_GETTEXT
default y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to do more tests, but at the moment, I don't see that PHP8_INTL must depend on PHP8_GETTEXT.
But on the other side, I think we should add to PHP8_LIBXML, PHP8_GETTEXT and PHP8_INTL a depends on depends on PACKAGE_php8 so that all options are hidden, if the "top-level" config option is not selected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was because Kconfig was behaving strangely without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also adding a depends on PACKAGE_php8 gave me recursive dependency Kconfig problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I did try PHP8_INTL without PHP8_GETTEXT, that may be able to be disentangled.

danielfdickinson referenced this pull request Jan 7, 2026
Fixes: php8: global package dependency changes based on module
selection

Fixes: #28078

As described in #28078 and #28075,

Some binaries gain a dependency on libstdcpp when mod-gettext is included
in the build, however this was not explicitly declared, so packaging
fails with (e.g.):

Package php8-cgi is missing dependencies for the following libraries:
libstdc++.so.6

In contrast to #28075, this commit takes the approach:

* Make use of --with-gettext depend on a configure flag (enabled by
  default, since that matches current full build behaviour)
* Make sub-packages which require --with-gettext depend on the
  configure flag

This means that e.g. php-cgi would not have gettext support if the
configure flag was disabled, and e.g. php-mod-gettext and php-mod-intl
would not be selectable.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
@danielfdickinson
Copy link
Contributor Author

@mhei I have not given up on this - I've just not had a chance to try again. Kconfig can be a pain to work with.

Switch to a single CONFIG_ per line, and alphabetize.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
xmlreader was selecting package php8-mod-dom as well as depending on
PHP8_DOM, while php8-mod-dom also depended on PHP8_DOM (and therefore
selected PHP8_DOM when php8-mod-dom was selected). This is a Kconfig
recursive dependency, so break the recursion by noting that because
php8-mod-xmlreader selects php8-mod-dom, PHP8_DOM is a transitive
depends, so php8-mod-xmlreader should not depend on PHP8_DOM itself.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
Add more menuconfig help text descriptions, and
convert some mixed tabs and spaces to spaces.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
* Add a needed BUILD_DEPENDENCY on icu package, when PHP8_INTL is
  defined.
* Make PHP8_DOM selecting PHP8_LIBXML instead of depending on it.
* PHP8_INTL does not depend on PHP8_GETTEXT, it builds also
  without gettext.
* Always show option for choosing PHP8_FULLUCIDATA
* For php8-cgi, php-cli, etc, a libstdcpp dependency is only gained
when PHP8_INTL is selected, therefore update those conditional depends.

As some combinations of these changes can change the binaries output,
PKG_RELEASE has been bumped.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
@mhei mhei force-pushed the pr-fix-php8-gettext-icu-always-selected branch from 23ae03c to 46f0e43 Compare January 15, 2026 20:55
@danielfdickinson
Copy link
Contributor Author

LGTM! Thank you.

@mhei mhei merged commit f8b8ce6 into openwrt:master Jan 16, 2026
12 checks passed
@danielfdickinson danielfdickinson deleted the pr-fix-php8-gettext-icu-always-selected branch January 17, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants