From 1ef5bf6f8eff673760fbf3529f065488492cbad5 Mon Sep 17 00:00:00 2001 From: Sean Morris <640101+seanmorris@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:41:49 -0500 Subject: [PATCH] Fixing Build Regression [BISON] (#892) ## What is this PR doing? This PR corrects the same Bison2.7 issue as https://github.com/WordPress/wordpress-playground/pull/871, in a much simpler fashion. ## What problem is it solving? Bison2.7 will not be built in some cases, blocking the build of PHP <= 7.3. ## How is the problem addressed? This invokes dependency builds before building PHP. ## Testing Instructions Checkout the branch & install the dependencies: ``` git checkout sm-make-deps-before-compile npm install ``` In a separate terminal, clear the artifacts: ```bash docker system prune -af cd packages/php-wasm/compile make clean ``` Run the build and ensure it succeeds: ```bash npm run recompile:php:node npm run recompile:php:web ``` Start the dev server: ```bash npm run dev ``` Then, navigate to: * http://localhost:5400/website-server/?php=8.3 * http://localhost:5400/website-server/?php=8.2 * http://localhost:5400/website-server/?php=8.1 * http://localhost:5400/website-server/?php=8.0 * http://localhost:5400/website-server/?php=7.4 * http://localhost:5400/website-server/?php=7.3 * http://localhost:5400/website-server/?php=7.2 * http://localhost:5400/website-server/?php=7.1 * http://localhost:5400/website-server/?php=7.0 ... and ensure that wordpress works as-expected in each environment. --- packages/php-wasm/compile/Makefile | 8 ++++++-- packages/php-wasm/compile/build.js | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/php-wasm/compile/Makefile b/packages/php-wasm/compile/Makefile index 63d08d97d2..231158ecac 100644 --- a/packages/php-wasm/compile/Makefile +++ b/packages/php-wasm/compile/Makefile @@ -1,4 +1,7 @@ +.PHONY: all libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7 oniguruma base-image clean + base-image: base-image/.ready + base-image/.ready: cd base-image; docker build -f ./Dockerfile -t playground-php-wasm:base . @@ -28,7 +31,7 @@ libzip/dist/1.9.2/root/lib/lib/libzip.a: base-image libz libpng16: libpng16/dist/root/lib/lib/libpng16.a libpng16/dist/root/lib/lib/libpng16.a: base-image libz mkdir -p ./libpng16/dist/root/lib - docker build -f ./libpng16/Dockerfile -t playground-php-wasm:libpng . + docker build -f ./libpng16/Dockerfile -t playground-php-wasm:libpng . docker cp $$(docker create playground-php-wasm:libpng):/root/install/lib ./libpng16/dist/root/lib docker cp $$(docker create playground-php-wasm:libpng):/root/install/include ./libpng16/dist/root/lib @@ -88,7 +91,8 @@ 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 +all: libz libzip libpng16 libxml2 libopenssl libsqlite3 libiconv libncurses libedit bison2.7 oniguruma base-image + clean: rm -rf ./libz/dist rm -rf ./libzip/dist diff --git a/packages/php-wasm/compile/build.js b/packages/php-wasm/compile/build.js index badafc90e4..3f6dfe638f 100644 --- a/packages/php-wasm/compile/build.js +++ b/packages/php-wasm/compile/build.js @@ -167,7 +167,10 @@ if (!requestedVersion || requestedVersion === 'undefined') { const sourceDir = path.dirname(new URL(import.meta.url).pathname); // Build the base image -await asyncSpawn('make', ['base-image'], { cwd: sourceDir, stdio: 'inherit' }); +await asyncSpawn('make', ['all'], { + cwd: sourceDir, + stdio: 'inherit', +}); await asyncSpawn( 'docker',