From f16a86a95ebbb7dbc9e87852c43ce916b99e18d5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 12 Sep 2014 09:36:52 +0200 Subject: php-pecl-termbox: 0.1.0 (new package) --- Makefile | 4 + REFLECTION | 147 ++++++++++++++++++++++++++++++++++ php-pecl-termbox.spec | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 365 insertions(+) create mode 100644 Makefile create mode 100644 REFLECTION create mode 100644 php-pecl-termbox.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..5f84bfd --- /dev/null +++ b/REFLECTION @@ -0,0 +1,147 @@ +Extension [ extension #148 termbox version 0.1.0 ] { + + - Constants [100] { + Constant [ integer TB_KEY_F1 ] { 65535 } + Constant [ integer TB_KEY_F2 ] { 65534 } + Constant [ integer TB_KEY_F3 ] { 65533 } + Constant [ integer TB_KEY_F4 ] { 65532 } + Constant [ integer TB_KEY_F5 ] { 65531 } + Constant [ integer TB_KEY_F6 ] { 65530 } + Constant [ integer TB_KEY_F7 ] { 65529 } + Constant [ integer TB_KEY_F8 ] { 65528 } + Constant [ integer TB_KEY_F9 ] { 65527 } + Constant [ integer TB_KEY_F10 ] { 65526 } + Constant [ integer TB_KEY_F11 ] { 65525 } + Constant [ integer TB_KEY_F12 ] { 65524 } + Constant [ integer TB_KEY_INSERT ] { 65523 } + Constant [ integer TB_KEY_DELETE ] { 65522 } + Constant [ integer TB_KEY_HOME ] { 65521 } + Constant [ integer TB_KEY_END ] { 65520 } + Constant [ integer TB_KEY_PGUP ] { 65519 } + Constant [ integer TB_KEY_PGDN ] { 65518 } + Constant [ integer TB_KEY_ARROW_UP ] { 65517 } + Constant [ integer TB_KEY_ARROW_DOWN ] { 65516 } + Constant [ integer TB_KEY_ARROW_LEFT ] { 65515 } + Constant [ integer TB_KEY_ARROW_RIGHT ] { 65514 } + Constant [ integer TB_KEY_CTRL_TILDE ] { 0 } + Constant [ integer TB_KEY_CTRL_2 ] { 0 } + Constant [ integer TB_KEY_CTRL_A ] { 1 } + Constant [ integer TB_KEY_CTRL_B ] { 2 } + Constant [ integer TB_KEY_CTRL_C ] { 3 } + Constant [ integer TB_KEY_CTRL_D ] { 4 } + Constant [ integer TB_KEY_CTRL_E ] { 5 } + Constant [ integer TB_KEY_CTRL_F ] { 6 } + Constant [ integer TB_KEY_CTRL_G ] { 7 } + Constant [ integer TB_KEY_BACKSPACE ] { 8 } + Constant [ integer TB_KEY_CTRL_H ] { 8 } + Constant [ integer TB_KEY_TAB ] { 9 } + Constant [ integer TB_KEY_CTRL_I ] { 9 } + Constant [ integer TB_KEY_CTRL_J ] { 10 } + Constant [ integer TB_KEY_CTRL_K ] { 11 } + Constant [ integer TB_KEY_CTRL_L ] { 12 } + Constant [ integer TB_KEY_ENTER ] { 13 } + Constant [ integer TB_KEY_CTRL_M ] { 13 } + Constant [ integer TB_KEY_CTRL_N ] { 14 } + Constant [ integer TB_KEY_CTRL_O ] { 15 } + Constant [ integer TB_KEY_CTRL_P ] { 16 } + Constant [ integer TB_KEY_CTRL_Q ] { 17 } + Constant [ integer TB_KEY_CTRL_R ] { 18 } + Constant [ integer TB_KEY_CTRL_S ] { 19 } + Constant [ integer TB_KEY_CTRL_T ] { 20 } + Constant [ integer TB_KEY_CTRL_U ] { 21 } + Constant [ integer TB_KEY_CTRL_V ] { 22 } + Constant [ integer TB_KEY_CTRL_W ] { 23 } + Constant [ integer TB_KEY_CTRL_X ] { 24 } + Constant [ integer TB_KEY_CTRL_Y ] { 25 } + Constant [ integer TB_KEY_CTRL_Z ] { 26 } + Constant [ integer TB_KEY_ESC ] { 27 } + Constant [ integer TB_KEY_CTRL_LSQ_BRACKET ] { 27 } + Constant [ integer TB_KEY_CTRL_3 ] { 27 } + Constant [ integer TB_KEY_CTRL_4 ] { 28 } + Constant [ integer TB_KEY_CTRL_BACKSLASH ] { 28 } + Constant [ integer TB_KEY_CTRL_5 ] { 29 } + Constant [ integer TB_KEY_CTRL_RSQ_BRACKET ] { 29 } + Constant [ integer TB_KEY_CTRL_6 ] { 30 } + Constant [ integer TB_KEY_CTRL_7 ] { 31 } + Constant [ integer TB_KEY_CTRL_SLASH ] { 31 } + Constant [ integer TB_KEY_CTRL_UNDERSCORE ] { 31 } + Constant [ integer TB_KEY_SPACE ] { 32 } + Constant [ integer TB_KEY_BACKSPACE2 ] { 127 } + Constant [ integer TB_KEY_CTRL_8 ] { 127 } + Constant [ integer TB_MOD_ALT ] { 1 } + Constant [ integer TB_DEFAULT ] { 0 } + Constant [ integer TB_BLACK ] { 1 } + Constant [ integer TB_RED ] { 2 } + Constant [ integer TB_GREEN ] { 3 } + Constant [ integer TB_YELLOW ] { 4 } + Constant [ integer TB_BLUE ] { 5 } + Constant [ integer TB_MAGENTA ] { 6 } + Constant [ integer TB_CYAN ] { 7 } + Constant [ integer TB_WHITE ] { 8 } + Constant [ integer TB_BOLD ] { 256 } + Constant [ integer TB_UNDERLINE ] { 512 } + Constant [ integer TB_REVERSE ] { 1024 } + Constant [ integer TB_EVENT_KEY ] { 1 } + Constant [ integer TB_EVENT_RESIZE ] { 2 } + Constant [ integer TB_EUNSUPPORTED_TERMINAL ] { -1 } + Constant [ integer TB_EFAILED_TO_OPEN_TTY ] { -2 } + Constant [ integer TB_EPIPE_TRAP_ERROR ] { -3 } + Constant [ integer TB_HIDE_CURSOR ] { -1 } + Constant [ integer TB_INPUT_CURRENT ] { 0 } + Constant [ integer TB_INPUT_ESC ] { 1 } + Constant [ integer TB_INPUT_ALT ] { 2 } + Constant [ integer TB_OUTPUT_CURRENT ] { 0 } + Constant [ integer TB_OUTPUT_NORMAL ] { 1 } + Constant [ integer TB_OUTPUT_256 ] { 2 } + Constant [ integer TB_OUTPUT_216 ] { 3 } + Constant [ integer TB_OUTPUT_GRAYSCALE ] { 4 } + Constant [ integer TB_EOF ] { -1 } + Constant [ integer TB_ERROR_NONE ] { 0 } + Constant [ integer TB_ERROR_NOT_INITIALIZED ] { -100 } + Constant [ integer TB_ERROR_ALREADY_INITIALIZED ] { -101 } + Constant [ integer TB_ERROR_COULD_NOT_READ_INPUT ] { -102 } + Constant [ integer TB_ERROR_INVALID_MODE ] { -103 } + } + + - Functions { + Function [ function termbox_init ] { + } + Function [ function termbox_shutdown ] { + } + Function [ function termbox_width ] { + } + Function [ function termbox_height ] { + } + Function [ function termbox_clear ] { + } + Function [ function termbox_set_clear_attributes ] { + } + Function [ function termbox_present ] { + } + Function [ function termbox_set_cursor ] { + } + Function [ function termbox_change_cell ] { + } + Function [ function termbox_set_input_mode ] { + } + Function [ function termbox_get_input_mode ] { + } + Function [ function termbox_set_output_mode ] { + } + Function [ function termbox_get_output_mode ] { + } + Function [ function termbox_peek_event ] { + } + Function [ function termbox_poll_event ] { + } + Function [ function termbox_utf8_char_to_unicode ] { + } + Function [ function termbox_utf8_unicode_to_char ] { + } + Function [ function termbox_print ] { + } + Function [ function termbox_last_error ] { + } + } +} + diff --git a/php-pecl-termbox.spec b/php-pecl-termbox.spec new file mode 100644 index 0000000..68b6ac5 --- /dev/null +++ b/php-pecl-termbox.spec @@ -0,0 +1,214 @@ +# spec file for php-pecl-termbox +# +# 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-termbox} +%{!?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 termbox +%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: A termbox wrapper for PHP +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 0.1.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: ASL 2.0 +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: termbox-devel +BuildRequires: %{?scl_prefix}php-devel +BuildRequires: %{?scl_prefix}php-pear +# For tests +BuildRequires: %{?scl_prefix}php-mbstring + +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 +termbox is a robust, minimal alternative to ncurses. + +%{name} is a wrapper extension that provides termbox +functionality in PHP land. + +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/register tests +sed -e '/role="test"/d' -i package.xml + +cd NTS +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_TERMBOX_VERSION/{s/.* "//;s/".*$//;p}' php_termbox.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 +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +%configure \ + --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 +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=mbstring.so -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=mbstring.so -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 +* Fri Sep 12 2014 Remi Collet - 0.1.0-1 +- initial package \ No newline at end of file -- cgit