From 83597c973f54c4ba064510cdbe7b4a576e9c5253 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 14 Nov 2014 09:42:41 +0100 Subject: php-pecl-ares: 0.8.0 (beta) - New package --- Makefile | 4 + REFLECTION | 183 ++++++++++++++++++++++++++++++++++++++++++++ php-pecl-ares.spec | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 405 insertions(+) create mode 100644 Makefile create mode 100644 REFLECTION create mode 100644 php-pecl-ares.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..dd9380f --- /dev/null +++ b/REFLECTION @@ -0,0 +1,183 @@ +Extension [ extension #75 ares version 0.8.0 ] { + + - Constants [110] { + Constant [ integer ARES_VERSION ] { 68096 } + Constant [ integer ARES_SUCCESS ] { 0 } + Constant [ integer ARES_ENODATA ] { 1 } + Constant [ integer ARES_EFORMERR ] { 2 } + Constant [ integer ARES_ESERVFAIL ] { 3 } + Constant [ integer ARES_ENOTFOUND ] { 4 } + Constant [ integer ARES_ENOTIMP ] { 5 } + Constant [ integer ARES_EREFUSED ] { 6 } + Constant [ integer ARES_EBADQUERY ] { 7 } + Constant [ integer ARES_EBADNAME ] { 8 } + Constant [ integer ARES_EBADFAMILY ] { 9 } + Constant [ integer ARES_EBADRESP ] { 10 } + Constant [ integer ARES_ECONNREFUSED ] { 11 } + Constant [ integer ARES_ETIMEOUT ] { 12 } + Constant [ integer ARES_EOF ] { 13 } + Constant [ integer ARES_EFILE ] { 14 } + Constant [ integer ARES_ENOMEM ] { 15 } + Constant [ integer ARES_EDESTRUCTION ] { 16 } + Constant [ integer ARES_EBADSTR ] { 17 } + Constant [ integer ARES_EBADFLAGS ] { 18 } + Constant [ integer ARES_ENONAME ] { 19 } + Constant [ integer ARES_EBADHINTS ] { 20 } + Constant [ integer ARES_ENOTINITIALIZED ] { 21 } + Constant [ integer ARES_ELOADIPHLPAPI ] { 22 } + Constant [ integer ARES_EADDRGETNETWORKPARAMS ] { 23 } + Constant [ integer ARES_ECANCELLED ] { 24 } + Constant [ integer ARES_FLAG_USEVC ] { 1 } + Constant [ integer ARES_FLAG_PRIMARY ] { 2 } + Constant [ integer ARES_FLAG_IGNTC ] { 4 } + Constant [ integer ARES_FLAG_NORECURSE ] { 8 } + Constant [ integer ARES_FLAG_STAYOPEN ] { 16 } + Constant [ integer ARES_FLAG_NOSEARCH ] { 32 } + Constant [ integer ARES_FLAG_NOALIASES ] { 64 } + Constant [ integer ARES_FLAG_NOCHECKRESP ] { 128 } + Constant [ integer ARES_FLAG_EDNS ] { 256 } + Constant [ integer ARES_AF_INET ] { 2 } + Constant [ integer ARES_AF_INET6 ] { 10 } + Constant [ integer ARES_NI_NOFQDN ] { 1 } + Constant [ integer ARES_NI_NUMERICHOST ] { 2 } + Constant [ integer ARES_NI_NAMEREQD ] { 4 } + Constant [ integer ARES_NI_NUMERICSERV ] { 8 } + Constant [ integer ARES_NI_DGRAM ] { 16 } + Constant [ integer ARES_NI_TCP ] { 0 } + Constant [ integer ARES_NI_UDP ] { 16 } + Constant [ integer ARES_NI_SCTP ] { 32 } + Constant [ integer ARES_NI_DCCP ] { 64 } + Constant [ integer ARES_NI_NUMERICSCOPE ] { 128 } + Constant [ integer ARES_NI_LOOKUPHOST ] { 256 } + Constant [ integer ARES_NI_LOOKUPSERVICE ] { 512 } + Constant [ integer ARES_NI_IDN ] { 1024 } + Constant [ integer ARES_NI_IDN_ALLOW_UNASSIGNED ] { 2048 } + Constant [ integer ARES_AI_CANONNAME ] { 1 } + Constant [ integer ARES_AI_NUMERICHOST ] { 2 } + Constant [ integer ARES_AI_PASSIVE ] { 4 } + Constant [ integer ARES_AI_NUMERICSERV ] { 8 } + Constant [ integer ARES_AI_ALL ] { 32 } + Constant [ integer ARES_AI_ADDRCONFIG ] { 64 } + Constant [ integer ARES_AI_IDN ] { 1024 } + Constant [ integer ARES_AI_IDN_ALLOW_UNASSIGNED ] { 2048 } + Constant [ integer ARES_AI_CANONIDN ] { 8192 } + Constant [ integer ARES_AI_MASK ] { 127 } + Constant [ integer ARES_GETSOCK_MAXNUM ] { 16 } + Constant [ integer ARES_T_A ] { 1 } + Constant [ integer ARES_T_NS ] { 2 } + Constant [ integer ARES_T_MD ] { 3 } + Constant [ integer ARES_T_MF ] { 4 } + Constant [ integer ARES_T_CNAME ] { 5 } + Constant [ integer ARES_T_SOA ] { 6 } + Constant [ integer ARES_T_MB ] { 7 } + Constant [ integer ARES_T_MG ] { 8 } + Constant [ integer ARES_T_MR ] { 9 } + Constant [ integer ARES_T_NULL ] { 10 } + Constant [ integer ARES_T_WKS ] { 11 } + Constant [ integer ARES_T_PTR ] { 12 } + Constant [ integer ARES_T_HINFO ] { 13 } + Constant [ integer ARES_T_MINFO ] { 14 } + Constant [ integer ARES_T_MX ] { 15 } + Constant [ integer ARES_T_TXT ] { 16 } + Constant [ integer ARES_T_RP ] { 17 } + Constant [ integer ARES_T_AFSDB ] { 18 } + Constant [ integer ARES_T_X25 ] { 19 } + Constant [ integer ARES_T_ISDN ] { 20 } + Constant [ integer ARES_T_RT ] { 21 } + Constant [ integer ARES_T_NSAP ] { 22 } + Constant [ integer ARES_T_NSAP_PTR ] { 23 } + Constant [ integer ARES_T_SIG ] { 24 } + Constant [ integer ARES_T_KEY ] { 25 } + Constant [ integer ARES_T_PX ] { 26 } + Constant [ integer ARES_T_GPOS ] { 27 } + Constant [ integer ARES_T_AAAA ] { 28 } + Constant [ integer ARES_T_LOC ] { 29 } + Constant [ integer ARES_T_NXT ] { 30 } + Constant [ integer ARES_T_EID ] { 31 } + Constant [ integer ARES_T_NIMLOC ] { 32 } + Constant [ integer ARES_T_SRV ] { 33 } + Constant [ integer ARES_T_ATMA ] { 34 } + Constant [ integer ARES_T_NAPTR ] { 35 } + Constant [ integer ARES_T_A6 ] { 38 } + Constant [ integer ARES_T_DNAME ] { 39 } + Constant [ integer ARES_T_TSIG ] { 250 } + Constant [ integer ARES_T_IXFR ] { 251 } + Constant [ integer ARES_T_AXFR ] { 252 } + Constant [ integer ARES_T_MAILB ] { 253 } + Constant [ integer ARES_T_MAILA ] { 254 } + Constant [ integer ARES_T_ANY ] { 255 } + Constant [ integer ARES_C_IN ] { 1 } + Constant [ integer ARES_C_CHAOS ] { 3 } + Constant [ integer ARES_C_HS ] { 4 } + Constant [ integer ARES_C_NONE ] { 254 } + Constant [ integer ARES_C_ANY ] { 255 } + } + + - Functions { + Function [ function ares_version ] { + } + Function [ function ares_init ] { + } + Function [ function ares_destroy ] { + } + Function [ function ares_strerror ] { + } + Function [ function ares_cancel ] { + } + Function [ function ares_search ] { + } + Function [ function ares_query ] { + } + Function [ function ares_send ] { + } + Function [ function ares_mkquery ] { + } + Function [ function ares_gethostbyname ] { + } + Function [ function ares_gethostbyaddr ] { + } + Function [ function ares_getnameinfo ] { + } + Function [ function ares_result ] { + + - Parameters [3] { + Parameter #0 [ $param0 ] + Parameter #1 [ &$param1 ] + Parameter #2 [ &$param2 ] + } + } + Function [ function ares_packet ] { + } + Function [ function ares_process_all ] { + } + Function [ function ares_process_once ] { + } + Function [ function ares_process ] { + } + Function [ function ares_select ] { + + - Parameters [3] { + Parameter #0 [ &$param0 ] + Parameter #1 [ &$param1 ] + Parameter #2 [ $param2 ] + } + } + Function [ function ares_fds ] { + + - Parameters [3] { + Parameter #0 [ $param0 ] + Parameter #1 [ &$param1 ] + Parameter #2 [ &$param2 ] + } + } + Function [ function ares_timeout ] { + } + Function [ function ares_set_local_dev ] { + } + Function [ function ares_set_local_ip4 ] { + } + Function [ function ares_set_local_ip6 ] { + } + } +} + diff --git a/php-pecl-ares.spec b/php-pecl-ares.spec new file mode 100644 index 0000000..bdc0948 --- /dev/null +++ b/php-pecl-ares.spec @@ -0,0 +1,218 @@ +# spec file for php-pecl-ares +# +# Copyright (c) 2014 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# +%{?scl: %scl_package php-pecl-judy} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?php_incldir: %global php_incldir %{_includedir}/php} +%{!?__pecl: %global __pecl %{_bindir}/pecl} +%{!?__php: %global __php %{_bindir}/php} + +%global with_zts 0%{?__ztsphp:1} +%global pecl_name ares +#global versuf -beta +%if "%{php_version}" < "5.6" +%global ini_name %{pecl_name}.ini +%else +%global ini_name 40-%{pecl_name}.ini +%endif +# Test suite disable by default as requires online +%global with_tests %{?_with_tests:1}%{!?_with_tests:0} + +Summary: Asynchronous Resolver +Name: %{?scl_prefix}php-pecl-ares +Version: 0.8.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: PHP +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 +BuildRequires: %{?scl_prefix}php-pear +BuildRequires: c-ares-devel + +Requires(post): %{__pecl} +Requires(postun): %{__pecl} +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 +Binding for the c-ares (CURL) library. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection}. + + +%prep +%setup -q -c + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' -i package.xml + +mv %{pecl_name}-%{version} NTS + +cd NTS + +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_ARES_VERSION/{s/.* "//;s/".*$//;p}' php_ares.h) +if test "x${extver}" != "x%{version}%{?versuf}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}%{?versuf}. + exit 1 +fi +cd .. + +%if %{with_zts} +# Duplicate source tree for NTS / ZTS build +cp -pr NTS ZTS +%endif + +# Create configuration file +cat << 'EOF' | tee %{ini_name} +; Enable %{summary} extension module +extension=%{pecl_name}.so +EOF + + +%build +cd NTS +%{_bindir}/phpize +%configure \ + --with-libdir=%{_lib} \ + --with-php-config=%{_bindir}/php-config + +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ + --with-libdir=%{_lib} \ + --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 + + +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%check +: 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} +cd NTS +: Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php +%endif + +%if %{with_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} +cd ../ZTS +: Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php +%endif +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{?_licensedir:%license NTS/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{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 +* Fri Nov 14 2014 Remi Collet - 0.8.0-1 +- initial package, version 0.8.0 (beta) \ No newline at end of file -- cgit