Skip to content

Commit

Permalink
CGI data file tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Jun 24, 2024
1 parent a0efebf commit 5020b69
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 136 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ patch/php8.0.patch:

php-clean:
${DOCKER_RUN_IN_PHP} rm -f configured
${DOCKER_RUN_IN_PHP} make clean
- ${DOCKER_RUN_IN_PHP} make clean

clean:
${DOCKER_RUN} rm -rf \
Expand Down
89 changes: 2 additions & 87 deletions demo-web/public/cgi-worker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion emscripten-builder.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN apt-get update; \

RUN cd /emsdk/upstream && { \
rm -rf emscripten; \
git clone https://github.com/seanmorris/emscripten.git emscripten --branch sm-updates --depth=1; \
git clone https://github.com/seanmorris/emscripten.git emscripten --depth=1 --branch sm-updates; \
}

RUN cd /emsdk/upstream/emscripten && ./bootstrap;
Expand Down
61 changes: 14 additions & 47 deletions packages/php-cgi-wasm/static.mak
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ifneq (${SHARED_ASSET_PATHS},${PHP_CGI_ASSET_PATH})
SHARED_ASSET_PATHS+= ${PHP_CGI_ASSET_PATH}
endif

ifdef PRELOAD_ASSETS
${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data: .cache/preload-collected
cp -Lprf packages/php-cgi-wasm/${PRELOAD_NAME}.data ${ENV_DIR}${PHP_CGI_ASSET_PATH}/
endif
.SECONDEXPANSION:
${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data: .cache/preload-collected
- $(if $${PRELOAD_ASSETS},cp -Lprf third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR})
- $(if $${PRELOAD_ASSETS},cp -Lprf ${PHP_CGI_DIST_DIR}/${PRELOAD_NAME}.data ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/)

NOTPARALLEL+= $(addprefix ${PHP_CGI_DIST_DIR}/,php-cgi-web.mjs php-cgi-webview.mjs php-cgi-node.mjs php-cgi-shell.mjs php-cgi-worker.mjs) \
$(addprefix ${PHP_CGI_DIST_DIR}/,php-cgi-web.js php-cgi-webview.js php-cgi-node.js php-cgi-shell.js php-cgi-worker.js)
Expand Down Expand Up @@ -75,10 +75,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-web.js: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.js

${PHP_CGI_DIST_DIR}/php-cgi-web.mjs: BUILD_TYPE=mjs
Expand All @@ -93,10 +90,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-web.mjs: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
perl -pi -w -e 's|var _script(Dir\|Name) = import.meta.url;|const importMeta = import.meta;var _script\1 = importMeta.url;|g' ${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.mjs

${PHP_CGI_DIST_DIR}/php-cgi-worker.js: BUILD_TYPE=js
Expand All @@ -111,10 +105,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-worker.js: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
perl -pi -w -e 's|${READ_ASYNC_OLD}|${READ_ASYNC_NEW}|' ${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.js

${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs: BUILD_TYPE=mjs
Expand All @@ -129,10 +120,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
perl -pi -w -e 's|var _script(Dir\|Name) = import.meta.url;|const importMeta = import.meta;var _script\1 = importMeta.url;|g' ${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.mjs

${PHP_CGI_DIST_DIR}/php-cgi-node.js: BUILD_TYPE=js
Expand All @@ -146,10 +134,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-node.js: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.js

${PHP_CGI_DIST_DIR}/php-cgi-node.mjs: BUILD_TYPE=mjs
Expand All @@ -163,10 +148,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-node.mjs: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.mjs

${PHP_CGI_DIST_DIR}/php-cgi-shell.js: BUILD_TYPE=js
Expand All @@ -179,10 +161,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-shell.js: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.js

${PHP_CGI_DIST_DIR}/php-cgi-shell.mjs: BUILD_TYPE=mjs
Expand All @@ -195,10 +174,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-shell.mjs: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}/
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.mjs

${PHP_CGI_DIST_DIR}/php-cgi-webview.js: BUILD_TYPE=js
Expand All @@ -212,10 +188,7 @@ ${PHP_CGI_DIST_DIR}/php-cgi-webview.js: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|import(name)|import(/* webpackIgnore: true */ name)|g' $@
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.js

${PHP_CGI_DIST_DIR}/php-cgi-webview.mjs: BUILD_TYPE=mjs
Expand All @@ -230,11 +203,5 @@ ${PHP_CGI_DIST_DIR}/php-cgi-webview.mjs: ${CGI_DEPENDENCIES} | ${ORDER_ONLY}
perl -pi -w -e 's|require("fs")|require(/* webpackIgnore: true */ "fs")|g' $@
perl -pi -w -e 's|var _script(Dir\|Name) = import.meta.url;|const importMeta = import.meta;var _script\1 = importMeta.url;|g' ${PHP_CGI_DIST_DIR}/php-cgi-worker.mjs
- cp -Lprf ${PHP_CGI_DIST_DIR}/php-cgi-${ENVIRONMENT}${RELEASE_SUFFIX}.${BUILD_TYPE}.* ${PHP_CGI_ASSET_PATH}/
ifdef PRELOAD_ASSETS
cp third_party/php${PHP_VERSION}-src/sapi/cgi/${PRELOAD_NAME}.data ${PHP_CGI_DIST_DIR}
${MAKE} ${ENV_DIR}${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
endif
${MAKE} ${ENV_DIR}/${PHP_CGI_ASSET_PATH}/${PRELOAD_NAME}.data
${MAKE} $(addprefix ${PHP_CGI_ASSET_PATH}/,${PHP_ASSET_LIST}) ${PHP_CGI_DIST_DIR}/config.mjs

.SECONDEXPANSION:
cgi-assets: $$(addprefix $${PHP_CGI_ASSET_PATH}/,$${PHP_ASSET_LIST})

0 comments on commit 5020b69

Please sign in to comment.