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

php 8 4 #73

Merged
merged 16 commits into from
Dec 14, 2024
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
37 changes: 37 additions & 0 deletions .circleci/.env_8.4-dynamic.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env make
PHP_VERSION=8.4

OPTIMIZE=2
BROTLI=0
GZIP=0

WITH_BCMATH=1
WITH_CALENDAR=1
WITH_CTYPE=1
WITH_EXIF=1
WITH_FILTER=1
WITH_TOKENIZER=1

WITH_PHAR=dynamic

WITH_LIBXML=shared
WITH_DOM=dynamic
WITH_XML=dynamic
WITH_SIMPLEXML=dynamic

WITH_LIBZIP=dynamic
WITH_ICONV=dynamic
WITH_SQLITE=dynamic

WITH_GD=dynamic
WITH_ZLIB=dynamic
WITH_LIBPNG=shared
WITH_FREETYPE=shared
WITH_LIBJPEG=shared

WITH_YAML=dynamic
WITH_TIDY=dynamic
WITH_MBSTRING=dynamic
WITH_ONIGURUMA=dynamic
WITH_OPENSSL=dynamic
WITH_INTL=dynamic
37 changes: 37 additions & 0 deletions .circleci/.env_8.4-shared.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env make
PHP_VERSION=8.4

OPTIMIZE=2
BROTLI=0
GZIP=0

WITH_BCMATH=1
WITH_CALENDAR=1
WITH_CTYPE=1
WITH_EXIF=1
WITH_FILTER=1
WITH_TOKENIZER=1

WITH_PHAR=static

WITH_LIBXML=static
WITH_DOM=static
WITH_XML=static
WITH_SIMPLEXML=static

WITH_LIBZIP=shared
WITH_ICONV=shared
WITH_SQLITE=shared

WITH_GD=static
WITH_ZLIB=shared
WITH_LIBPNG=shared
WITH_FREETYPE=shared
WITH_LIBJPEG=shared

WITH_YAML=shared
WITH_TIDY=shared
WITH_MBSTRING=static
WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared
38 changes: 38 additions & 0 deletions .circleci/.env_8.4.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env make
PHP_VERSION=8.4

OPTIMIZE=2
BROTLI=0
GZIP=0

WITH_BCMATH=1
WITH_CALENDAR=1
WITH_CTYPE=1
WITH_EXIF=1
WITH_FILTER=1
WITH_MBSTRING=1
WITH_PHAR=1
WITH_TOKENIZER=1

WITH_LIBXML=1
WITH_DOM=1
WITH_XML=1
WITH_SIMPLEXML=1

WITH_LIBZIP=1
WITH_ICONV=1
WITH_SQLITE=1
WITH_VRZNO=1

WITH_EXIF=1
WITH_GD=1
WITH_ZLIB=1
WITH_LIBPNG=1
WITH_FREETYPE=1
WITH_LIBJPEG=1

WITH_YAML=1
WITH_TIDY=1
WITH_ONIGURUMA=1
WITH_OPENSSL=1
WITH_INTL=1
33 changes: 33 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
name: Test
on: [push]
jobs:
test-8-4-static:
name: Test 8.4 Static
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: npm install
- run: sudo apt update && sudo apt install docker-compose -y
- run: cp .circleci/.env_8.4.ci .env
- run: make image test

test-8-3-static:
name: Test 8.3 Static
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,6 +57,17 @@ jobs:
- run: make image test PHP_VERSION=8.0


test-8-4-dynamic:
name: Test 8.4 Dynamic
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: npm install
- run: sudo apt update && sudo apt install docker-compose -y
- run: cp .circleci/.env_8.4-dynamic.ci .env
- run: make image test

test-dynamic:
name: Test 8.3 Dynamic
runs-on: ubuntu-latest
Expand Down Expand Up @@ -91,6 +113,17 @@ jobs:
- run: make image test PHP_VERSION=8.0


test-8-4-shared:
name: Test 8.4 Shared
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: npm install
- run: sudo apt update && sudo apt install docker-compose -y
- run: cp .circleci/.env_8.4-shared.ci .env
- run: make image test

