Skip to content

[ php-wasm ] add intl extension #2187

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

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 21 additions & 2 deletions packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,26 @@ libcurl/jspi/dist/root/lib/lib/libcurl.a: base-image libz libopenssl
docker cp $$(docker create playground-php-wasm:libcurl):/root/curl-7.69.1/lib/.libs ./libcurl/jspi/dist/root/lib/lib
docker cp $$(docker create playground-php-wasm:libcurl):/root/curl-7.69.1/include/ ./libcurl/jspi/dist/root/lib

libintl_asyncify: libintl/asyncify/dist/root/lib/lib/libintl.a
libintl/asyncify/dist/root/lib/lib/libintl.a: base-image
mkdir -p ./libintl/asyncify/dist/root/lib
docker build -f ./libintl/Dockerfile -t playground-php-wasm:libintl . --progress=plain
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/lib ./libintl/asyncify/dist/root/lib
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/include ./libintl/asyncify/dist/root/lib
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/data/. ./libintl/


libintl_jspi: libintl/jspi/dist/root/lib/lib/libintl.a
libintl/jspi/dist/root/lib/lib/libintl.a: base-image
mkdir -p ./libintl/jspi/dist/root/lib
docker build -f ./libintl/Dockerfile -t playground-php-wasm:libintl . --progress=plain --build-arg JSPI=1
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/lib ./libintl/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/include ./libintl/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libintl):/root/lib/data/. ./libintl/

all: all_jspi all_asyncify
all_jspi: libz_jspi libzip_jspi libpng16_jspi libjpeg_jspi libwebp_jspi libxml2_jspi libopenssl_jspi libsqlite3_jspi libiconv_jspi bison2.7 oniguruma_jspi libcurl_jspi
all_asyncify: libz_asyncify libzip_asyncify libpng16_asyncify libjpeg_asyncify libwebp_asyncify libxml2_asyncify libopenssl_asyncify libsqlite3_asyncify libiconv_asyncify bison2.7 oniguruma_asyncify libcurl_asyncify
all_jspi: libz_jspi libzip_jspi libpng16_jspi libjpeg_jspi libwebp_jspi libxml2_jspi libopenssl_jspi libsqlite3_jspi libiconv_jspi bison2.7 oniguruma_jspi libcurl_jspi libintl_jspi
all_asyncify: libz_asyncify libzip_asyncify libpng16_asyncify libjpeg_asyncify libwebp_asyncify libxml2_asyncify libopenssl_asyncify libsqlite3_asyncify libiconv_asyncify bison2.7 oniguruma_asyncify libcurl_asyncify libintl_asyncify

clean:
rm -rf ./libz/jspi/dist
Expand All @@ -261,3 +278,5 @@ clean:
rm -rf ./bison2.7/dist
rm -rf ./oniguruma/jspi/dist
rm -rf ./oniguruma/asyncify/dist
rm -rf ./libintl/jspi/dist
rm -rf ./libintl/asyncify/dist
8 changes: 8 additions & 0 deletions packages/php-wasm/compile/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ const argParser = yargs(process.argv.slice(2))
choices: ['yes', 'no'],
description: 'Build with mbregex support',
},
WITH_INTL: {
type: 'string',
choices: ['yes', 'no'],
description: 'Build with intl support',
},
WITH_CLI_SAPI: {
type: 'string',
choices: ['yes', 'no'],
Expand Down Expand Up @@ -139,6 +144,7 @@ const platformDefaults = {
WITH_GD: 'yes',
WITH_MBSTRING: 'yes',
WITH_MBREGEX: 'yes',
WITH_INTL: 'yes',
WITH_OPENSSL: 'yes',
WITH_WS_NETWORKING_PROXY: 'yes',
},
Expand Down Expand Up @@ -205,6 +211,8 @@ await asyncSpawn(
'--build-arg',
getArg('WITH_MBREGEX'),
'--build-arg',
getArg('WITH_INTL'),
'--build-arg',
getArg('WITH_CLI_SAPI'),
'--build-arg',
getArg('WITH_OPENSSL'),
Expand Down
50 changes: 50 additions & 0 deletions packages/php-wasm/compile/libintl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM playground-php-wasm:base


ARG JSPI


RUN set -euxo pipefail && \
wget https://github.com/unicode-org/icu/releases/download/release-74-2/icu4c-74_2-src.tgz && \
tar -xvf icu4c-74_2-src.tgz && \
rm -rf /root/icu/source/data/ && \
rm icu4c-74_2-src.tgz


RUN set -euxo pipefail && \
wget https://github.com/unicode-org/icu/releases/download/release-74-2/icu4c-74_2-data.zip && \
unzip icu4c-74_2-data.zip -d /root/icu/source && \
rm icu4c-74_2-data.zip


RUN set -euxo pipefail && \
mkdir -p /root/native && \
cd /root/native && \
/root/icu/source/runConfigureICU Linux \
--disable-shared \
--enable-static && \
make -j"$(nproc)" && \
make install


RUN set -euxo pipefail && \
cd /root/icu/source && \
mkdir -p /root/lib && \
source /root/emsdk/emsdk_env.sh && \
emconfigure ./configure \
--build=i386-pc-linux-gnu \
--target=wasm32-unknown-emscripten \
--prefix=/root/lib \
--with-cross-build=/root/native \
--with-data-packaging=archive \
--disable-extras \
--disable-shared \
--enable-static && \
export JSPI_FLAGS=$(if [ "$JSPI" = "1" ]; then echo "-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"; else echo ""; fi) && \
EMCC_FLAGS=" -sSIDE_MODULE -Wl,--wrap=select $JSPI_FLAGS " emmake make -j"$(nproc)" && \
EMCC_FLAGS=" -sSIDE_MODULE -Wl,--wrap=select $JSPI_FLAGS " emmake make install -i;


RUN set -euxo pipefail && \
mkdir -p /root/lib/data && \
mv /root/lib/share/icu/74.2/icudt74l.dat /root/lib/data
Loading
Loading