Commit Graph

9 Commits

Author SHA1 Message Date
David Cole
296c3add84 add note to update docs.rs bindings
[ci skip]
2022-10-16 13:13:17 +13:00
Niklas Mollenhauer
24d703d955
Add some standard zend interfaces (#164)
* Add some standard zend interfaces

The zend API also has some standard interfaces it exposes:
c8c09b4aae/Zend/zend_interfaces.h (L27-L33)
```
extern ZEND_API zend_class_entry *zend_ce_traversable;
extern ZEND_API zend_class_entry *zend_ce_aggregate;
extern ZEND_API zend_class_entry *zend_ce_iterator;
extern ZEND_API zend_class_entry *zend_ce_arrayaccess;
extern ZEND_API zend_class_entry *zend_ce_serializable;
extern ZEND_API zend_class_entry *zend_ce_countable;
extern ZEND_API zend_class_entry *zend_ce_stringable;
```

This surfaced in #163 and should make it possible to implement these interfaces.

* Add some links to the php documentation

* update docs.rs bindings

Co-authored-by: David Cole <david.cole1340@gmail.com>
2022-10-16 13:13:09 +13:00
Dirk Stolle
4bb0559ab8 Fix a few typos 2022-09-10 16:40:38 +02:00
David Cole
664981f4fb
Windows support (#128)
* Preliminary Windows support

* Start work on cross-platform build script

* Fix compilation on macOS

* Updated README, tidied up build script

* Check linker version before starting compilation

It doesn't seem like it's possible to change the linker from within the
build script, however, we can retrieve the linker in use and give the
user a suggestion if the linker will not work.

* Switch to using Github repository for bindgen

* Split Windows and Unix implementations into two files

* Fix building on Windows

* Remove `reqwest` and `zip` as dependencies on Unix

* Fix guide tests on Windows

* Started work on Windows CI

* runs -> run

* Use preinstalled LLVM on Windows

* Debugging for Windows CI

* Switch to upstream `rust-bindgen` master branch

* Switch to `rust-lld` for Windows linking

* Don't compile `cargo-php` on Windows

* Switch to using skeptic for tests

* cargo-php: Disable stub generation, fix ext install/remove

The plan is to replace the stub generation by generating them with PHP
code. This is cross-platform and means we don't need to worry about ABI.
We also don't need to embed information into the library.

* cargo-php: Fix on unix OS

* Fix clippy lint

* Updated README

* Re-add CI for Unix + PHP 8.0

* Fix building on thread-safe PHP

* Tidy up build scripts

* Use dynamic lookup on Linux, test with TS Windows

* Define `ZTS` when compiling PHP ZTS

* Combine Windows and Unix CI, fix linking for Win32TS

* Fix exclusions in build CI

* rust-toolchain -> rust

* Set LLVM version

* Only build docs.rs on Ubuntu PHP 8.1

* Fix build on Linux thread-safe

* Update guide example
2022-03-18 16:36:51 +13:00
David Cole
9c8dd7cd05 Fix cargo-php 2022-02-25 12:37:36 +13:00
David Cole
a9e1dad59f Add bindings for php_printf 2022-02-24 22:45:32 +13:00
David Cole
24fab173f1 Add executor globals to allowed bindings for CLI 2021-11-23 19:01:33 +13:00
David Cole
6fd31621f2
Add preliminary PHP 8.1 support (#109)
* Bump PHP API version, remove flags removed from PHP API

See following commits:
- 70195c3561
- b5746a4c7f

* Add PHP 8.1 to CI

* Clippy lint

* Fix PHP 8.1 support with new features
2021-11-21 20:00:51 +13:00
David Cole
6df362b714
Added CLI crate for stubs, installation and removal (#107)
* started work on stub generator

* Worked on stub CLI tool

* Unused import

* Account for namespaces in function and class names

* Add support for docblocks on structs

* Push Rust comments to stubs

* Add indentation to stub generation

* Add CLI application to install and generate stubs

This time CLI application is defined on user side, called with `cargo
run -- ..args..`

* Export anyhow result

* Add constants to stub file

* Removed stub symbols

No longer required as we are now building while also linking to PHP.
Keeping the stubs causes the stubs to override the real symbols in the
extension.

* Fix stubs for real this time

Removed stub symbols as they were being included in the extension
dylib, fix by loading the PHP executable as a dylib, loading the
required symbols globally.

* Maybe actually fix stubs this time

* Forgot to remove PHP binary loading

* let's give this another go... cargo subcommand

Now called via `cargo php <install,stubs>`.

* Added `remove` command

* Tidied up cargo-php, commented, set up CI

* Fix return types with non-ident types

* define namespace ordering

* Fix tests, replace `Self` when in outer context

* Moved allowed bindings into separate file

* Update guide with CLI instructions
2021-11-20 14:19:02 +13:00