Skip to content

Commit 219b50f

Browse files
committed
Try #71:
2 parents 39a5509 + 338be8e commit 219b50f

16 files changed

+11
-26
lines changed

.circleci/config.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,17 @@ jobs:
3232
php -r "unlink('composer-setup.php');"
3333
mv composer.phar composer
3434
35-
# Compile the Rust part of the extension.
36-
- run:
37-
name: Compile the Rust part of the PHP extension
38-
command: |
39-
export PATH="$HOME/.cargo/bin:$PATH"
40-
just rust
41-
4235
# Compile and install the PHP extension.
43-
# `just php` isn't used because there is no some issue with
36+
# `just build` isn't used because there is no some issue with
4437
# `--with-pic` I don't understand…
4538
- run:
4639
name: Compile and install the PHP extension
4740
command: |
4841
export PATH="$HOME/.cargo/bin:$PATH"
4942
sudo apt-get install gcc
5043
export CXX="gcc"
51-
EXTENSION="$HOME/project/extension"
44+
EXTENSION="$HOME/project/src
5245
cd $EXTENSION
53-
test -f libwasmer_runtime_c_api.a && rm libwasmer_runtime_c_api.a
54-
ln -s ../target/release/deps/libwasmer_runtime_c_api-*.a libwasmer_runtime_c_api.a
5546
PHP_PREFIX=$(php-config --prefix)
5647
PHP_PREFIX_BIN=$PHP_PREFIX/bin
5748
$PHP_PREFIX_BIN/phpize --clean

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/composer.lock
22
/doc
3-
/extension/libwasmer_runtime_c_api.a
43
/target/
54
/vendor/

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ See the [API documentations with examples](https://wasmerio.github.io/php-ext-wa
156156
To compile the entire project, run the following commands:
157157

158158
```sh
159-
$ just rust
160-
$ just php
159+
$ just build
161160
$ php -d extension=wasm examples/simple.php
162161
```
163162

justfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ compile-wasm FILE='examples/simple':
88
mv {{FILE}}.opt.wasm {{FILE}}.wasm
99
rm {{FILE}}.raw.wasm
1010

11-
# Compile the Rust part.
12-
rust:
13-
cargo build --release
14-
15-
# Compile the PHP part.
16-
php:
11+
# Compile the PHP extension.
12+
build:
1713
#!/usr/bin/env bash
1814
set -euo pipefail
19-
cd extension
20-
test -f libwasmer_runtime_c_api.a && rm libwasmer_runtime_c_api.a
21-
ln -s ../target/release/deps/libwasmer_runtime_c_api-*.a libwasmer_runtime_c_api.a
15+
cd src
2216
PHP_PREFIX_BIN=$(php-config --prefix)/bin
2317
$PHP_PREFIX_BIN/phpize --clean
2418
$PHP_PREFIX_BIN/phpize
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/lib.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/libwasmer_runtime_c_api.dylib

2.39 MB
Binary file not shown.

src/libwasmer_runtime_c_api.so

4.17 MB
Binary file not shown.
File renamed without changes.
File renamed without changes.

extension/wasm.hh renamed to src/wasm.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ static void php_wasm_module_clean_up_persistent_resources();
151151
const char* wasm_instance_resource_name;
152152
int wasm_instance_resource_number;
153153

154+
/**
155+
* Represents an exported function.
156+
*/
154157
typedef struct {
155158
// The internal opaque exported function pointer.
156159
const wasmer_export_func_t *exported_function;
File renamed without changes.

tests/units/Instance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function () use ($filePath) {
5757
->isInstanceOf(RuntimeException::class)
5858
->hasMessage(
5959
"An error happened while compiling or instantiating the module `$filePath`:\n" .
60-
" error instantiating"
60+
" compile error: Validation error \"Invalid type\""
6161
);
6262
}
6363

@@ -76,7 +76,7 @@ function () use ($filePath) {
7676
->isInstanceOf(RuntimeException::class)
7777
->hasMessage(
7878
"An error happened while compiling or instantiating the module `$filePath`:\n" .
79-
" error instantiating"
79+
" compile error: Validation error \"Unexpected EOF\""
8080
);
8181
}
8282

0 commit comments

Comments
 (0)