Skip to content
Merged
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
1,988 changes: 994 additions & 994 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions packages/docs/site/docs/developers/03-build-an-app/01-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ Loading a `.zip` file is another alternative for previewing your project. See th

To use Playground as a PR previewer, you need:

- A CI pipeline that bundles your plugin or theme
- Public access to the generated `.zip` file
- A CI pipeline that bundles your plugin or theme
- Public access to the generated `.zip` file

Those zip bundles aren't any different from regular WordPress Plugins, which means you can install them in Playground using the [JSON Blueprints](/blueprints) API. Once you expose an endpoint like https://your-site.com/pull-request-1234.zip, the following Blueprint will do the rest:

Expand Down Expand Up @@ -187,9 +187,9 @@ blueprint={{

You can preview specific pull requests from WordPress Core and Gutenberg repositories using Query API parameters. Gutenberg branches also have an alternative to preview them with the parameter `gutenberg-branch`. This is useful for testing the latest trunk changes or specific feature branches without creating a PR.

- Preview a specific WordPress Core PR: `https://playground.wordpress.net/?core-pr=9500`
- Preview a specific Gutenberg PR: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Preview the Gutenberg trunk branch: `https://playground.wordpress.net/?gutenberg-branch=trunk`
- Preview a specific WordPress Core PR: `https://playground.wordpress.net/?core-pr=9500`
- Preview a specific Gutenberg PR: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Preview the Gutenberg trunk branch: `https://playground.wordpress.net/?gutenberg-branch=trunk`

## Build a compatibility testing environment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ Para usar Playground como un previsualizador de PR, necesitas:
- Public access to the generated `.zip` file
-->

- Un pipeline de CI que empaquete tu plugin o tema
- Acceso público al archivo `.zip` generado
- Un pipeline de CI que empaquete tu plugin o tema
- Acceso público al archivo `.zip` generado

<!--
Those zip bundles aren't any different from regular WordPress Plugins, which means you can install them in Playground using the [JSON Blueprints](/blueprints) API. Once you expose an endpoint like https://your-site.com/pull-request-1234.zip, the following Blueprint will do the rest:
Expand Down Expand Up @@ -287,9 +287,9 @@ Puedes previsualizar pull requests específicos de los repositorios de WordPress
- Preview the Gutenberg trunk branch: `https://playground.wordpress.net/?gutenberg-branch=trunk`
-->

- Previsualizar un PR específico de WordPress Core: `https://playground.wordpress.net/?core-pr=9500`
- Previsualizar un PR específico de Gutenberg: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Previsualizar la rama trunk de Gutenberg: `https://playground.wordpress.net/?gutenberg-branch=trunk`
- Previsualizar un PR específico de WordPress Core: `https://playground.wordpress.net/?core-pr=9500`
- Previsualizar un PR específico de Gutenberg: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Previsualizar la rama trunk de Gutenberg: `https://playground.wordpress.net/?gutenberg-branch=trunk`

<!--
## Build a compatibility testing environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ Pour utiliser Playground comme visualiseur de PR, vous avez besoin :
- Public access to the generated `.zip` file
-->

- D'un pipeline CI qui empaquette votre plugin ou thème
- D'un accès public au fichier `.zip` généré
- D'un pipeline CI qui empaquette votre plugin ou thème
- D'un accès public au fichier `.zip` généré

<!--
Those zip bundles aren't any different from regular WordPress Plugins, which means you can install them in Playground using the [JSON Blueprints](/blueprints) API. Once you expose an endpoint like https://your-site.com/pull-request-1234.zip, the following Blueprint will do the rest:
Expand Down Expand Up @@ -287,9 +287,9 @@ Vous pouvez prévisualiser des pull requests spécifiques des dépôts WordPress
- Preview the Gutenberg trunk branch: `https://playground.wordpress.net/?gutenberg-branch=trunk`
-->

- Prévisualiser un PR WordPress Core spécifique : `https://playground.wordpress.net/?core-pr=9500`
- Prévisualiser un PR Gutenberg spécifique : `https://playground.wordpress.net/?gutenberg-pr=73010`
- Prévisualiser la branche trunk de Gutenberg : `https://playground.wordpress.net/?gutenberg-branch=trunk`
- Prévisualiser un PR WordPress Core spécifique : `https://playground.wordpress.net/?core-pr=9500`
- Prévisualiser un PR Gutenberg spécifique : `https://playground.wordpress.net/?gutenberg-pr=73010`
- Prévisualiser la branche trunk de Gutenberg : `https://playground.wordpress.net/?gutenberg-branch=trunk`

<!--
## Build a compatibility testing environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ Para usar o Playground como um visualizador de PR, você precisa:
<!-- - A CI pipeline that bundles your plugin or theme -->
<!-- - Public access to the generated `.zip` file -->

- Um pipeline de CI que empacote seu plugin ou tema
- Acesso público ao arquivo `.zip` gerado
- Um pipeline de CI que empacote seu plugin ou tema
- Acesso público ao arquivo `.zip` gerado

<!-- Those zip bundles aren't any different from regular WordPress Plugins, which means you can install them in Playground using the [JSON Blueprints](/blueprints) API. Once you expose an endpoint like https://your-site.com/pull-request-1234.zip, the following Blueprint will do the rest: -->

Expand Down Expand Up @@ -239,9 +239,9 @@ Você pode visualizar pull requests específicos dos repositórios WordPress Cor
<!-- - Preview a specific Gutenberg PR: `https://playground.wordpress.net/?gutenberg-pr=73010` -->
<!-- - Preview the Gutenberg trunk branch: `https://playground.wordpress.net/?gutenberg-branch=trunk` -->

- Visualizar um PR específico do WordPress Core: `https://playground.wordpress.net/?core-pr=9500`
- Visualizar um PR específico do Gutenberg: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Visualizar o branch trunk do Gutenberg: `https://playground.wordpress.net/?gutenberg-branch=trunk`
- Visualizar um PR específico do WordPress Core: `https://playground.wordpress.net/?core-pr=9500`
- Visualizar um PR específico do Gutenberg: `https://playground.wordpress.net/?gutenberg-pr=73010`
- Visualizar o branch trunk do Gutenberg: `https://playground.wordpress.net/?gutenberg-branch=trunk`

<!-- ## Build a compatibility testing environment -->

Expand Down
20 changes: 18 additions & 2 deletions packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,22 @@ libavif/jspi/dist/root/lib/lib/libavif.a: base-image
docker cp $$(docker create playground-php-wasm:libavif):/root/lib/lib ./libavif/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libavif):/root/lib/include ./libavif/jspi/dist/root/lib

libgd_asyncify: libgd/asyncify/dist/root/lib/lib/libgd.a
libgd/asyncify/dist/root/lib/lib/libgd.a: base-image libz_asyncify libpng16_asyncify libjpeg_asyncify libwebp_asyncify libavif_asyncify
mkdir -p ./libgd/asyncify/dist/root/lib
docker build -f ./libgd/Dockerfile -t playground-php-wasm:libgd .
docker cp $$(docker create playground-php-wasm:libgd):/root/install/lib ./libgd/asyncify/dist/root/lib
docker cp $$(docker create playground-php-wasm:libgd):/root/install/include ./libgd/asyncify/dist/root/lib
docker cp $$(docker create playground-php-wasm:libgd):/root/install/bin ./libgd/asyncify/dist/root/lib

libgd_jspi: libgd/jspi/dist/root/lib/lib/libgd.a
libgd/jspi/dist/root/lib/lib/libgd.a: base-image libz_jspi libpng16_jspi libjpeg_jspi libwebp_jspi libavif_jspi
mkdir -p ./libgd/jspi/dist/root/lib
docker build -f ./libgd/Dockerfile -t playground-php-wasm:libgd . --build-arg JSPI=1
docker cp $$(docker create playground-php-wasm:libgd):/root/install/lib ./libgd/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libgd):/root/install/include ./libgd/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libgd):/root/install/bin ./libgd/jspi/dist/root/lib