test-shared:
name: Test 8.3 Shared
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Changes
* Modules are now webpack-compatible out of the box.
* Exposing FS methods w/queueing & locking to sync files between tabs & workers.
* Fixed the bug with POST requests under Firefox.
* Adding support for PHP 8.3.7
* Automatic CI testing for PHP 8.0, 8.1, 8.2 & 8.3.
* Adding support for PHP 8.3.7 & 8.4.1.
* Automatic CI testing for PHP 8.0, 8.1, 8.2, 8.3, & 8.4.

## v0.0.8 - Preparing for Lift-off

Expand Down
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ $(error BROTLI MUST BE 0, 1. PLEASE CHECK YOUR SETTINGS FILE: $(abspath ${ENV_FI
endif

## PHP Version
PHP_VERSION?=8.3
PHP_VERSION?=${PHP_VERSION_DEFAULT}

ifeq ($(filter ${PHP_VERSION},8.3 8.2 8.1 8.0),)
$(error PHP_VERSION MUST BE 8.3, 8.2, 8.1 or 8.0. PLEASE CHECK YOUR SETTINGS FILE: $(abspath ${ENV_FILE}))
ifeq ($(filter ${PHP_VERSION},8.4 8.3 8.2 8.1 8.0),)
$(error PHP_VERSION MUST BE 8.4, 8.3, 8.2, 8.1 or 8.0. PLEASE CHECK YOUR SETTINGS FILE: $(abspath ${ENV_FILE}))
endif

## More Options
Expand Down Expand Up @@ -178,8 +178,14 @@ PRE_JS_FILES+= ${EXTRA_PRE_JS_FILES}

TEST_LIST=

ifeq (${PHP_VERSION},8.4)
PHP_VERSION_FULL=8.4.1
PHP_BRANCH=php-${PHP_VERSION_FULL}
PHP_AR=libphp
endif

ifeq (${PHP_VERSION},8.3)
PHP_VERSION_FULL=8.3.7
PHP_VERSION_FULL=8.3.11
PHP_BRANCH=php-${PHP_VERSION_FULL}
PHP_AR=libphp
endif
Expand Down Expand Up @@ -431,12 +437,12 @@ DEPENDENCIES+= third_party/php${PHP_VERSION}-src/configured ${PHP_CONFIGURE_DEPS

EXTENSIONS_JS=Object.fromEntries(Object.entries({"WITH_BCMATH":"${WITH_BCMATH}","WITH_CALENDAR":"${WITH_CALENDAR}","WITH_CTYPE":"${WITH_CTYPE}","WITH_FILTER":"${WITH_FILTER}","WITH_TOKENIZER":"${WITH_TOKENIZER}","WITH_VRZNO":"${WITH_VRZNO}","WITH_EXIF":"${WITH_EXIF}","WITH_PHAR":"${WITH_PHAR}","WITH_LIBXML":"${WITH_LIBXML}","WITH_DOM":"${WITH_DOM}","WITH_XML":"${WITH_XML}","WITH_SIMPLEXML":"${WITH_SIMPLEXML}","WITH_LIBZIP":"${WITH_LIBZIP}","WITH_ICONV":"${WITH_ICONV}","WITH_SQLITE":"${WITH_SQLITE}","WITH_GD":"${WITH_GD}","WITH_ZLIB":"${WITH_ZLIB}","WITH_LIBPNG":"${WITH_LIBPNG}","WITH_FREETYPE":"${WITH_FREETYPE}","WITH_LIBJPEG":"${WITH_LIBJPEG}","WITH_YAML":"${WITH_YAML}","WITH_TIDY":"${WITH_TIDY}","WITH_MBSTRING":"${WITH_MBSTRING}","WITH_ONIGURUMA":"${WITH_ONIGURUMA}","WITH_OPENSSL":"${WITH_OPENSSL}","WITH_INTL":"${WITH_INTL}"}).filter(([k,v]) => v !== "0"))

${PHP_DIST_DIR}/config.mjs:
${PHP_DIST_DIR}/config.mjs: .env
echo '' > $@
echo 'export const phpVersion = "${PHP_VERSION}";' >> $@
echo 'export const phpVersionFull = "${PHP_VERSION_FULL}";' >> $@

${PHP_DIST_DIR}/config.js:
${PHP_DIST_DIR}/config.js: .env
echo 'module.exports = {};' > $@
echo 'module.exports.phpVersion = "${PHP_VERSION}";' >> $@
echo 'module.exports.phpVersionFull = "${PHP_VERSION_FULL}";' >> $@
Expand Down Expand Up @@ -704,6 +710,10 @@ third_party/php${PHP_VERSION}-src/scripts/phpize-built: ${DEPENDENCIES} | ${ORDE
${DOCKER_RUN_IN_PHP} chmod +x scripts/phpize
${DOCKER_RUN_IN_PHP} touch scripts/phpize-built

patch/php8.4.patch:
bash -c 'cd third_party/php8.4-src/ && git diff > ../../patch/php8.4.patch'
perl -pi -w -e 's|([ab])/|\1/third_party/php8.4-src/|g' ./patch/php8.4.patch

patch/php8.3.patch:
bash -c 'cd third_party/php8.3-src/ && git diff > ../../patch/php8.3.patch'
perl -pi -w -e 's|([ab])/|\1/third_party/php8.3-src/|g' ./patch/php8.3.patch
Expand Down Expand Up @@ -825,3 +835,7 @@ all-versions:
${MAKE} PHP_VERSION=8.1 all cgi-all
${MAKE} PHP_VERSION=8.2 all cgi-all
${MAKE} PHP_VERSION=8.3 all cgi-all
${MAKE} PHP_VERSION=8.4 all cgi-all

remap:
${DOCKER_RUN} ./remap-sourcemap.sh packages/php-wasm/php-node.mjs.wasm.map
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ _PHP in WebAssembly, npm not required._
* Modules are now webpack-compatible out of the box.
* Exposing FS methods w/queueing & locking to sync files between tabs & workers.
* Fixed the bug with POST requests under Firefox.
* Adding support for PHP 8.3.7
* Automatic CI testing for PHP 8.0, 8.1, 8.2 & 8.3.
* Adding support for PHP 8.3.7 & 8.4.1.
* Automatic CI testing for PHP 8.0, 8.1, 8.2, 8.3, & 8.4.

[changelog](https://raw.githubusercontent.com/seanmorris/php-wasm/master/CHANGELOG.md)

Expand Down
3 changes: 3 additions & 0 deletions demo-web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

public/mapped
public/static/media/mapped
13 changes: 13 additions & 0 deletions demo-web/npm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ if [ -d 'public/static/media/mapped' ]; then {
}
fi


PHP_VERSION=8.3

ls node_modules/*/*.so node_modules/php-wasm-intl/icudt72l.dat | while read FILE; do {
BASENAME=`basename ${FILE}`;
if [[ ${BASENAME} == php8.* ]]; then
if [[ ${BASENAME} != php${PHP_VERSION}* ]]; then
continue;
fi;
fi;
cp ${FILE} public/;
}; done;

rm -f build/*.wasm;
rm -f build/*.data;
rm -f build/*.map;
Expand Down
34 changes: 24 additions & 10 deletions demo-web/npm-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,37 @@

set -eux;

mkdir -p public/static/media

if [ -d 'public/static/media/mapped' ]; then {
rm public/static/media/*.map || true
rm -rf public/static/media/mapped
}
fi

if [ -d '../packages/php-wasm/mapped' ]; then {
cp -r ../packages/php-wasm/mapped public/static/media
cp ../packages/php-wasm/*.map public/static/media
}
fi
PHP_VERSION=8.3

if [ -d '../packages/php-cgi-wasm/mapped' ]; then {
cp -r ../packages/php-cgi-wasm/mapped public/
cp ../packages/php-cgi-wasm/*.map public/
}
fi
ls node_modules/*/*.so node_modules/php-wasm-intl/icudt72l.dat | while read FILE; do {
BASENAME=`basename ${FILE}`;
if [[ ${BASENAME} == php8.* ]]; then
if [[ ${BASENAME} != php${PHP_VERSION}* ]]; then
continue;
fi;
fi;
cp ${FILE} public/;
}; done;

# if [ -d '../packages/php-wasm/mapped' ]; then {
# cp -r ../packages/php-wasm/mapped public/static/media
# cp ../packages/php-wasm/*.map public/static/media
# }
# fi

# if [ -d '../packages/php-cgi-wasm/mapped' ]; then {
# cp -r ../packages/php-cgi-wasm/mapped public/
# cp ../packages/php-cgi-wasm/*.map public/
# }
# fi

rm -f build/*.wasm;
rm -f build/*.data;
Expand Down
4 changes: 2 additions & 2 deletions demo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "./npm-start.sh",
"build": "./npm-build.sh",
"start": "bash ./npm-start.sh",
"build": "bash ./npm-build.sh",
"test": "react-scripts test",
"eject": "react-scripts eject",
"clean": ""
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion demo-web/public/cgi-worker.js

Large diffs are not rendered by default.

Binary file modified demo-web/public/libcrypto.so
Binary file not shown.
Binary file removed demo-web/public/libs/libxml2.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-dom.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-gd.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-iconv.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-intl.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-mbstring.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-openssl.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-pdo-sqlite.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-phar.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-simplexml.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-sqlite.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-tidy.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-xml.so
Binary file not shown.
Binary file modified demo-web/public/php8.3-zlib.so
Binary file not shown.
3 changes: 2 additions & 1 deletion demo-web/src/Embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ const sharedLibs = [
`php${PhpWeb.phpVersion}-mbstring.so`,
`php${PhpWeb.phpVersion}-sqlite.so`,
`php${PhpWeb.phpVersion}-pdo-sqlite.so`,
// `php${PhpWeb.phpVersion}-phar.so`,
`php${PhpWeb.phpVersion}-xml.so`,
`php${PhpWeb.phpVersion}-simplexml.so`,
{url: `libs/libxml2.so`, ini:false},
{url: `libxml2.so`, ini:false},
];

const files = [
Expand Down
18 changes: 11 additions & 7 deletions demo-web/src/InstallDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ import WwwIcon from './icons/www-icon-32.png'
import editorIcon from './icons/editor-icon-32.png';

navigator.serviceWorker.register(process.env.PUBLIC_URL + `/cgi-worker.js`);
setTimeout(() => {
if(!(navigator.serviceWorker && navigator.serviceWorker.controller))
{
window.location.reload()
}
}, 350);

(navigator.serviceWorker && navigator.serviceWorker.controller) || window.location.reload();
const params = new URLSearchParams(window.location.search);

if(!params.has('no-service-worker'))
{
setTimeout(() => {
if(!(navigator.serviceWorker && navigator.serviceWorker.controller))
{
window.location.reload()
}
}, 350);
}

const sendMessage = sendMessageFor((`${window.location.origin}${process.env.PUBLIC_URL}/cgi-worker.mjs`))

Expand Down
2 changes: 1 addition & 1 deletion demo-web/src/cgi-worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const sharedLibs = [
`php\${PHP_VERSION}-pdo-sqlite.so`,
`php\${PHP_VERSION}-xml.so`,
`php\${PHP_VERSION}-simplexml.so`,
{url: `libs/libxml2.so`, ini: false},
{url: `libxml2.so`, ini: false},
];

const files = [{ parent: '/preload/', name: 'icudt72l.dat', url: './icudt72l.dat' }];
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.2ce74b59.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/php-wasm/favicon.ico"/><meta name="viewport" content="width=650,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/php-wasm/logo192.png"/><link rel="manifest" href="/php-wasm/manifest.json"/><title>php-wasm</title><script type="text/javascript" src="https://unpkg.com/curvature@0.0.68-h/dist/curvature.js"></script><script defer="defer" src="/php-wasm/static/js/main.d88b0692.js"></script><link href="/php-wasm/static/css/main.9114cb59.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html><!--
sssooo+++++++///////++++//:----:::::///////:::::::///+ossssssyyyhdddddmmmmNNmo`````````````````````-
soooo+//////::::::::////:-....-----::::::----------:/+ossyyyyhdhddmmmmNNMNNNN: .
soo++//:::---------:://::-----..------.-.........--:/+ossyyhddmmddmmNNNNMMNNm. .
Expand Down
Loading
Loading