diff options
| author | Remi Collet <fedora@famillecollet.com> | 2015-05-14 18:43:16 +0200 | 
|---|---|---|
| committer | Remi Collet <fedora@famillecollet.com> | 2015-05-14 18:43:16 +0200 | 
| commit | bb577d2a9bd1971b65f739194f5c15315306cc39 (patch) | |
| tree | d4d35a68f51257072e29679d9cfee9bf6a584393 | |
php-pecl-rdkafka: 0.0.2 (alpha) - new package
| -rw-r--r-- | LICENSE | 21 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | REFLECTION | 799 | ||||
| -rw-r--r-- | php-pecl-rdkafka.spec | 205 | 
4 files changed, 1029 insertions, 0 deletions
@@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Arnaud Le Blanc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. 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..9a0a17f --- /dev/null +++ b/REFLECTION @@ -0,0 +1,799 @@ +Extension [ <persistent> extension #138 rdkafka version 0.0.2 ] { + +  - Constants [43] { +    Constant [ integer RD_KAFKA_CONSUMER ] { 1 } +    Constant [ integer RD_KAFKA_OFFSET_BEGINNING ] { -2 } +    Constant [ integer RD_KAFKA_OFFSET_END ] { -1 } +    Constant [ integer RD_KAFKA_OFFSET_STORED ] { -1000 } +    Constant [ integer RD_KAFKA_PARTITION_UA ] { -1 } +    Constant [ integer RD_KAFKA_PRODUCER ] { 0 } +    Constant [ integer RD_KAFKA_VERSION ] { 525824 } +    Constant [ integer RD_KAFKA_RESP_ERR__BEGIN ] { -200 } +    Constant [ integer RD_KAFKA_RESP_ERR__BAD_MSG ] { -199 } +    Constant [ integer RD_KAFKA_RESP_ERR__BAD_COMPRESSION ] { -198 } +    Constant [ integer RD_KAFKA_RESP_ERR__DESTROY ] { -197 } +    Constant [ integer RD_KAFKA_RESP_ERR__FAIL ] { -196 } +    Constant [ integer RD_KAFKA_RESP_ERR__TRANSPORT ] { -195 } +    Constant [ integer RD_KAFKA_RESP_ERR__CRIT_SYS_RESOURCE ] { -194 } +    Constant [ integer RD_KAFKA_RESP_ERR__RESOLVE ] { -193 } +    Constant [ integer RD_KAFKA_RESP_ERR__MSG_TIMED_OUT ] { -192 } +    Constant [ integer RD_KAFKA_RESP_ERR__PARTITION_EOF ] { -191 } +    Constant [ integer RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ] { -190 } +    Constant [ integer RD_KAFKA_RESP_ERR__FS ] { -189 } +    Constant [ integer RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC ] { -188 } +    Constant [ integer RD_KAFKA_RESP_ERR__ALL_BROKERS_DOWN ] { -187 } +    Constant [ integer RD_KAFKA_RESP_ERR__INVALID_ARG ] { -186 } +    Constant [ integer RD_KAFKA_RESP_ERR__TIMED_OUT ] { -185 } +    Constant [ integer RD_KAFKA_RESP_ERR__QUEUE_FULL ] { -184 } +    Constant [ integer RD_KAFKA_RESP_ERR__ISR_INSUFF ] { -183 } +    Constant [ integer RD_KAFKA_RESP_ERR__END ] { -100 } +    Constant [ integer RD_KAFKA_RESP_ERR_UNKNOWN ] { -1 } +    Constant [ integer RD_KAFKA_RESP_ERR_NO_ERROR ] { 0 } +    Constant [ integer RD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGE ] { 1 } +    Constant [ integer RD_KAFKA_RESP_ERR_INVALID_MSG ] { 2 } +    Constant [ integer RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART ] { 3 } +    Constant [ integer RD_KAFKA_RESP_ERR_INVALID_MSG_SIZE ] { 4 } +    Constant [ integer RD_KAFKA_RESP_ERR_LEADER_NOT_AVAILABLE ] { 5 } +    Constant [ integer RD_KAFKA_RESP_ERR_NOT_LEADER_FOR_PARTITION ] { 6 } +    Constant [ integer RD_KAFKA_RESP_ERR_REQUEST_TIMED_OUT ] { 7 } +    Constant [ integer RD_KAFKA_RESP_ERR_BROKER_NOT_AVAILABLE ] { 8 } +    Constant [ integer RD_KAFKA_RESP_ERR_REPLICA_NOT_AVAILABLE ] { 9 } +    Constant [ integer RD_KAFKA_RESP_ERR_MSG_SIZE_TOO_LARGE ] { 10 } +    Constant [ integer RD_KAFKA_RESP_ERR_STALE_CTRL_EPOCH ] { 11 } +    Constant [ integer RD_KAFKA_RESP_ERR_OFFSET_METADATA_TOO_LARGE ] { 12 } +    Constant [ integer RD_KAFKA_CONF_UNKNOWN ] { -2 } +    Constant [ integer RD_KAFKA_CONF_INVALID ] { -1 } +    Constant [ integer RD_KAFKA_CONF_OK ] { 0 } +  } + +  - Functions { +    Function [ <internal:rdkafka> function rd_kafka_err2str ] { + +      - Parameters [1] { +        Parameter #0 [ <required> $err ] +      } +    } +    Function [ <internal:rdkafka> function rd_kafka_errno2err ] { + +      - Parameters [1] { +        Parameter #0 [ <required> $errnox ] +      } +    } +    Function [ <internal:rdkafka> function rd_kafka_errno ] { + +      - Parameters [1] { +        Parameter #0 [ <optional> $errnox ] +      } +    } +    Function [ <internal:rdkafka> function rd_kafka_offset_tail ] { + +      - Parameters [0] { +      } +    } +    Function [ <internal:rdkafka> function rd_kafka_thread_cnt ] { + +      - Parameters [0] { +      } +    } +  } + +  - Classes [16] { +    Class [ <internal:rdkafka> abstract class RdKafka ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [7] { +        Method [ <internal:rdkafka> public method addBrokers ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $broker_list ] +          } +        } + +        Method [ <internal:rdkafka> public method metadata ] { + +          - Parameters [3] { +            Parameter #0 [ <required> $all_topics ] +            Parameter #1 [ <optional> $only_topic ] +            Parameter #2 [ <optional> $timeout_ms ] +          } +        } + +        Method [ <internal:rdkafka> public method setLogLevel ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $level ] +          } +        } + +        Method [ <internal:rdkafka> public method newQueue ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method newTopic ] { + +          - Parameters [2] { +            Parameter #0 [ <required> $topic_name ] +            Parameter #1 [ <optional> $topic_conf ] +          } +        } + +        Method [ <internal:rdkafka> public method outqLen ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method poll ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $timeout_ms ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Consumer extends RdKafka ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [8] { +        Method [ <internal:rdkafka, ctor> public method __construct ] { + +          - Parameters [2] { +            Parameter #0 [ <optional> $conf ] +            Parameter #1 [ <optional> &$errstr ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method addBrokers ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $broker_list ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method metadata ] { + +          - Parameters [3] { +            Parameter #0 [ <required> $all_topics ] +            Parameter #1 [ <optional> $only_topic ] +            Parameter #2 [ <optional> $timeout_ms ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method setLogLevel ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $level ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method newQueue ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method newTopic ] { + +          - Parameters [2] { +            Parameter #0 [ <required> $topic_name ] +            Parameter #1 [ <optional> $topic_conf ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method outqLen ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method poll ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $timeout_ms ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Producer extends RdKafka ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [8] { +        Method [ <internal:rdkafka, ctor> public method __construct ] { + +          - Parameters [2] { +            Parameter #0 [ <optional> $conf ] +            Parameter #1 [ <optional> &$errstr ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method addBrokers ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $broker_list ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method metadata ] { + +          - Parameters [3] { +            Parameter #0 [ <required> $all_topics ] +            Parameter #1 [ <optional> $only_topic ] +            Parameter #2 [ <optional> $timeout_ms ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method setLogLevel ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $level ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method newQueue ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method newTopic ] { + +          - Parameters [2] { +            Parameter #0 [ <required> $topic_name ] +            Parameter #1 [ <optional> $topic_conf ] +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method outqLen ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, inherits RdKafka> public method poll ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $timeout_ms ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Conf ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [3] { +        Method [ <internal:rdkafka, ctor> public method __construct ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method dump ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method set ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\TopicConf ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [3] { +        Method [ <internal:rdkafka, ctor> public method __construct ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method dump ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method set ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> abstract class RdKafka\Topic ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [0] { +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\ConsumerTopic extends RdKafka\Topic ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [5] { +        Method [ <internal:rdkafka, ctor> private method __construct ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method consumeQueueStart ] { + +          - Parameters [3] { +            Parameter #0 [ <required> $partition ] +            Parameter #1 [ <required> $offset ] +            Parameter #2 [ <required> $queue ] +          } +        } + +        Method [ <internal:rdkafka> public method consumeStart ] { + +          - Parameters [2] { +            Parameter #0 [ <required> $partition ] +            Parameter #1 [ <required> $offset ] +          } +        } + +        Method [ <internal:rdkafka> public method consumeStop ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $partition ] +          } +        } + +        Method [ <internal:rdkafka> public method consume ] { + +          - Parameters [2] { +            Parameter #0 [ <required> $partition ] +            Parameter #1 [ <required> $timeout_ms ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\ProducerTopic extends RdKafka\Topic ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [2] { +        Method [ <internal:rdkafka, ctor> private method __construct ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method produce ] { + +          - Parameters [4] { +            Parameter #0 [ <required> $partition ] +            Parameter #1 [ <required> $msgflags ] +            Parameter #2 [ <required> $payload ] +            Parameter #3 [ <optional> $key ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Message ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [6] { +        Property [ <default> public $err ] +        Property [ <default> public $topic_name ] +        Property [ <default> public $partition ] +        Property [ <default> public $payload ] +        Property [ <default> public $key ] +        Property [ <default> public $offset ] +      } + +      - Methods [1] { +        Method [ <internal:rdkafka> public method errstr ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Queue ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [2] { +        Method [ <internal:rdkafka, ctor> private method __construct ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method consume ] { + +          - Parameters [1] { +            Parameter #0 [ <required> $timeout_ms ] +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Exception extends Exception ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [4] { +        Property [ <default> protected $message ] +        Property [ <default> protected $code ] +        Property [ <default> protected $file ] +        Property [ <default> protected $line ] +      } + +      - Methods [9] { +        Method [ <internal:Core, inherits Exception, ctor> <visibility error> method __construct ] { + +          - Parameters [3] { +            Parameter #0 [ <optional> $message ] +            Parameter #1 [ <optional> $code ] +            Parameter #2 [ <optional> $previous ] +          } +        } + +        Method [ <internal:Core, inherits Exception> final public method getMessage ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getCode ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getFile ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getLine ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getTrace ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getPrevious ] { +        } + +        Method [ <internal:Core, inherits Exception> final public method getTraceAsString ] { +        } + +        Method [ <internal:Core, inherits Exception> public method __toString ] { +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Metadata ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [4] { +        Method [ <internal:rdkafka> public method getOrigBrokerId ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getOrigBrokerName ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getBrokers ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getTopics ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Metadata\Topic ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [3] { +        Method [ <internal:rdkafka> public method getTopic ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getPartitions ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getErr ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Metadata\Broker ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [3] { +        Method [ <internal:rdkafka> public method getId ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getHost ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getPort ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> class RdKafka\Metadata\Partition ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [5] { +        Method [ <internal:rdkafka> public method getId ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getErr ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getLeader ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getReplicas ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka> public method getIsrs ] { + +          - Parameters [0] { +          } +        } +      } +    } + +    Class [ <internal:rdkafka> <iterateable> class RdKafka\Metadata\Collection implements Countable, Iterator, Traversable ] { + +      - Constants [0] { +      } + +      - Static properties [0] { +      } + +      - Static methods [0] { +      } + +      - Properties [0] { +      } + +      - Methods [6] { +        Method [ <internal:rdkafka, prototype Countable> public method count ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, prototype Iterator> public method current ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, prototype Iterator> public method key ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, prototype Iterator> public method next ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, prototype Iterator> public method rewind ] { + +          - Parameters [0] { +          } +        } + +        Method [ <internal:rdkafka, prototype Iterator> public method valid ] { + +          - Parameters [0] { +          } +        } +      } +    } +  } +} + diff --git a/php-pecl-rdkafka.spec b/php-pecl-rdkafka.spec new file mode 100644 index 0000000..79c9bac --- /dev/null +++ b/php-pecl-rdkafka.spec @@ -0,0 +1,205 @@ +# remirepo/fedora spec file for php-pecl-rdkafka +# +# 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-rdkafka} +%{!?php_inidir:  %global php_inidir  %{_sysconfdir}/php.d} +%{!?__pecl:      %global __pecl      %{_bindir}/pecl} +%{!?__php:       %global __php       %{_bindir}/php} + +# https://github.com/arnaud-lb/php-rdkafka/issues/2 +%global with_zts   0 +%global pecl_name  rdkafka +%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:        Kafka client based on librdkafka +Name:           %{?scl_prefix}php-pecl-%{pecl_name} +Version:        0.0.2 +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 +# https://github.com/arnaud-lb/php-rdkafka/issues/3 +Source1:        https://raw.githubusercontent.com/arnaud-lb/php-rdkafka/master/LICENSE + +BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires:  librdkafka-devel +BuildRequires:  %{?scl_prefix}php-devel > 5.4 +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 +This extension is a librdkafka binding providing a working client +for Kafka 0.8. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection}. + + +%prep +%setup -q -c +mv %{pecl_name}-%{version} NTS + +# Don't install tests +sed -e '/role="test"/d' -i package.xml + +cd NTS +cp %{SOURCE1} LICENSE + +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_RDKAFKA_VERSION/{s/.* "//;s/".*$//;p}' php_rdkafka.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 \ +    --with-php-config=%{_bindir}/php-config \ +    --with-rdkafka +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ +    --with-php-config=%{_bindir}/zts-php-config \ +    --with-rdkafka +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 LICENSE $(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_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} +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc %{pecl_docdir}/%{pecl_name} +%{?_licensedir:%license NTS/LICENSE} +%{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 +* Thu May 14 2015 Remi Collet <remi@fedoraproject.org> - 0.0.2-1 +- initial package, version 0.0.2 (alpha)
\ No newline at end of file  | 
