diff --git a/README.md b/README.md index 9bb7142..3ef8cf3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# PHP Weak extension [![Build Status](https://travis-ci.org/pinepain/php-weak.svg)](https://travis-ci.org/pinepain/php-weak) +# PHP Weak extension + +[![Build Status](https://travis-ci.org/pinepain/php-weak.svg)](https://travis-ci.org/pinepain/php-weak) +[![Windows Build status](https://ci.appveyor.com/api/projects/status/7r07eydi6c3lj36a/branch/master?svg=true)](https://ci.appveyor.com/project/pinepain/php-weak) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/pinepain/php-weak/master/LICENSE) This extension provides [weak references](https://en.wikipedia.org/wiki/Weak_reference) support for PHP 7 and serves as a ground for other weak data structures. @@ -132,7 +136,7 @@ To install extension globally run # sudo make install You will need to copy the extension config to your php dir, here is example for Ubuntu with PHP 7 from -[Ondřej Surý's PPA for PHP 7.0](https://launchpad.net/~ondrej/+archive/ubuntu/php-7.0): +[Ondřej Surý's PPA for PHP](https://launchpad.net/~ondrej/+archive/ubuntu/php): # sudo cp provision/php/weak.ini /etc/php/mods-available/ # sudo phpenmod -v ALL weak diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..ab49492 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,72 @@ +platform: + - x86 + - x64 + +environment: + matrix: + - PHP_VERSION: 7.0.8 + THREAD_SAFE: true + - PHP_VERSION: 7.0.8 + THREAD_SAFE: false + + PHP_SDK: c:\projects\php-sdk + +matrix: + fast_finish: true + +os: Windows Server 2012 +clone_folder: c:\projects\php-sdk\php-weak-ci\vc14\x86\php\ext\weak + +init: + - ps: | + # Determine thread safety and debug command arguments for PHP configuration + If ($env:THREAD_SAFE -Match "true") { + $env:ENABLE_DISABLE_THREAD_SAFETY="--enable-zts" + $env:TS_OR_NTS="ts" + $env:OUTDIR="Release_TS" + } Else { + $env:ENABLE_DISABLE_THREAD_SAFETY="--disable-zts" + $env:TS_OR_NTS="nts" + $env:OUTDIR="Release" + } + + $env:PHP="$($env:PHP_VERSION.Substring(0, $env:PHP_VERSION.indexOf('.', 2)))" + + $env:ARTIFACT_NAME="php_weak-$($env:PHP)-$($env:TS_OR_NTS)-vc14-$($env:PLATFORM).zip" + +install: + - cd %PHP_SDK% + - curl -fSL -o php-sdk-binary-tools-20110915.zip 'http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip' + - 7z.exe x php-sdk-binary-tools-20110915.zip + - call bin\phpsdk_setvars.bat + - call bin\phpsdk_buildtree.bat php-weak-ci + - cd php-weak-ci\vc14\x86 + - curl -fSL -o 'php-%PHP_VERSION%.tar.gz' 'http://us1.php.net/distributions/php-%PHP_VERSION%.tar.gz' + - ren php php-%PHP_VERSION% + - 7z.exe x php-%PHP_VERSION%.tar.gz -y + - 7z.exe x php-%PHP_VERSION%.tar -y | find /v "Extracting" + - cd php-%PHP_VERSION% + - mkdir %OUTDIR% + +build_script: + - '"%VS140COMNTOOLS%\VsDevCmd" %PLATFORM%' + - set + - echo Building PHP [%PHP_VERSION%] + - '%PHP_SDK%\bin\phpsdk_setvars' + - buildconf + - configure --disable-all --enable-cli --enable-weak=shared %ENABLE_DISABLE_THREAD_SAFETY% + - nmake + +after_build: + - cd %OUTDIR% + - dir + - dir ext + - dir ext\weak + - 7z a %ARTIFACT_NAME% php_weak.dll + - appveyor PushArtifact %ARTIFACT_NAME% + +test_script: + - cd c:\projects\php-sdk\php-weak-ci\vc14\x86\php-%PHP_VERSION% + - set NO_INTERACTION=1 + - set REPORT_EXIT_STATUS=1 + - "%OUTDIR%\\php.exe run-tests.php -p %OUTDIR%\\php.exe ext/weak/tests/ -d extension=php_weak.dll -d extension_dir=%OUTDIR%\\" diff --git a/php_weak_functions.h b/php_weak_functions.h index 564dd93..2231a5c 100644 --- a/php_weak_functions.h +++ b/php_weak_functions.h @@ -17,6 +17,10 @@ #include "php.h" +#ifdef ZTS +#include "TSRM.h" +#endif + extern const zend_function_entry php_weak_functions[]; #endif /* PHP_WEAK_FUNCTIONS_H */ diff --git a/php_weak_reference.h b/php_weak_reference.h index f2999e2..7e33bc0 100644 --- a/php_weak_reference.h +++ b/php_weak_reference.h @@ -17,6 +17,10 @@ #include "php.h" +#ifdef ZTS +#include "TSRM.h" +#endif + extern zend_class_entry *php_weak_reference_class_entry;