From 633499c17d4d8dbd1a81c111ebcf9c0f2ff589d3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 13 Sep 2014 11:27:56 +0200 Subject: php-pecl-termbox: add upstream patch, fix build, add reflection --- REFLECTION | 76 +++++++++++++++++++ php-pecl-termbox.spec | 9 ++- termbox-upstream.patch | 194 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 termbox-upstream.patch diff --git a/REFLECTION b/REFLECTION index 5f84bfd..75c029b 100644 --- a/REFLECTION +++ b/REFLECTION @@ -105,42 +105,118 @@ Extension [ extension #148 termbox version 0.1.0 ] { - Functions { Function [ function termbox_init ] { + + - Parameters [0] { + } } Function [ function termbox_shutdown ] { + + - Parameters [0] { + } } Function [ function termbox_width ] { + + - Parameters [0] { + } } Function [ function termbox_height ] { + + - Parameters [0] { + } } Function [ function termbox_clear ] { + + - Parameters [0] { + } } Function [ function termbox_set_clear_attributes ] { + + - Parameters [2] { + Parameter #0 [ $fg ] + Parameter #1 [ $bg ] + } } Function [ function termbox_present ] { + + - Parameters [0] { + } } Function [ function termbox_set_cursor ] { + + - Parameters [2] { + Parameter #0 [ $x ] + Parameter #1 [ $y ] + } } Function [ function termbox_change_cell ] { + + - Parameters [5] { + Parameter #0 [ $x ] + Parameter #1 [ $y ] + Parameter #2 [ $ch ] + Parameter #3 [ $fg ] + Parameter #4 [ $bg ] + } } Function [ function termbox_set_input_mode ] { + + - Parameters [1] { + Parameter #0 [ $mode ] + } } Function [ function termbox_get_input_mode ] { + + - Parameters [0] { + } } Function [ function termbox_set_output_mode ] { + + - Parameters [1] { + Parameter #0 [ $mode ] + } } Function [ function termbox_get_output_mode ] { + + - Parameters [0] { + } } Function [ function termbox_peek_event ] { + + - Parameters [1] { + Parameter #0 [ $timeout_ms ] + } } Function [ function termbox_poll_event ] { + + - Parameters [0] { + } } Function [ function termbox_utf8_char_to_unicode ] { + + - Parameters [1] { + Parameter #0 [ $char ] + } } Function [ function termbox_utf8_unicode_to_char ] { + + - Parameters [1] { + Parameter #0 [ $unicode ] + } } Function [ function termbox_print ] { + + - Parameters [5] { + Parameter #0 [ $str ] + Parameter #1 [ $x ] + Parameter #2 [ $y ] + Parameter #3 [ $fg ] + Parameter #4 [ $bg ] + } } Function [ function termbox_last_error ] { + + - Parameters [0] { + } } } } diff --git a/php-pecl-termbox.spec b/php-pecl-termbox.spec index 68b6ac5..62ab6bc 100644 --- a/php-pecl-termbox.spec +++ b/php-pecl-termbox.spec @@ -23,12 +23,14 @@ 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;')} +Release: 2%{?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 +Patch0: %{pecl_name}-upstream.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: termbox-devel BuildRequires: %{?scl_prefix}php-devel @@ -87,6 +89,8 @@ mv %{pecl_name}-%{version} NTS sed -e '/role="test"/d' -i package.xml cd NTS +%patch0 -p1 -b .upstream + # 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 @@ -210,5 +214,8 @@ rm -rf %{buildroot} %changelog +* Sat Sep 13 2014 Remi Collet - 0.1.0-2 +- add various upstream patches + * Fri Sep 12 2014 Remi Collet - 0.1.0-1 - initial package \ No newline at end of file diff --git a/termbox-upstream.patch b/termbox-upstream.patch new file mode 100644 index 0000000..34be79e --- /dev/null +++ b/termbox-upstream.patch @@ -0,0 +1,194 @@ +From 4e7d5f3d3c3aef6806f34d0c17001843d91f890c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Sep 2014 21:41:07 +0200 +Subject: [PATCH] honours --with-libdir option + +--- + config.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config.m4 b/config.m4 +index f664380..14861f8 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -31,12 +31,12 @@ if test "$PHP_TERMBOX" != "no"; then + LIBSYMBOL=tb_init + PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, + [ +- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $TERMBOX_DIR/lib, TERMBOX_SHARED_LIBADD) ++ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $TERMBOX_DIR/$PHP_LIBDIR, TERMBOX_SHARED_LIBADD) + AC_DEFINE(HAVE_TERMBOXLIB,1,[ ]) + ],[ + AC_MSG_ERROR([wrong termbox lib version or lib not found]) + ],[ +- -L$TERMBOX_DIR/lib -lm ++ -L$TERMBOX_DIR/$PHP_LIBDIR -lm + ]) + PHP_SUBST(TERMBOX_SHARED_LIBADD) + +-- +1.9.2 + +From ee78eacbff59af75e55509d428921afe4e9f8f66 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Sep 2014 21:43:21 +0200 +Subject: [PATCH] fix build with php < 5.3.7 + +--- + termbox.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/termbox.c b/termbox.c +index 628d3fc..3504990 100644 +--- a/termbox.c ++++ b/termbox.c +@@ -56,7 +56,11 @@ const zend_function_entry termbox_functions[] = { + PHP_FE(termbox_utf8_unicode_to_char, NULL) + PHP_FE(termbox_print, NULL) + PHP_FE(termbox_last_error, NULL) ++#ifdef PHP_FE_END + PHP_FE_END /* Must be the last line in termbox_functions[] */ ++#else ++ {NULL, NULL, NULL} ++#endif + }; + /* }}} */ + +-- +1.9.2 + +From fb8b55a5da5165d6d368405469915ed792b8d983 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Sep 2014 22:00:01 +0200 +Subject: [PATCH] add arginfo to all functions for reflection + +--- + termbox.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 64 insertions(+), 19 deletions(-) + +diff --git a/termbox.c b/termbox.c +index 3504990..2a3e585 100644 +--- a/termbox.c ++++ b/termbox.c +@@ -32,30 +32,75 @@ + + ZEND_DECLARE_MODULE_GLOBALS(termbox) + ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_none, 0, 0, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_set_clear_attributes, 0, 0, 2) ++ ZEND_ARG_INFO(0, fg) ++ ZEND_ARG_INFO(0, bg) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_set_cursor, 0, 0, 2) ++ ZEND_ARG_INFO(0, x) ++ ZEND_ARG_INFO(0, y) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_change_cell, 0, 0, 5) ++ ZEND_ARG_INFO(0, x) ++ ZEND_ARG_INFO(0, y) ++ ZEND_ARG_INFO(0, ch) ++ ZEND_ARG_INFO(0, fg) ++ ZEND_ARG_INFO(0, bg) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_mode, 0, 0, 1) ++ ZEND_ARG_INFO(0, mode) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_peek_event, 0, 0, 1) ++ ZEND_ARG_INFO(0, timeout_ms) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_utf8_char_to_unicode, 0, 0, 1) ++ ZEND_ARG_INFO(0, char) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_utf8_unicode_to_char, 0, 0, 1) ++ ZEND_ARG_INFO(0, unicode) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_termbox_print, 0, 0, 5) ++ ZEND_ARG_INFO(0, str) ++ ZEND_ARG_INFO(0, x) ++ ZEND_ARG_INFO(0, y) ++ ZEND_ARG_INFO(0, fg) ++ ZEND_ARG_INFO(0, bg) ++ZEND_END_ARG_INFO() ++ + /* {{{ termbox_functions[] + * + * Every user visible function must have an entry in termbox_functions[]. + */ + const zend_function_entry termbox_functions[] = { +- PHP_FE(termbox_init, NULL) +- PHP_FE(termbox_shutdown, NULL) +- PHP_FE(termbox_width, NULL) +- PHP_FE(termbox_height, NULL) +- PHP_FE(termbox_clear, NULL) +- PHP_FE(termbox_set_clear_attributes, NULL) +- PHP_FE(termbox_present, NULL) +- PHP_FE(termbox_set_cursor, NULL) +- PHP_FE(termbox_change_cell, NULL) +- PHP_FE(termbox_set_input_mode, NULL) +- PHP_FE(termbox_get_input_mode, NULL) +- PHP_FE(termbox_set_output_mode, NULL) +- PHP_FE(termbox_get_output_mode, NULL) +- PHP_FE(termbox_peek_event, NULL) +- PHP_FE(termbox_poll_event, NULL) +- PHP_FE(termbox_utf8_char_to_unicode, NULL) +- PHP_FE(termbox_utf8_unicode_to_char, NULL) +- PHP_FE(termbox_print, NULL) +- PHP_FE(termbox_last_error, NULL) ++ PHP_FE(termbox_init, arginfo_termbox_none) ++ PHP_FE(termbox_shutdown, arginfo_termbox_none) ++ PHP_FE(termbox_width, arginfo_termbox_none) ++ PHP_FE(termbox_height, arginfo_termbox_none) ++ PHP_FE(termbox_clear, arginfo_termbox_none) ++ PHP_FE(termbox_set_clear_attributes, arginfo_termbox_set_clear_attributes) ++ PHP_FE(termbox_present, arginfo_termbox_none) ++ PHP_FE(termbox_set_cursor, arginfo_termbox_set_cursor) ++ PHP_FE(termbox_change_cell, arginfo_termbox_change_cell) ++ PHP_FE(termbox_set_input_mode, arginfo_termbox_mode) ++ PHP_FE(termbox_get_input_mode, arginfo_termbox_none) ++ PHP_FE(termbox_set_output_mode, arginfo_termbox_mode) ++ PHP_FE(termbox_get_output_mode, arginfo_termbox_none) ++ PHP_FE(termbox_peek_event, arginfo_termbox_peek_event) ++ PHP_FE(termbox_poll_event, arginfo_termbox_none) ++ PHP_FE(termbox_utf8_char_to_unicode, arginfo_termbox_utf8_char_to_unicode) ++ PHP_FE(termbox_utf8_unicode_to_char, arginfo_termbox_utf8_unicode_to_char) ++ PHP_FE(termbox_print, arginfo_termbox_print) ++ PHP_FE(termbox_last_error, arginfo_termbox_none) + #ifdef PHP_FE_END + PHP_FE_END /* Must be the last line in termbox_functions[] */ + #else +-- +1.9.2 + +From 6db4f5325cdb0a9664357076542e7ff5e0592b4e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Sep 2014 22:02:06 +0200 +Subject: [PATCH] clean [-Wunused-variable] + +--- + termbox.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/termbox.c b/termbox.c +index 2a3e585..f6d1145 100644 +--- a/termbox.c ++++ b/termbox.c +@@ -453,7 +453,6 @@ PHP_FUNCTION(termbox_utf8_char_to_unicode) + char *str; + int str_len; + uint32_t unicode_int; +- int rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + return; +-- +1.9.2 + -- cgit