Implemented async callbacks to PHP regardless of thread model, Sigv4 signing (#24)

* Updated to get latest aws-crt-ffi

* Added implementation for signing_result

* Added main thread queue and callback queueing to signing process

* Updated to get support for date on signing_config_aws

* added date support to SigningConfigAWS, fixed up reference issues on http message signing

* Broke C code into separate files, moved common stuff to php_aws_crt.h

* Use a unity build to make PHP do the right thing with our lib

* Updated aws-crt-ffi to v0.1.3 to get sigv4 changes

* Added CRT::isAvailable for safe runtime detection of CRT

* Fixed up test resource safety, added tests to prove it

* Added CI jobs for every version of PHP on linux (#26)
This commit is contained in:
Justin Boswell
2021-06-08 00:34:42 +00:00
committed by GitHub
parent a99fdeb9d3
commit 7d47316a7d
26 changed files with 3316 additions and 2396 deletions
+12 -13
View File
@@ -3,7 +3,7 @@ BUILD_DIR=$(shell pwd)/build
DEPS_DIR=$(BUILD_DIR)/deps
INT_DIR=$(BUILD_DIR)/install
INSTALL_DIR=$(shell pwd)
AT_LEAST_PHP7=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7)
GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1)
CMAKE = cmake3
ifeq (, $(shell which cmake3))
@@ -32,20 +32,17 @@ $(BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a: $(BUILD_DIR)/aws-crt-ffi-stati
$(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET)
# PHP extension target
extension: ext/crt.lo
awscrt: ext/awscrt.lo
# Force the crt object target to depend on the CRT static library
ext/crt.lo: $(BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h
ext/awscrt.lo: ext/awscrt.c
# borrow the gen_stub script from PHP's build process
GEN_STUB=build/gen_stub.php
$(GEN_STUB):
curl -o $(GEN_STUB) -sSL https://raw.githubusercontent.com/php/php-src/bbb86ba7e2fe8ae365294d1834c6a392570a9dcd/build/gen_stub.php
ext/awscrt.c: $(BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h
ext/awscrt_arginfo.h: ext/awscrt.stub.php $(GEN_STUB)
ifeq ($(AT_LEAST_PHP7),1)
ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php
ifeq ($(GENERATE_STUBS),1)
# generate awscrt_arginfo.h
php $(GEN_STUB) ext/awscrt.stub.php
php gen_stub.php --minimal-arginfo ext/awscrt.stub.php
endif
# transform/install api.h from FFI lib
@@ -56,14 +53,16 @@ src/api.h: crt/aws-crt-ffi/src/api.h
ext/api.h : src/api.h
cp -v src/api.h ext/api.h
ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h
# FFI target
ffi: src/libaws-crt-ffi.so
# copy the lib into the src folder
src/libaws-crt-ffi.so: $(BUILD_DIR)/aws-crt-ffi-shared/libaws-crt-ffi.so src/api.h
cp -v $(BUILD_DIR)/aws-crt-ffi-shared/libaws-crt-ffi.so src/libaws-crt-ffi.so
modules/libaws-crt-ffi.so: $(BUILD_DIR)/aws-crt-ffi-shared/libaws-crt-ffi.so src/api.h
cp -v $(BUILD_DIR)/aws-crt-ffi-shared/libaws-crt-ffi.so modules/libaws-crt-ffi.so
# Use PHPUnit to run tests
test: ext/api.h ext/awscrt_arginfo.h ext/crt.lo
test: ext/api.h ext/awscrt_arginfo.h ext/awscrt.lo
composer update
composer run test