libxml2_asyncify: libxml2/asyncify/dist/root/lib/lib/libxml2.a
libxml2/asyncify/dist/root/lib/lib/libxml2.a: base-image libz_asyncify
mkdir -p ./libxml2/asyncify/dist/root/lib
Expand Down Expand Up @@ -317,8 +333,8 @@ libImageMagick/jspi/dist/root/lib/lib/libMagickCore-7.Q16HDRI.a: base-image libz
docker cp $$(docker create playground-php-wasm:libImageMagick):/root/install/bin ./libImageMagick/jspi/dist/root/lib

all: all_jspi all_asyncify
all_jspi: libz_jspi libzip_jspi libpng16_jspi libjpeg_jspi libwebp_jspi libaom_jspi libavif_jspi libxml2_jspi libopenssl_jspi libsqlite3_jspi libiconv_jspi bison2.7 oniguruma_jspi libcurl_jspi libintl_jspi libImageMagick_jspi
all_asyncify: libz_asyncify libzip_asyncify libpng16_asyncify libjpeg_asyncify libwebp_asyncify libaom_asyncify libavif_asyncify libxml2_asyncify libopenssl_asyncify libsqlite3_asyncify libiconv_asyncify bison2.7 oniguruma_asyncify libcurl_asyncify libintl_asyncify libImageMagick_asyncify
all_jspi: libz_jspi libzip_jspi libpng16_jspi libjpeg_jspi libwebp_jspi libaom_jspi libavif_jspi libgd_jspi libxml2_jspi libopenssl_jspi libsqlite3_jspi libiconv_jspi bison2.7 oniguruma_jspi libcurl_jspi libintl_jspi libImageMagick_jspi
all_asyncify: libz_asyncify libzip_asyncify libpng16_asyncify libjpeg_asyncify libwebp_asyncify libaom_asyncify libavif_asyncify libgd_asyncify libxml2_asyncify libopenssl_asyncify libsqlite3_asyncify libiconv_asyncify bison2.7 oniguruma_asyncify libcurl_asyncify libintl_asyncify libImageMagick_asyncify

