Skip to content
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

Explore curl support #1133

Closed
wants to merge 15 commits into from
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"array": "c",
"string": "c",
"string_view": "c",
"vector": "c"
"vector": "c",
"php_cli_process_title_arginfo.h": "c",
"php_cli_process_title.h": "c"
},
"autoImportFileExcludePatterns": [
"@wp-playground/client"
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"file-saver": "^2.0.5",
"follow-redirects": "1.15.2",
"fs-extra": "11.1.1",
"node-forge": "1.3.1",
"octokit": "3.1.1",
"octokit-plugin-create-pull-request": "5.1.1",
"react": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ git clone -b trunk --single-branch --depth 1 git@github.com:WordPress/wordpress-
```

Enter the `wordpress-playground` directory.

```sh
cd wordpress-playground
```
Expand Down
13 changes: 0 additions & 13 deletions packages/php-wasm/cli/jest.config.ts

This file was deleted.

9 changes: 8 additions & 1 deletion packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ oniguruma/dist/root/lib/lib/libonig.a: base-image
docker cp $$(docker create playground-php-wasm:oniguruma):/root/lib/lib ./oniguruma/dist/root/lib/
docker cp $$(docker create playground-php-wasm:oniguruma):/root/lib/include ./oniguruma/dist/root/lib

all: libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7 oniguruma
libcurl: libcurl/dist/root/lib/lib/libcurl.a
libcurl/dist/root/lib/lib/libcurl.a: base-image libz libopenssl
mkdir -p ./libcurl/dist/root/lib
docker build -f ./libcurl/Dockerfile -t playground-php-wasm:libcurl . --progress=plain
docker cp $$(docker create playground-php-wasm:libcurl):/root/curl-7.69.1/lib/.libs ./libcurl/dist/root/lib/lib
docker cp $$(docker create playground-php-wasm:libcurl):/root/curl-7.69.1/include/ ./libcurl/dist/root/lib

all: libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7 oniguruma libcurl
clean:
rm -rf ./libz/dist
rm -rf ./libzip/dist
Expand Down
3 changes: 3 additions & 0 deletions packages/php-wasm/compile/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,18 @@ const platformDefaults = {
},
['web-light']: {},
['web-kitchen-sink']: {
WITH_CURL: 'yes',
WITH_FILEINFO: 'yes',
WITH_ICONV: 'yes',
WITH_LIBXML: 'yes',
WITH_LIBPNG: 'yes',
WITH_MBSTRING: 'yes',
WITH_MBREGEX: 'yes',
WITH_OPENSSL: 'yes',
WITH_WS_NETWORKING_PROXY: 'yes',
},
node: {
WITH_CURL: 'yes',
WITH_FILEINFO: 'yes',
WITH_ICONV: 'yes',
WITH_LIBXML: 'yes',
Expand Down
38 changes: 38 additions & 0 deletions packages/php-wasm/compile/libcurl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM playground-php-wasm:base

RUN mkdir -p /root/lib/include /root/lib/lib
COPY ./libz/dist/root/lib/include /root/lib/include
COPY ./libz/dist/root/lib/lib /root/lib/lib
COPY ./libopenssl/dist/root/lib/include /root/lib/include
COPY ./libopenssl/dist/root/lib/lib /root/lib/lib

ARG CURL_VERSION="curl-7.69.1"

RUN /root/copy-lib.sh lib-libz
RUN set -euxo pipefail && \
source /root/emsdk/emsdk_env.sh && \
wget https://curl.haxx.se/download/$CURL_VERSION.tar.gz && \
tar xf $CURL_VERSION.tar.gz

WORKDIR /root/$CURL_VERSION

RUN CPPFLAGS="-I/root/lib/include " \
LDFLAGS="-L/root/lib/lib " \
PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
source /root/emsdk/emsdk_env.sh && \
emconfigure ./configure \
--build i386-pc-linux-gnu \
--target wasm32-unknown-emscripten \
--prefix=/root/install/ \
--disable-shared \
--enable-static \
--with-openssl \
--enable-https \
--enable-http \
--disable-pthreads \
--disable-threaded-resolver \
--with-zlib=/root/lib

RUN source /root/emsdk/emsdk_env.sh && \
EMCC_SKIP="-lc -lz -lcurl" \
EMCC_FLAGS="-sSIDE_MODULE -Wl,--wrap=select " emmake make || true
Loading
Loading