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

feat(pecl) Set up PECL installation #76

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ provide more safety and a more user-friendly API.

See the [API documentations with examples](https://wasmerio.github.io/php-ext-wasm/wasm/).

### Install with PECL (recommended)

PECL is the official repository for PHP extensions. This project is
hosted on PECL under the name `wasm`: http://pecl.php.net/wasm.

```sh
$ pecl install -B wasm
$ cd /tmp/pear/temp/wasm/src
$ phpize
$ export CXX='g++'
$ export CXXFLAGS='-std=c++11'
$ ./configure --with-php-config=$PHP_PREFIX_BIN/php-config
$ make install
```

This process will be easier in a close future.

### Install manually (development)

To compile the entire project, run the following commands:

```sh
Expand Down
123 changes: 123 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.4" version="2.0"
xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>wasm</name>
<channel>pecl.php.net</channel>
<summary>Run WebAssembly binaries in PHP</summary>
<description>
WebAssembly (abbreviated Wasm) is a binary instruction format for
a stack-based virtual machine. Wasm is designed as a portable target
for compilation of high-level languages like C/C++/Rust, enabling
deployment on the web for client and server applications.

This extension allows to run Wasm binaries inside PHP.
</description>
<lead>
<name>Ivan Enderlin</name>
<user>hywan</user>
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2019-08-22</date>
<time>16:00:00</time>
<version>
<release>0.5.0</release>
<api>0.5</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://github.com/wasmerio/wasmer/blob/master/LICENSE">MIT</license>
<notes>
# Features

## Extension

* #71 Use pre-build dynamic libraries (@Hywan)
* #70 Improve function invocation time by 77% (@Hywan)
* #69 Introduce the `wasm_instance` structure (@Hywan)
* #68 Add the `WasmArrayBuffer::grow` method (@Hywan)

## Runtime

* #72 Update Wasmer to 0.5.5 (@Hywan)

# Bug/security fixes

* #67 Update smallvec (@Hywan)
* #48 Fix the extension compilation on CentOS (@Hywan)

# Documentation

* Many improvements related to the new features and bug fixes.

# Chore

* #59 Tweak Bors (@Hywan)
</notes>
<contents>
<dir name="/">
<!-- ./ -->
<file role="doc" name="README.md" />

<!-- src/ -->
<file role="doc" name="src/CREDITS" />
<file role="src" name="src/composer.json" />
<file role="src" name="src/config.m4" />
<file role="src" name="src/libwasmer_runtime_c_api.dylib" />
<file role="src" name="src/libwasmer_runtime_c_api.so" />
<file role="src" name="src/php_wasm.h" />
<file role="src" name="src/wasm.cc" />
<file role="src" name="src/wasm.hh" />
<file role="src" name="src/wasmer.hh" />

<!-- lib/ -->
<file role="doc" name="lib/README.md" />
<file role="src" name="lib/Cache/CacheInterface.php" />
<file role="src" name="lib/Cache/Exception.php" />
<file role="src" name="lib/Cache/Filesystem.php" />
<file role="src" name="lib/Cache/InvalidArgumentException.php" />
<file role="src" name="lib/Cache/README.md" />
<file role="src" name="lib/Instance.php" />
<file role="src" name="lib/Int16Array.php" />
<file role="src" name="lib/Int32Array.php" />
<file role="src" name="lib/Int8Array.php" />
<file role="src" name="lib/Module.php" />
<file role="src" name="lib/Prelude.php" />
<file role="src" name="lib/TypedArray.php" />
<file role="src" name="lib/Uint16Array.php" />
<file role="src" name="lib/Uint32Array.php" />
<file role="src" name="lib/Uint8Array.php" />

<!-- examples/ -->
<file role="doc" name="examples/greet.php" />
<file role="doc" name="examples/greet.rs" />
<file role="doc" name="examples/greet.wasm" />
<file role="doc" name="examples/imported_function.php" />
<file role="doc" name="examples/imported_function.rs" />
<file role="doc" name="examples/imported_function.wasm" />
<file role="doc" name="examples/memory.php" />
<file role="doc" name="examples/memory.rs" />
<file role="doc" name="examples/memory.wasm" />
<file role="doc" name="examples/module_caching.php" />
<file role="doc" name="examples/simple.php" />
<file role="doc" name="examples/simple.rs" />
<file role="doc" name="examples/simple.wasm" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>7.2.0</min>
</php>
<pearinstaller>
<min>1.4.0</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>wasm</providesextension>
<extsrcrelease></extsrcrelease>
</package>
2 changes: 1 addition & 1 deletion src/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if test "$PHP_WASM" != "no"; then
AC_DEFINE(HAVE_WASM, 1, [ Have wasm support ])

PHP_SUBST(WASM_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(wasmer_runtime_c_api, ., WASM_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(wasmer_runtime_c_api, $ac_pwd, WASM_SHARED_LIBADD)

PHP_NEW_EXTENSION(wasm, wasm.cc, $ext_shared)
fi