clean:
rm -rf ./libz/jspi/dist
Expand Down
Binary file not shown.
Binary file not shown.
144 changes: 144 additions & 0 deletions packages/php-wasm/compile/libgd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
FROM playground-php-wasm:base

ARG JSPI
ARG GD_VERSION="2.3.3"

RUN mkdir -p /root/lib/include /root/lib/lib
COPY ./libz/ /root/libz
COPY ./libpng16/ /root/libpng16
COPY ./libjpeg/ /root/libjpeg
COPY ./libwebp/ /root/libwebp
COPY ./libavif/ /root/libavif
COPY ./libgd/libavifConfig.cmake /tmp/libavifConfig.cmake
COPY ./libgd/libavifConfigVersion.cmake /tmp/libavifConfigVersion.cmake

RUN if [ "$JSPI" = "1" ]; then \
cp -r /root/libz/jspi/dist/root/lib/* /root/lib; \
cp -r /root/libpng16/jspi/dist/root/lib/* /root/lib; \
cp -r /root/libjpeg/jspi/dist/root/lib/* /root/lib; \
cp -r /root/libwebp/jspi/dist/root/lib/* /root/lib; \
cp -r /root/libavif/jspi/dist/root/lib/* /root/lib; \
else \
cp -r /root/libz/asyncify/dist/root/lib/* /root/lib; \
cp -r /root/libpng16/asyncify/dist/root/lib/* /root/lib; \
cp -r /root/libjpeg/asyncify/dist/root/lib/* /root/lib; \
cp -r /root/libwebp/asyncify/dist/root/lib/* /root/lib; \
cp -r /root/libavif/asyncify/dist/root/lib/* /root/lib; \
fi
RUN mkdir -p /root/lib/lib/cmake/libavif && \
cp /tmp/libavifConfig.cmake /root/lib/lib/cmake/libavif/libavifConfig.cmake && \
cp /tmp/libavifConfigVersion.cmake /root/lib/lib/cmake/libavif/libavifConfigVersion.cmake

RUN wget https://github.com/libgd/libgd/releases/download/gd-$GD_VERSION/libgd-$GD_VERSION.tar.gz -O libgd.tar.gz
RUN tar -xzf libgd.tar.gz
WORKDIR /root/libgd-$GD_VERSION

# Patch gd_security.c to make overflow2 static (avoids duplicate symbol with PHP's gd_compat.o)
RUN sed -i 's/^int overflow2/static int overflow2/' /root/libgd-$GD_VERSION/src/gd_security.c

# Patch gdkanji.c to make iconv stubs static (avoids duplicate symbol with emscripten libc)
# Need to update both forward declarations and definitions
RUN sed -i 's/^iconv_t iconv_open (const char/static iconv_t iconv_open (const char/' /root/libgd-$GD_VERSION/src/gdkanji.c && \
sed -i 's/^size_t iconv (iconv_t/static size_t iconv (iconv_t/' /root/libgd-$GD_VERSION/src/gdkanji.c && \
sed -i 's/^int iconv_close (iconv_t/static int iconv_close (iconv_t/' /root/libgd-$GD_VERSION/src/gdkanji.c && \
sed -i 's/^iconv_open (/static iconv_open (/' /root/libgd-$GD_VERSION/src/gdkanji.c && \
sed -i 's/^iconv (/static iconv (/' /root/libgd-$GD_VERSION/src/gdkanji.c && \
sed -i 's/^iconv_close (/static iconv_close (/' /root/libgd-$GD_VERSION/src/gdkanji.c

# Add stub implementations for FreeType functions when FreeType is disabled
# These are needed because PHP's GD extension expects them
RUN echo '' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo '/* Stub implementations for when FreeType is disabled */' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo '#ifndef HAVE_LIBFREETYPE' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo '#include "gd.h"' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo 'BGD_DECLARE(void) gdFontCacheShutdown(void) {}' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo 'BGD_DECLARE(void) gdFreeFontCache(void) {}' >> /root/libgd-$GD_VERSION/src/gd.c && \
echo '#endif' >> /root/libgd-$GD_VERSION/src/gd.c

