forked from phper-framework/phper
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dusan Malusev <dusan@dusanmalusev.dev>
- Loading branch information
1 parent
bf89d9d
commit d34724c
Showing
11 changed files
with
222 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
dnl Copyright (c) 2022 PHPER Framework Team | ||
dnl PHPER is licensed under Mulan PSL v2. | ||
dnl You can use this software according to the terms and conditions of the Mulan | ||
dnl PSL v2. You may obtain a copy of Mulan PSL v2 at: | ||
dnl http://license.coscl.org.cn/MulanPSL2 | ||
dnl THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY | ||
dnl KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
dnl NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
dnl See the Mulan PSL v2 for more details. | ||
|
||
PHP_ARG_ENABLE([complex], | ||
[whether to enable hello support], | ||
[AS_HELP_STRING([--enable-complex], | ||
[Enable complex support])], | ||
[no]) | ||
|
||
dnl If not enable, `cargo build` run with argument `--release`. | ||
PHP_ARG_ENABLE([cargo_debug], [whether to enable cargo debug mode], | ||
[ --enable-cargo-debug Enable cargo debug], no, no) | ||
|
||
if test "$PHP_hello" != "no"; then | ||
dnl Check cargo command exists or not. | ||
AC_PATH_PROG(CARGO, cargo, no) | ||
if ! test -x "$CARGO"; then | ||
AC_MSG_ERROR([cargo command missing, please reinstall the cargo distribution]) | ||
fi | ||
|
||
AC_DEFINE(HAVE_complex, 1, [ Have complex support ]) | ||
|
||
PHP_NEW_EXTENSION(complex, [ ], $ext_shared) | ||
|
||
CARGO_MODE_FLAGS="--release" | ||
CARGO_MODE_DIR="release" | ||
|
||
if test "$PHP_CARGO_DEBUG" != "no"; then | ||
CARGO_MODE_FLAGS="" | ||
CARGO_MODE_DIR="debug" | ||
fi | ||
|
||
cat >>Makefile.objects<< EOF | ||
all: cargo_build | ||
|
||
clean: cargo_clean | ||
|
||
cargo_build: | ||
# Build the extension file | ||
PHP_CONFIG=$PHP_PHP_CONFIG cargo build $CARGO_MODE_FLAGS | ||
|
||
# Copy the extension file from target dir to modules | ||
if [[ -f ./target/$CARGO_MODE_DIR/libcomplex.dylib ]] ; then \\ | ||
cp ./target/$CARGO_MODE_DIR/libcomplex.dylib ./modules/complex.so ; fi | ||
if [[ -f ./target/$CARGO_MODE_DIR/libcomplex.so ]] ; then \\ | ||
cp ./target/$CARGO_MODE_DIR/libcomplex.so ./modules/complex.so ; fi | ||
|
||
cargo_clean: | ||
cargo clean | ||
|
||
.PHONY: cargo_build cargo_clean | ||
EOF | ||
|
||
dnl Symbolic link the files for `cargo build` | ||
AC_CONFIG_LINKS([ \ | ||
Cargo.lock:Cargo.lock \ | ||
Cargo.toml:Cargo.toml \ | ||
build.rs:build.rs \ | ||
stubs:stubs \ | ||
src:src \ | ||
tests:tests \ | ||
]) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright (c) 2022 PHPER Framework Team | ||
PHPER is licensed under Mulan PSL v2. | ||
You can use this software according to the terms and conditions of the Mulan | ||
PSL v2. You may obtain a copy of Mulan PSL v2 at: | ||
http://license.coscl.org.cn/MulanPSL2 | ||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
See the Mulan PSL v2 for more details. | ||
--> | ||
<package 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>complex</name> | ||
<channel>pecl.php.net</channel> | ||
<summary>Hello world example a bit complex.</summary> | ||
<description>The Hello world example of phper.</description> | ||
<lead> | ||
<name>jmjoy</name> | ||
<user>jmjoy</user> | ||
<email>jmjoy@apache.org</email> | ||
<active>yes</active> | ||
</lead> | ||
<date>1970-01-01</date> | ||
<version> | ||
<release>0.0.0</release> | ||
<api>0.0.0</api> | ||
</version> | ||
<stability> | ||
<release>stable</release> | ||
<api>stable</api> | ||
</stability> | ||
<license uri="http://license.coscl.org.cn/MulanPSL2/">MulanPSL-2.0</license> | ||
<notes>Release notes.</notes> | ||
<contents> | ||
<dir name="/"> | ||
<file name="Cargo.lock" role="src"/> | ||
<file name="Cargo.toml" role="src"/> | ||
<file name="README.md" role="doc"/> | ||
<file name="build.rs" role="src"/> | ||
<file name="config.m4" role="src"/> | ||
<file name="src/lib.rs" role="src"/> | ||
<file name="src/args_bindings.rs" role="src"/> | ||
<file name="stubs/say_hello.stub.php" role="src"/> | ||
</dir> | ||
</contents> | ||
<dependencies> | ||
<required> | ||
<php> | ||
<min>8.1.0</min> | ||
</php> | ||
<pearinstaller> | ||
<min>1.4.0</min> | ||
</pearinstaller> | ||
</required> | ||
</dependencies> | ||
<providesextension>complex</providesextension> | ||
<extsrcrelease> | ||
<configureoption default="no" name="enable-cargo-debug" prompt="enable cargo debug?"/> | ||
</extsrcrelease> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,5 +64,6 @@ EOF | |
Cargo.toml:Cargo.toml \ | ||
build.rs:build.rs \ | ||
src:src \ | ||
stubs:stubs \ | ||
]) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <php.h> | ||
|
||
BEGIN_EXTERN_C() | ||
#define static | ||
|
||
/* This is a generated file, edit the .stub.php file instead. | ||
* Stub hash: 06df13993563e31f9f0fecc3b09978b926a9fda6 */ | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hello, 0, 1, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
|
||
|
||
|
||
#undef static | ||
END_EXTERN_C() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <php.h> | ||
|
||
extern const zend_internal_arg_info arginfo_hello[2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.