From 7c7c4c8c80b05cdada811c163505ee54b2b097d0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 2 Apr 2015 09:55:34 +0200 Subject: php-pecl-hprose: 1.0.0 - New package --- Makefile | 4 + REFLECTION | 1225 ++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-hprose.spec | 229 ++++++++++ 3 files changed, 1458 insertions(+) create mode 100644 Makefile create mode 100644 REFLECTION create mode 100644 php-pecl-hprose.spec diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/REFLECTION b/REFLECTION new file mode 100644 index 0000000..fffcce8 --- /dev/null +++ b/REFLECTION @@ -0,0 +1,1225 @@ +Extension [ extension #98 hprose version 1.0.0 ] { + + - Functions { + Function [ function hprose_serialize ] { + + - Parameters [2] { + Parameter #0 [ $val ] + Parameter #1 [ $simple ] + } + } + Function [ function hprose_unserialize ] { + + - Parameters [2] { + Parameter #0 [ $data ] + Parameter #1 [ $simple ] + } + } + Function [ function hprose_info ] { + + - Parameters [0] { + } + } + } + + - Classes [12] { + Class [ class HproseTags ] { + + - Constants [34] { + Constant [ string TagInteger ] { i } + Constant [ string TagLong ] { l } + Constant [ string TagDouble ] { d } + Constant [ string TagNull ] { n } + Constant [ string TagEmpty ] { e } + Constant [ string TagTrue ] { t } + Constant [ string TagFalse ] { f } + Constant [ string TagNaN ] { N } + Constant [ string TagInfinity ] { I } + Constant [ string TagDate ] { D } + Constant [ string TagTime ] { T } + Constant [ string TagUTC ] { Z } + Constant [ string TagBytes ] { b } + Constant [ string TagUTF8Char ] { u } + Constant [ string TagString ] { s } + Constant [ string TagGuid ] { g } + Constant [ string TagList ] { a } + Constant [ string TagMap ] { m } + Constant [ string TagClass ] { c } + Constant [ string TagObject ] { o } + Constant [ string TagRef ] { r } + Constant [ string TagPos ] { + } + Constant [ string TagNeg ] { - } + Constant [ string TagSemicolon ] { ; } + Constant [ string TagOpenbrace ] { { } + Constant [ string TagClosebrace ] { } } + Constant [ string TagQuote ] { " } + Constant [ string TagPoint ] { . } + Constant [ string TagFunctions ] { F } + Constant [ string TagCall ] { C } + Constant [ string TagResult ] { R } + Constant [ string TagArgument ] { A } + Constant [ string TagError ] { E } + Constant [ string TagEnd ] { z } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } + } + + Class [ class HproseBytesIO ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [17] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ $str ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ public method close ] { + + - Parameters [0] { + } + } + + Method [ public method length ] { + + - Parameters [0] { + } + } + + Method [ public method getc ] { + + - Parameters [0] { + } + } + + Method [ public method read ] { + + - Parameters [1] { + Parameter #0 [ $n ] + } + } + + Method [ public method readfull ] { + + - Parameters [0] { + } + } + + Method [ public method readuntil ] { + + - Parameters [1] { + Parameter #0 [ $tag ] + } + } + + Method [ public method readString ] { + + - Parameters [1] { + Parameter #0 [ $n ] + } + } + + Method [ public method mark ] { + + - Parameters [0] { + } + } + + Method [ public method unmark ] { + + - Parameters [0] { + } + } + + Method [ public method reset ] { + + - Parameters [0] { + } + } + + Method [ public method skip ] { + + - Parameters [1] { + Parameter #0 [ $n ] + } + } + + Method [ public method eof ] { + + - Parameters [0] { + } + } + + Method [ public method write ] { + + - Parameters [2] { + Parameter #0 [ $str ] + Parameter #1 [ $n ] + } + } + + Method [ public method toString ] { + + - Parameters [0] { + } + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + } + } + } + + Class [ class HproseClassManager ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [3] { + Method [ static public method register ] { + + - Parameters [2] { + Parameter #0 [ $name ] + Parameter #1 [ $alias ] + } + } + + Method [ static public method getAlias ] { + + - Parameters [1] { + Parameter #0 [ $name ] + } + } + + Method [ static public method getClass ] { + + - Parameters [1] { + Parameter #0 [ $alias ] + } + } + } + + - Properties [0] { + } + + - Methods [0] { + } + } + + Class [ class HproseWriter ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [29] { + Method [ public method __construct ] { + + - Parameters [2] { + Parameter #0 [ HproseBytesIO $stream ] + Parameter #1 [ $simple ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ public method serialize ] { + + - Parameters [1] { + Parameter #0 [ $data ] + } + } + + Method [ public method writeInteger ] { + + - Parameters [1] { + Parameter #0 [ $i ] + } + } + + Method [ public method writeLong ] { + + - Parameters [1] { + Parameter #0 [ $i ] + } + } + + Method [ public method writeDouble ] { + + - Parameters [1] { + Parameter #0 [ $d ] + } + } + + Method [ public method writeNaN ] { + + - Parameters [0] { + } + } + + Method [ public method writeInfinity ] { + + - Parameters [1] { + Parameter #0 [ $positive ] + } + } + + Method [ public method writeNull ] { + + - Parameters [0] { + } + } + + Method [ public method writeEmpty ] { + + - Parameters [0] { + } + } + + Method [ public method writeBoolean ] { + + - Parameters [1] { + Parameter #0 [ $b ] + } + } + + Method [ public method writeUTF8Char ] { + + - Parameters [1] { + Parameter #0 [ $ch ] + } + } + + Method [ public method writeString ] { + + - Parameters [1] { + Parameter #0 [ $str ] + } + } + + Method [ public method writeStringWithRef ] { + + - Parameters [1] { + Parameter #0 [ $str ] + } + } + + Method [ public method writeBytes ] { + + - Parameters [1] { + Parameter #0 [ $bytes ] + } + } + + Method [ public method writeBytesWithRef ] { + + - Parameters [1] { + Parameter #0 [ $bytes ] + } + } + + Method [ public method writeDateTime ] { + + - Parameters [1] { + Parameter #0 [ DateTime $dt ] + } + } + + Method [ public method writeDateTimeWithRef ] { + + - Parameters [1] { + Parameter #0 [ DateTime $dt ] + } + } + + Method [ public method writeArray ] { + + - Parameters [1] { + Parameter #0 [ array $arr ] + } + } + + Method [ public method writeAssocArray ] { + + - Parameters [1] { + Parameter #0 [ array $arr ] + } + } + + Method [ public method writeList ] { + + - Parameters [1] { + Parameter #0 [ Traversable $list ] + } + } + + Method [ public method writeListWithRef ] { + + - Parameters [1] { + Parameter #0 [ Traversable $list ] + } + } + + Method [ public method writeMap ] { + + - Parameters [1] { + Parameter #0 [ SplObjectStorage $map ] + } + } + + Method [ public method writeMapWithRef ] { + + - Parameters [1] { + Parameter #0 [ SplObjectStorage $map ] + } + } + + Method [ public method writeStdClass ] { + + - Parameters [1] { + Parameter #0 [ stdClass $obj ] + } + } + + Method [ public method writeStdClassWithRef ] { + + - Parameters [1] { + Parameter #0 [ stdClass $obj ] + } + } + + Method [ public method writeObject ] { + + - Parameters [1] { + Parameter #0 [ NULL $obj ] + } + } + + Method [ public method writeObjectWithRef ] { + + - Parameters [1] { + Parameter #0 [ NULL $obj ] + } + } + + Method [ public method reset ] { + + - Parameters [0] { + } + } + } + } + + Class [ class HproseRawReader ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { + Method [ public method __construct ] { + + - Parameters [0] { + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ public method readRaw ] { + + - Parameters [0] { + } + } + } + } + + Class [ class HproseReader extends HproseRawReader ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [37] { + Method [ public method __construct ] { + + - Parameters [2] { + Parameter #0 [ HproseBytesIO $stream ] + Parameter #1 [ $simple ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ public method unserialize ] { + + - Parameters [0] { + } + } + + Method [ public method checkTag ] { + + - Parameters [2] { + Parameter #0 [ $expectTag ] + Parameter #1 [ $tag ] + } + } + + Method [ public method checkTags ] { + + - Parameters [2] { + Parameter #0 [ $expectTags ] + Parameter #1 [ $tag ] + } + } + + Method [ public method readIntegerWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readInteger ] { + + - Parameters [0] { + } + } + + Method [ public method readLongWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readLong ] { + + - Parameters [0] { + } + } + + Method [ public method readDoubleWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readDouble ] { + + - Parameters [0] { + } + } + + Method [ public method readNaN ] { + + - Parameters [0] { + } + } + + Method [ public method readInfinityWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readInfinity ] { + + - Parameters [0] { + } + } + + Method [ public method readNull ] { + + - Parameters [0] { + } + } + + Method [ public method readEmpty ] { + + - Parameters [0] { + } + } + + Method [ public method readBoolean ] { + + - Parameters [0] { + } + } + + Method [ public method readDateWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readDate ] { + + - Parameters [0] { + } + } + + Method [ public method readTimeWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readTime ] { + + - Parameters [0] { + } + } + + Method [ public method readBytesWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readBytes ] { + + - Parameters [0] { + } + } + + Method [ public method readUTF8CharWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readUTF8Char ] { + + - Parameters [0] { + } + } + + Method [ public method readStringWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readString ] { + + - Parameters [0] { + } + } + + Method [ public method readGuidWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readGuid ] { + + - Parameters [0] { + } + } + + Method [ public method readListWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readList ] { + + - Parameters [0] { + } + } + + Method [ public method readMapWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readMap ] { + + - Parameters [0] { + } + } + + Method [ public method readObjectWithoutTag ] { + + - Parameters [0] { + } + } + + Method [ public method readObject ] { + + - Parameters [0] { + } + } + + Method [ public method reset ] { + + - Parameters [0] { + } + } + + Method [ public method readRaw ] { + + - Parameters [0] { + } + } + } + } + + Class [ class HproseFormatter ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [2] { + Method [ static public method serialize ] { + + - Parameters [2] { + Parameter #0 [ $val ] + Parameter #1 [ $simple ] + } + } + + Method [ static public method unserialize ] { + + - Parameters [2] { + Parameter #0 [ $data ] + Parameter #1 [ $simple ] + } + } + } + + - Properties [0] { + } + + - Methods [0] { + } + } + + Class [ class HproseResultMode ] { + + - Constants [4] { + Constant [ integer Normal ] { 0 } + Constant [ integer Serialized ] { 1 } + Constant [ integer Raw ] { 2 } + Constant [ integer RawWithEndTag ] { 3 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } + } + + Interface [ interface HproseFilter ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ abstract public method inputFilter ] { + + - Parameters [2] { + Parameter #0 [ $data ] + Parameter #1 [ $context ] + } + } + + Method [ abstract public method outputFilter ] { + + - Parameters [2] { + Parameter #0 [ $data ] + Parameter #1 [ $context ] + } + } + } + } + + Class [ class HproseProxy ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [4] { + Method [ public method __construct ] { + + - Parameters [2] { + Parameter #0 [ HproseClient $client ] + Parameter #1 [ $ns ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ $name ] + Parameter #1 [ array $args ] + } + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ $name ] + } + } + } + } + + Class [ abstract class HproseClient extends HproseProxy ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ protected $url ] + } + + - Methods [15] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ $url ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ protected method sendAndReceive ] { + + - Parameters [1] { + Parameter #0 [ $request ] + } + } + + Method [ protected method asyncSendAndReceive ] { + + - Parameters [2] { + Parameter #0 [ $request ] + Parameter #1 [ $use ] + } + } + + Method [ protected method sendAndReceiveCallback ] { + + - Parameters [3] { + Parameter #0 [ $response ] + Parameter #1 [ Exception or NULL $err ] + Parameter #2 [ array $use ] + } + } + + Method [ public method useService ] { + + - Parameters [2] { + Parameter #0 [ $url ] + Parameter #1 [ $ns ] + } + } + + Method [ public method invoke ] { + + - Parameters [6] { + Parameter #0 [ $name ] + Parameter #1 [ array &$args ] + Parameter #2 [ $byref ] + Parameter #3 [ $mode ] + Parameter #4 [ $simple ] + Parameter #5 [ $callback ] + } + } + + Method [ public method getFilter ] { + + - Parameters [0] { + } + } + + Method [ public method setFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter or NULL $filter ] + } + } + + Method [ public method addFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter $filter ] + } + } + + Method [ public method removeFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter $filter ] + } + } + + Method [ public method getSimple ] { + + - Parameters [0] { + } + } + + Method [ public method setSimple ] { + + - Parameters [1] { + Parameter #0 [ $simple ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ $name ] + Parameter #1 [ array $args ] + } + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ $name ] + } + } + } + } + + Class [ abstract class HproseService ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [5] { + Property [ protected $debug ] + Property [ protected $error_types ] + Property [ public $onBeforeInvoke ] + Property [ public $onAfterInvoke ] + Property [ public $onSendError ] + } + + - Methods [25] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ $url ] + } + } + + Method [ public method __destruct ] { + + - Parameters [0] { + } + } + + Method [ protected method getErrorTypeString ] { + + - Parameters [1] { + Parameter #0 [ $errno ] + } + } + + Method [ protected method sendError ] { + + - Parameters [2] { + Parameter #0 [ $error ] + Parameter #1 [ $context ] + } + } + + Method [ protected method doInvoke ] { + + - Parameters [2] { + Parameter #0 [ HproseBytesIO $input ] + Parameter #1 [ $context ] + } + } + + Method [ protected method doFunctionList ] { + + - Parameters [1] { + Parameter #0 [ $context ] + } + } + + Method [ public method isDebugEnabled ] { + + - Parameters [0] { + } + } + + Method [ public method setDebugEnabled ] { + + - Parameters [1] { + Parameter #0 [ $enable ] + } + } + + Method [ public method getErrorTypes ] { + + - Parameters [0] { + } + } + + Method [ public method setErrorTypes ] { + + - Parameters [1] { + Parameter #0 [ $error_types ] + } + } + + Method [ public method getFilter ] { + + - Parameters [0] { + } + } + + Method [ public method setFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter or NULL $filter ] + } + } + + Method [ public method addFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter $filter ] + } + } + + Method [ public method removeFilter ] { + + - Parameters [1] { + Parameter #0 [ HproseFilter $filter ] + } + } + + Method [ public method getSimple ] { + + - Parameters [0] { + } + } + + Method [ public method setSimple ] { + + - Parameters [1] { + Parameter #0 [ $simple ] + } + } + + Method [ public method defaultHandle ] { + + - Parameters [2] { + Parameter #0 [ $request ] + Parameter #1 [ $context ] + } + } + + Method [ public method addMissingFunction ] { + + - Parameters [3] { + Parameter #0 [ $func ] + Parameter #1 [ $mode ] + Parameter #2 [ $simple ] + } + } + + Method [ public method addFunction ] { + + - Parameters [4] { + Parameter #0 [ $func ] + Parameter #1 [ $alias ] + Parameter #2 [ $mode ] + Parameter #3 [ $simple ] + } + } + + Method [ public method addFunctions ] { + + - Parameters [4] { + Parameter #0 [ array $funcs ] + Parameter #1 [ array or NULL $aliases ] + Parameter #2 [ $mode ] + Parameter #3 [ $simple ] + } + } + + Method [ public method addMethod ] { + + - Parameters [5] { + Parameter #0 [ $methodname ] + Parameter #1 [ $belongto ] + Parameter #2 [ $alias ] + Parameter #3 [ $mode ] + Parameter #4 [ $simple ] + } + } + + Method [ public method addMethods ] { + + - Parameters [5] { + Parameter #0 [ array $methods ] + Parameter #1 [ $belongto ] + Parameter #2 [ $aliases ] + Parameter #3 [ $mode ] + Parameter #4 [ $simple ] + } + } + + Method [ public method addInstanceMethods ] { + + - Parameters [5] { + Parameter #0 [ $obj ] + Parameter #1 [ $class_name ] + Parameter #2 [ $alias_prefix ] + Parameter #3 [ $mode ] + Parameter #4 [ $simple ] + } + } + + Method [ public method addClassMethods ] { + + - Parameters [5] { + Parameter #0 [ $class_name ] + Parameter #1 [ $exec_class ] + Parameter #2 [ $alias_prefix ] + Parameter #3 [ $mode ] + Parameter #4 [ $simple ] + } + } + + Method [ public method add ] { + + - Parameters [3] { + Parameter #0 [ $arg1 ] + Parameter #1 [ $arg2 ] + Parameter #2 [ $arg3 ] + } + } + } + } + } +} + diff --git a/php-pecl-hprose.spec b/php-pecl-hprose.spec new file mode 100644 index 0000000..1bb3ae0 --- /dev/null +++ b/php-pecl-hprose.spec @@ -0,0 +1,229 @@ +# spec file for php-pecl-hprose +# +# Copyright (c) 2015 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%{?scl: %scl_package php-pecl-hprose} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?__pecl: %global __pecl %{_bindir}/pecl} +%{!?__php: %global __php %{_bindir}/php} + +%global with_zts 0%{?__ztsphp:1} +%global pecl_name hprose +%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%if "%{php_version}" < "5.6" +%global ini_name %{pecl_name}.ini +%else +%global ini_name 40-%{pecl_name}.ini +%endif + +Summary: Hprose for PHP. +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 1.0.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: MIT +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: %{?scl_prefix}php-devel > 5.3 +BuildRequires: %{?scl_prefix}php-pear + +Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} +Requires: %{?scl_prefix}php(api) = %{php_core_api} +%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} + +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} + +%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} +# Other third party repo stuff +Obsoletes: php53-pecl-%{pecl_name} <= %{version} +Obsoletes: php53u-pecl-%{pecl_name} <= %{version} +Obsoletes: php54-pecl-%{pecl_name} <= %{version} +Obsoletes: php54w-pecl-%{pecl_name} <= %{version} +%if "%{php_version}" > "5.5" +Obsoletes: php55u-pecl-%{pecl_name} <= %{version} +Obsoletes: php55w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} <= %{version} +Obsoletes: php56w-pecl-%{pecl_name} <= %{version} +%endif +%endif + +%if 0%{?fedora} < 20 && 0%{?rhel} < 7 +# Filter shared private +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +%endif + + +%description +Hprose is a High Performance Remote Object Service Engine. + +It is a modern, lightweight, cross-language, cross-platform, object-oriented, +high performance, remote dynamic communication middleware. It is not only +easy to use, but powerful. You just need a little time to learn, then you +can use it to easily construct cross language cross platform distributed +application system. + +Hprose supports many programming languages. Through Hprose, You can +conveniently and efficiently intercommunicate between those programming +languages. + +This project is the implementation of Hprose for PHP. + + +%prep +%setup -q -c +mv %{pecl_name}-%{version} NTS + +# Don't install tests +sed -e 's/role="test"/role="src"/' \ + -i package.xml + +cd NTS +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_HPROSE_VERSION/{s/.* "//;s/".*$//;p}' php_hprose.h) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi +cd .. + +%if %{with_zts} +# Duplicate source tree for NTS / ZTS build +cp -pr NTS ZTS +%endif + +# Create configuration file +cat > %{ini_name} << 'EOF' +; Enable '%{pecl_name}' extension module +extension=%{pecl_name}.so +EOF + + +%build +cd NTS +%{_bindir}/phpize +%configure \ + --enable-hprose \ + --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ + --enable-hprose \ + --with-php-config=%{_bindir}/zts-php-config +make %{?_smp_mflags} +%endif + + +%install +rm -rf %{buildroot} + +make -C NTS install INSTALL_ROOT=%{buildroot} + +# install config file +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} + +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Documentation +for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%check +cd NTS +: Minimal load test for NTS extension +%{__php} --no-php-ini \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%if %{with_tests} +: Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php --show-diff +%endif + +%if %{with_zts} +cd ../ZTS +: Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%if %{with_tests} +: Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{_bindir}/zts-php -n run-tests.php --show-diff +%endif +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc %{pecl_docdir}/%{pecl_name} +%{?_licensedir:%license NTS/LICENSE.md} + +%{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Sat Feb 14 2015 Remi Collet - 1.0.0-1 +- initial package, version 1.0.0 (stable) +- open https://github.com/hprose/hprose-pecl/issues/1 - php 7 +- open https://github.com/hprose/hprose-pecl/issues/2 - i386 \ No newline at end of file -- cgit