RUN set -euxo pipefail; \
source /root/emsdk/emsdk_env.sh; \
export PKG_CONFIG_PATH=/root/lib/lib/pkgconfig:$PKG_CONFIG_PATH; \
emcmake cmake -G"Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/root/install \
-DCMAKE_PREFIX_PATH=/root/lib \
-DZLIB_LIBRARY=/root/lib/lib/libz.a \
-DZLIB_INCLUDE_DIR=/root/lib/include \
-DPNG_LIBRARY=/root/lib/lib/libpng16.a \
-DPNG_PNG_INCLUDE_DIR=/root/lib/include \
-DJPEG_LIBRARY=/root/lib/lib/libjpeg.a \
-DJPEG_INCLUDE_DIR=/root/lib/include \
-DWEBP_LIBRARY=/root/lib/lib/libwebp.a \
-DWEBP_LIBRARIES="/root/lib/lib/libwebp.a;/root/lib/lib/libsharpyuv.a" \
-DWEBP_INCLUDE_DIR=/root/lib/include \
-DAVIF_LIBRARY=/root/lib/lib/libavif.a \
-DAVIF_INCLUDE_DIR=/root/lib/include \
-Dlibavif_DIR=/root/lib/lib/cmake/libavif \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TEST=OFF \
-DBUILD_PROGRAMS=OFF \
-DENABLE_CPP=OFF \
-DENABLE_GD_FORMATS=ON \
-DENABLE_PNG=ON \
-DENABLE_JPEG=ON \
-DENABLE_WEBP=ON \
-DENABLE_AVIF=ON \
-DENABLE_LIQ=OFF \
-DENABLE_TIFF=OFF \
-DENABLE_ICONV=OFF \
-DENABLE_XPM=OFF \
-DENABLE_FREETYPE=OFF \
-DENABLE_FONTCONFIG=OFF \
-DENABLE_HEIF=OFF \
-DENABLE_RAQM=OFF

# Build as side module, skipping all dependency libraries (they'll be linked with PHP later)
RUN source /root/emsdk/emsdk_env.sh && \
export JSPI_FLAGS=$(if [ "$JSPI" = "1" ]; then echo "-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"; else echo ""; fi) && \
EMCC_SKIP="-lc -lz -lpng -lpng16 -ljpeg -lwebp -lavif -liconv" \
EMCC_FLAGS=" -D__x86_64__ -sSIDE_MODULE $JSPI_FLAGS" \
emmake make gd_static -j"$(nproc)"

