From d9cc591b8d23960efdd2464c34c09f96b013db0b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 14 Feb 2015 08:59:46 +0100 Subject: php-pecl-gender: 1.1.0 - New package --- Makefile | 4 + REFLECTION | 106 +++++++++++++++++++++++++ php-pecl-gender.spec | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 330 insertions(+) create mode 100644 Makefile create mode 100644 REFLECTION create mode 100644 php-pecl-gender.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..ceef036 --- /dev/null +++ b/REFLECTION @@ -0,0 +1,106 @@ +Extension [ extension #90 gender version 1.1.0 ] { + + - Classes [1] { + Class [ class Gender\Gender ] { + + - Constants [63] { + Constant [ integer IS_FEMALE ] { 70 } + Constant [ integer IS_MOSTLY_FEMALE ] { 102 } + Constant [ integer IS_MALE ] { 77 } + Constant [ integer IS_MOSTLY_MALE ] { 109 } + Constant [ integer IS_UNISEX_NAME ] { 63 } + Constant [ integer IS_A_COUPLE ] { 67 } + Constant [ integer NAME_NOT_FOUND ] { 32 } + Constant [ integer ERROR_IN_NAME ] { 69 } + Constant [ integer ANY_COUNTRY ] { 0 } + Constant [ integer BRITAIN ] { 1 } + Constant [ integer IRELAND ] { 2 } + Constant [ integer USA ] { 3 } + Constant [ integer SPAIN ] { 4 } + Constant [ integer PORTUGAL ] { 5 } + Constant [ integer ITALY ] { 6 } + Constant [ integer MALTA ] { 7 } + Constant [ integer FRANCE ] { 8 } + Constant [ integer BELGIUM ] { 9 } + Constant [ integer LUXEMBOURG ] { 10 } + Constant [ integer NETHERLANDS ] { 11 } + Constant [ integer GERMANY ] { 12 } + Constant [ integer EAST_FRISIA ] { 13 } + Constant [ integer AUSTRIA ] { 14 } + Constant [ integer SWISS ] { 15 } + Constant [ integer ICELAND ] { 16 } + Constant [ integer DENMARK ] { 17 } + Constant [ integer NORWAY ] { 18 } + Constant [ integer SWEDEN ] { 19 } + Constant [ integer FINLAND ] { 20 } + Constant [ integer ESTONIA ] { 21 } + Constant [ integer LATVIA ] { 22 } + Constant [ integer LITHUANIA ] { 23 } + Constant [ integer POLAND ] { 24 } + Constant [ integer CZECH_REP ] { 25 } + Constant [ integer SLOVAKIA ] { 26 } + Constant [ integer HUNGARY ] { 27 } + Constant [ integer ROMANIA ] { 28 } + Constant [ integer BULGARIA ] { 29 } + Constant [ integer BOSNIA ] { 30 } + Constant [ integer CROATIA ] { 31 } + Constant [ integer KOSOVO ] { 32 } + Constant [ integer MACEDONIA ] { 33 } + Constant [ integer MONTENEGRO ] { 34 } + Constant [ integer SERBIA ] { 35 } + Constant [ integer SLOVENIA ] { 36 } + Constant [ integer ALBANIA ] { 37 } + Constant [ integer GREECE ] { 38 } + Constant [ integer RUSSIA ] { 39 } + Constant [ integer BELARUS ] { 40 } + Constant [ integer MOLDOVA ] { 41 } + Constant [ integer UKRAINE ] { 42 } + Constant [ integer ARMENIA ] { 43 } + Constant [ integer AZERBAIJAN ] { 44 } + Constant [ integer GEORGIA ] { 45 } + Constant [ integer KAZAKH_UZBEK ] { 46 } + Constant [ integer TURKEY ] { 47 } + Constant [ integer ARABIA ] { 48 } + Constant [ integer ISRAEL ] { 49 } + Constant [ integer CHINA ] { 50 } + Constant [ integer INDIA ] { 51 } + Constant [ integer JAPAN ] { 52 } + Constant [ integer KOREA ] { 53 } + Constant [ integer VIETNAM ] { 54 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [7] { + Method [ public method __construct ] { + } + + Method [ public method get ] { + } + + Method [ public method connect ] { + } + + Method [ public method trace ] { + } + + Method [ public method country ] { + } + + Method [ public method similarNames ] { + } + + Method [ public method isNick ] { + } + } + } + } +} + diff --git a/php-pecl-gender.spec b/php-pecl-gender.spec new file mode 100644 index 0000000..757bcb4 --- /dev/null +++ b/php-pecl-gender.spec @@ -0,0 +1,220 @@ +# spec file for php-pecl-gender +# +# 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-gender} +%{!?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 gender +%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: Gender Extension +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 1.1.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}.1 +# Code is BSD, nam_dict.txt is GFDL +License: BSD and GFDL +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 +Gender PHP extension is a port of the gender.c program originally written +by Joerg Michael. The main purpose is to find out the gender of firstnames. + +The name dictionary contains >40000 firstnames from 54 countries. + + +%prep +%setup -q -c +mv %{pecl_name}-%{version} NTS + +# Don't install tests +sed -e 's/role="test"/role="src"/' \ + -e '/tasks:/d' \ + -i package.xml + +cd NTS +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_GENDER_VERSION/{s/.* "//;s/".*$//;p}' php_gender.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-gender \ + --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ + --enable-gender \ + --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} + +%{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.1.0-1 +- initial package, version 1.1.0 (stable) \ No newline at end of file -- cgit