aboutsummaryrefslogtreecommitdiffhomepage
path: root/files
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-10-25 17:34:54 +0900
committernsfisis <nsfisis@gmail.com>2023-10-25 17:57:23 +0900
commit8101ba079b8b358a015f4de9acbfc85d89c335da (patch)
treefdc57aedf9323c3a0d5e03979b530eca338a7a4c /files
parent69c4159c6464937031e046eae3fc74045fe9fae0 (diff)
downloadphpstudy-157-slides-8101ba079b8b358a015f4de9acbfc85d89c335da.tar.gz
phpstudy-157-slides-8101ba079b8b358a015f4de9acbfc85d89c335da.tar.zst
phpstudy-157-slides-8101ba079b8b358a015f4de9acbfc85d89c335da.zip
作成HEADmain
Diffstat (limited to 'files')
-rw-r--r--files/13
-rw-r--r--files/23
-rw-r--r--files/312
-rw-r--r--files/42
-rw-r--r--files/59
-rw-r--r--files/69
-rw-r--r--files/php-wasm.c8
7 files changed, 46 insertions, 0 deletions
diff --git a/files/1 b/files/1
new file mode 100644
index 0000000..3139084
--- /dev/null
+++ b/files/1
@@ -0,0 +1,3 @@
+$ ./buildconf
+$ ./configure
+$ make
diff --git a/files/2 b/files/2
new file mode 100644
index 0000000..efc4a65
--- /dev/null
+++ b/files/2
@@ -0,0 +1,3 @@
+$ ./buildconf
+$ emconfigure ./configure
+$ emmake make
diff --git a/files/3 b/files/3
new file mode 100644
index 0000000..2488b0c
--- /dev/null
+++ b/files/3
@@ -0,0 +1,12 @@
+$ emconfigure configure \
+ --disable-all \
+ --disable-mbregex \
+ --disable-fiber-asm \
+ --disable-cli \
+ --disable-cgi \
+ --disable-phpdbg \
+ --without-iconv \
+ --without-libxml \
+ --without-pcre-jit \
+ --without-pdo-sqlite \
+ --without-sqlite3
diff --git a/files/4 b/files/4
new file mode 100644
index 0000000..e534707
--- /dev/null
+++ b/files/4
@@ -0,0 +1,2 @@
+$ EMCC_CFLAGS='-s ERROR_ON_UNDEFINED_SYMBOLS=0' \
+ emmake make
diff --git a/files/5 b/files/5
new file mode 100644
index 0000000..a8cfe55
--- /dev/null
+++ b/files/5
@@ -0,0 +1,9 @@
+$ emcc \
+ -s ERROR_ON_UNDEFINED_SYMBOLS=0 \
+ -s ENVIRONMENT=node \
+ -s INITIAL_MEMORY=16777216 \
+ -s EXPORT_ES6=1 \
+ -s INVOKE_RUN=0 \
+ -s MODULARIZE=1 \
+ -o php-wasm.js \
+ php-wasm.o libphp.a
diff --git a/files/6 b/files/6
new file mode 100644
index 0000000..27a5416
--- /dev/null
+++ b/files/6
@@ -0,0 +1,9 @@
+import PHPWasm from './php-wasm.js'
+
+const { ccall } = await PHPWasm();
+const result = ccall(
+ 'php_wasm_run',
+ 'number', ['string'],
+ [`echo "Hello, World!";`],
+);
+console.log(`exit code: ${result}`);
diff --git a/files/php-wasm.c b/files/php-wasm.c
new file mode 100644
index 0000000..c124af0
--- /dev/null
+++ b/files/php-wasm.c
@@ -0,0 +1,8 @@
+#include <emscripten.h>
+#include <Zend/zend_execute.h>
+
+int EMSCRIPTEN_KEEPALIVE php_wasm_run(const char* code) {
+ zend_result result =
+ zend_eval_string_ex(code, NULL, "php.wasm code", 1);
+ return result == SUCCESS ? 0 : 1;
+}