# Manually stage the static lib and headers (skip installing programs)
RUN set -euxo pipefail && \
mkdir -p /root/install/lib /root/install/include /root/install/lib/pkgconfig /root/install/bin && \
LIBFILE=$(find /root/libgd-2.3.3 -maxdepth 4 -name "libgd*.a" | head -n1) && \
if [ -z "$LIBFILE" ]; then echo "libgd static archive not found"; exit 1; fi && \
cp "$LIBFILE" /root/install/lib/libgd.a && \
(cp /root/libgd-2.3.3/src/gd_config.h /root/install/include/ || true) && \
(cp /root/libgd-2.3.3/gd_config.h /root/install/include/ || true) && \
cp /root/libgd-2.3.3/src/*.h /root/install/include/ && \
(cp /root/libgd-2.3.3/gd.h /root/install/include/ || true) && \
(cp /root/libgd-2.3.3/gd_errors.h /root/install/include/ || true)

RUN cat > /root/install/lib/pkgconfig/gdlib.pc <<'EOF'
prefix=/root/lib
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: gdlib
Description: GD graphics library
Version: 2.3.3
Requires.private: libpng libjpeg libwebp libavif zlib
Libs: -L${libdir} -lgd -lpng16 -lz -ljpeg -lwebp -lsharpyuv -lavif
Cflags: -I${includedir}
EOF

RUN cat > /root/install/bin/gdlib-config <<'EOF'
#!/bin/sh
case "$1" in
--version) echo 2.3.3 ;;
--features) echo "PNG JPEG WEBP AVIF GIF XBM WBMP FREETYPE" ;;
--libs) echo "-L/root/lib/lib -lgd -lpng16 -lz -ljpeg -lwebp -lsharpyuv -lavif" ;;
--cflags|--includes) echo "-I/root/lib/include" ;;
--libdir) echo "/root/lib/lib" ;;
--includedir) echo "/root/lib/include" ;;
*) echo "--version --features --libs --cflags --includedir --libdir" ;;
esac
EOF

RUN chmod +x /root/install/bin/gdlib-config

RUN rm -rf /root/libgd-$GD_VERSION libgd.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
case "$1" in
--version) echo 2.3.3 ;;
--features) echo "PNG JPEG WEBP AVIF GIF XBM WBMP FREETYPE" ;;
--libs) echo "-L/root/lib/lib -lgd -lpng16 -lz -ljpeg -lwebp -lsharpyuv -lavif" ;;
--cflags|--includes) echo "-I/root/lib/include" ;;
--libdir) echo "/root/lib/lib" ;;
--includedir) echo "/root/lib/include" ;;
*) echo "--version --features --libs --cflags --includedir --libdir" ;;
esac
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
111 changes: 111 additions & 0 deletions packages/php-wasm/compile/libgd/asyncify/dist/root/lib/include/bmp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#ifndef BMP_H
#define BMP_H 1

#ifdef __cplusplus
extern "C" {
#endif

/*
gd_bmp.c

Bitmap format support for libgd

* Written 2007, Scott MacVicar
---------------------------------------------------------------------------

Todo:

RLE4, RLE8 and Bitfield encoding
Add full support for Windows v4 and Windows v5 header formats

----------------------------------------------------------------------------
*/

#define BMP_PALETTE_3 1
#define BMP_PALETTE_4 2

#define BMP_WINDOWS_V3 40
#define BMP_OS2_V1 12
#define BMP_OS2_V2 64
#define BMP_WINDOWS_V4 108
#define BMP_WINDOWS_V5 124

#define BMP_BI_RGB 0
#define BMP_BI_RLE8 1
#define BMP_BI_RLE4 2
#define BMP_BI_BITFIELDS 3
#define BMP_BI_JPEG 4
#define BMP_BI_PNG 5

#define BMP_RLE_COMMAND 0
#define BMP_RLE_ENDOFLINE 0
#define BMP_RLE_ENDOFBITMAP 1
#define BMP_RLE_DELTA 2

#define BMP_RLE_TYPE_RAW 0
#define BMP_RLE_TYPE_RLE 1

/* BMP header. */
typedef struct {
/* 16 bit - header identifying the type */
signed short int magic;

/* 32bit - size of the file */
int size;

/* 16bit - these two are in the spec but "reserved" */
signed short int reserved1;
signed short int reserved2;

/* 32 bit - offset of the bitmap header from data in bytes */
signed int off;

} bmp_hdr_t;

/* BMP info. */
typedef struct {
/* 16bit - Type, ie Windows or OS/2 for the palette info */
signed short int type;
/* 32bit - The length of the bitmap information header in bytes. */
signed int len;

/* 32bit - The width of the bitmap in pixels. */
signed int width;

/* 32bit - The height of the bitmap in pixels. */
signed int height;

/* 8 bit - The bitmap data is specified in top-down order. */
signed char topdown;

/* 16 bit - The number of planes. This must be set to a value of one. */
signed short int numplanes;

/* 16 bit - The number of bits per pixel. */
signed short int depth;

/* 32bit - The type of compression used. */
signed int enctype;

/* 32bit - The size of the image in bytes. */
signed int size;

/* 32bit - The horizontal resolution in pixels/metre. */
signed int hres;

/* 32bit - The vertical resolution in pixels/metre. */
signed int vres;

/* 32bit - The number of color indices used by the bitmap. */
signed int numcolors;

/* 32bit - The number of color indices important for displaying the bitmap. */
signed int mincolors;

} bmp_info_t;

#ifdef __cplusplus
}
#endif

#endif
Loading