Skip to content

Commit

Permalink
Fixing Build Regression [BISON] (#892)
Browse files Browse the repository at this point in the history
## What is this PR doing?

This PR corrects the same Bison2.7 issue as
#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.
  • Loading branch information
seanmorris authored Dec 26, 2023
1 parent 7c05925 commit 1ef5bf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
@@ -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 .

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion packages/php-wasm/compile/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1ef5bf6

Please sign in to comment.