-
Notifications
You must be signed in to change notification settings - Fork 292
[Php-wasm] Add intl support #2173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
@@ -1,7 +1,7 @@ | |||
# Originally forked from https://github.com/seanmorris/php-wasm | |||
# ubuntu:lunar supports amd64 and arm64 (Apple Silicon) while | |||
# emscripten/emsdk:3.1.24 supports amd64 only. | |||
FROM ubuntu:lunar as emscripten | |||
FROM ubuntu:noble as emscripten |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why do we need a Ubuntu version update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lunar is EOL (since January 2024) so i wasn't able to just run the dockerfile and install everything, changing ubuntu version helped in that regard.
FYI, here is how original php-wasm builds intl https://github.com/seanmorris/php-wasm/tree/master/packages/intl maybe its an useful context |
@oskardydo I tried to enable
I also modified the
and got the following errors :
To move forward, I added :
inside
I didn't copy the extension files because I hadn't compiled the package yet : I copy pasted this pull request
then
I then added
I ran : I now have these errors in the 67th step :
Probably related to the missing(?) Have you successfully compiled PHP for the web? @tmotyl I also made a minimal version of
In the Even if I followed every steps in my Dockerfile, it is failing with :
I set that problem aside since the previous errors should be solved first. |
I compiled
Modifying
I checked if each I cleaned a little bit more the code and found out that this part :
Is only needed when
While this :
Is only needed when @adamziel @bgrgicak At this point, should :
Next step : Load |
Yes. I'd be more than happy to see WordPress drop BC for PHP 7.2 and 7.3, but it supports them today.
Interesting! Any ideas why that's the case? Also, how many additional megabytes are we talking about overall? If more than 3 or 4 then yes, let's restrict that to Node.js for the purposes of this PR and figure out how to build and load that as a dynamic extension later on.
If there are no unintended side-effects, it should be fine to just always ship them. Ideally with a clarifying comment such as "needed in PHP 7.2 and 7.3 to ...".
Any PR structure that's convenient for you works. BTW, it seems like VMWare Labs got a WASM build of ICU – linking here in case that's any useful: |
I just found this dependency table for php extensions, might be useful here and for other extensions: https://static-php.dev/en/guide/deps-map.html |
@adamziel Sorry I forgot to answer your question
The
While
Compiling PHP 8.4 Web JSPI returned the following results: Working: 18,576,604 bytes But I found out there is a section in ICU documentation dedicated to making ICU smaller. I’m not exactly sure what should or shouldn’t be enabled right now, but there’s definitely room for optimization. I should also mention that the data file named
the resulting file named |
Does the browser need to download it? Or is it just needed to build/link PHP? |
The browser needs to download the ![]() |
is the icu file binary, or it benefits from gzip compression over wire? |
It is a binary file. Emscripten preloads the ICU data file and packages it into |
I managed to make version I made those dirty replacements as a work in progress but the real operations will be inserted in the different
Version But, even if this hasn't been said in this topic, I think versions However, since intl is running on
Edit : I struggle building Edit 2 : Nailed it. |
Yes, it's just 7.2+ |
Motivation for the change, related issues
Hello, i'm one of the people working on playground implementation for TYPO3. We needed to have PHP with intl available to even start the system. This should be all the code and files responsible for compilation of php with intl.
It is not 100% working, there are issues for example some functions were missing or recompile:php:node:* tasks were failing. But at least php thinks it has intl and maybe you will be able to somehow make use of it in wordpress-playground.
gettext inclusion in the files is only for convenience sake because downloading this package each time was quite lengthy process (maybe this was temporary problem)
Implementation details
Testing Instructions (or ideally a Blueprint)