summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-10-13 20:01:36 +0200
committerRemi Collet <fedora@famillecollet.com>2013-10-13 20:01:36 +0200
commit8d167dafc8820aebdbc7391ff585736ce2ec2645 (patch)
tree3ce592a19f028986d0b5d1edc8c5b6070082e3f4
php-pecl-newt: 1.2.6 + svn - New package
-rw-r--r--3_0.txt68
-rw-r--r--Makefile4
-rw-r--r--newt-svn.patch320
-rw-r--r--php-pecl-newt.spec179
4 files changed, 571 insertions, 0 deletions
diff --git a/3_0.txt b/3_0.txt
new file mode 100644
index 0000000..6c1c170
--- /dev/null
+++ b/3_0.txt
@@ -0,0 +1,68 @@
+--------------------------------------------------------------------
+ The PHP License, version 3.0
+Copyright (c) 1999 - 2006 The PHP Group. All rights reserved.
+--------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+modification, is permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The name "PHP" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact group@php.net.
+
+ 4. Products derived from this software may not be called "PHP", nor
+ may "PHP" appear in their name, without prior written permission
+ from group@php.net. You may indicate that your software works in
+ conjunction with PHP by saying "Foo for PHP" instead of calling
+ it "PHP Foo" or "phpfoo"
+
+ 5. The PHP Group may publish revised and/or new versions of the
+ license from time to time. Each version will be given a
+ distinguishing version number.
+ Once covered code has been published under a particular version
+ of the license, you may always continue to use it under the terms
+ of that version. You may also choose to use such covered code
+ under the terms of any subsequent version of the license
+ published by the PHP Group. No one other than the PHP Group has
+ the right to modify the terms applicable to covered code created
+ under this License.
+
+ 6. Redistributions of any form whatsoever must retain the following
+ acknowledgment:
+ "This product includes PHP, freely available from
+ <http://www.php.net/>".
+
+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--------------------------------------------------------------------
+
+This software consists of voluntary contributions made by many
+individuals on behalf of the PHP Group.
+
+The PHP Group can be contacted via Email at group@php.net.
+
+For more information on the PHP Group and the PHP project,
+please see <http://www.php.net>.
+
+This product includes the Zend Engine, freely available at
+<http://www.zend.com>.
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/newt-svn.patch b/newt-svn.patch
new file mode 100644
index 0000000..84724c8
--- /dev/null
+++ b/newt-svn.patch
@@ -0,0 +1,320 @@
+--- pecl/newt/trunk/newt.c 2013/10/12 22:58:46 331791
++++ pecl/newt/trunk/newt.c 2013/10/13 14:38:40 331792
+@@ -3615,7 +3615,7 @@
+
+ items[i].text = Z_STRVAL_PP(z_item_text);
+ strs[i] = Z_STRVAL_PP(z_item_value);
+- items[i].value = (const char **)&strs[i];
++ items[i].value = &strs[i];
+ items[i].flags = (z_item_flags ? Z_LVAL_PP(z_item_flags) : 0);
+
+ i++;
+--- pecl/newt/trunk/newt.c 2013/10/13 14:38:40 331792
++++ pecl/newt/trunk/newt.c 2013/10/13 14:39:50 331793
+@@ -3129,7 +3129,7 @@
+ newtComponent val;
+ long pad_left, pad_top, pad_right, pad_bottom, anchor, flags = 0;
+
+- if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "rlllrlllll|l", &z_grid, &col, &row, &z_val, &pad_left,
++ if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "rlllrlllll|l", &z_grid, &col, &row, &type, &z_val, &pad_left,
+ &pad_top, &pad_right, &pad_bottom, &anchor, &flags) == FAILURE) {
+ return;
+ }
+--- pecl/newt/trunk/newt.c 2013/10/13 14:39:50 331793
++++ pecl/newt/trunk/newt.c 2013/10/13 15:08:10 331794
+@@ -47,6 +47,11 @@
+ ZEND_ARG_PASS_INFO(1)
+ ZEND_END_ARG_INFO()
+
++ZEND_BEGIN_ARG_INFO(both_arg_force_ref, 0)
++ ZEND_ARG_PASS_INFO(1)
++ ZEND_ARG_PASS_INFO(1)
++ZEND_END_ARG_INFO()
++
+ ZEND_BEGIN_ARG_INFO(secondandthird_arg_force_ref, 0)
+ ZEND_ARG_PASS_INFO(0)
+ ZEND_ARG_PASS_INFO(1)
+@@ -135,11 +140,7 @@
+ #ifdef HAVE_NEWT_LISTITEM_GET_DATA
+ PHP_FE(newt_listitem_get_data, NULL)
+ #endif
+-#ifdef all_args_by_ref
+- PHP_FE(newt_get_screen_size, all_args_by_ref)
+-#else
+- PHP_FE(newt_get_screen_size, NULL)
+-#endif
++ PHP_FE(newt_get_screen_size, both_arg_force_ref)
+ PHP_FE(newt_label, NULL)
+ PHP_FE(newt_label_set_text, NULL)
+ PHP_FE(newt_vertical_scrollbar, NULL)
+--- pecl/newt/trunk/examples/newt_win_menu.php 2013/10/13 15:08:10 331794
++++ pecl/newt/trunk/examples/newt_win_menu.php 2013/10/13 15:09:23 331795
+@@ -5,7 +5,7 @@
+ $options = array("eth0", "eth1", "lo");
+ $option = 1;
+
+- $rc = newt_win_menu("Network configuration tool", "Which interface to configure?", 30, 0, 20, 6, $options, &$option, "Ok", "Back");
++ $rc = newt_win_menu("Network configuration tool", "Which interface to configure?", 30, 0, 20, 6, $options, $option, "Ok", "Back");
+
+ newt_finished ();
+
+--- pecl/newt/trunk/examples/redhat_netconf_example.php 2013/10/13 15:08:10 331794
++++ pecl/newt/trunk/examples/redhat_netconf_example.php 2013/10/13 15:09:23 331795
+@@ -6,7 +6,7 @@
+ newt_push_help_line (null);
+ newt_draw_root_text (-30, 0, "(c) 1999-2002 RedHat, Inc");
+
+- newt_get_screen_size (&$rows, &$cols);
++ newt_get_screen_size ($rows, $cols);
+
+ newt_open_window ($rows/2-17, $cols/2-10, 34, 17, "Choose a Tool");
+
+--- pecl/newt/trunk/newt_vcall.c 2013/10/13 15:09:23 331795
++++ pecl/newt/trunk/newt_vcall.c 2013/10/13 15:12:56 331796
+@@ -125,6 +125,7 @@
+ case 99: return f(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19],a[20],a[21],a[22],a[23],a[24],a[25],a[26],a[27],a[28],a[29],a[30],a[31],a[32],a[33],a[34],a[35],a[36],a[37],a[38],a[39],a[40],a[41],a[42],a[43],a[44],a[45],a[46],a[47],a[48],a[49],a[50],a[51],a[52],a[53],a[54],a[55],a[56],a[57],a[58],a[59],a[60],a[61],a[62],a[63],a[64],a[65],a[66],a[67],a[68],a[69],a[70],a[71],a[72],a[73],a[74],a[75],a[76],a[77],a[78],a[79],a[80],a[81],a[82],a[83],a[84],a[85],a[86],a[87],a[88],a[89],a[90],a[91],a[92],a[93],a[94],a[95],a[96],a[97],a[98],NULL);
+ case 100: return f(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19],a[20],a[21],a[22],a[23],a[24],a[25],a[26],a[27],a[28],a[29],a[30],a[31],a[32],a[33],a[34],a[35],a[36],a[37],a[38],a[39],a[40],a[41],a[42],a[43],a[44],a[45],a[46],a[47],a[48],a[49],a[50],a[51],a[52],a[53],a[54],a[55],a[56],a[57],a[58],a[59],a[60],a[61],a[62],a[63],a[64],a[65],a[66],a[67],a[68],a[69],a[70],a[71],a[72],a[73],a[74],a[75],a[76],a[77],a[78],a[79],a[80],a[81],a[82],a[83],a[84],a[85],a[86],a[87],a[88],a[89],a[90],a[91],a[92],a[93],a[94],a[95],a[96],a[97],a[98],a[99],NULL);
+ }
++ return NULL;
+ }
+
+ /*
+--- pecl/newt/trunk/newt.c 2013/10/13 15:12:56 331796
++++ pecl/newt/trunk/newt.c 2013/10/13 15:38:00 331797
+@@ -1932,7 +1932,7 @@
+
+ int argc = ZEND_NUM_ARGS();
+ if (argc < 5) { WRONG_PARAM_COUNT; }
+- if (zend_parse_parameters ((argc - 1) TSRMLS_CC, "rszl", &z_checkboxtree, &text, &text_len, &z_data, &flags) == FAILURE) {
++ if (zend_parse_parameters (4 TSRMLS_CC, "rszl", &z_checkboxtree, &text, &text_len, &z_data, &flags) == FAILURE) {
+ return;
+ }
+
+@@ -1946,7 +1946,7 @@
+
+ PHP_NEWT_STORE_DATA (z_data, key);
+
+- newt_args = (void **) safe_emalloc (argc, sizeof(void *), 0);
++ newt_args = (void **) safe_emalloc (argc+1, sizeof(void *), 0);
+ newt_args[0] = (void *)checkboxtree;
+ newt_args[1] = (void *)text;
+ newt_args[2] = (void *)key;
+@@ -1961,8 +1961,9 @@
+ }
+ newt_args[i] = (void *)Z_LVAL_PP(args[i]);
+ }
+-
+- newt_vcall ((void *)newtCheckboxTreeAddItem, newt_args, argc);
++ /* add NEWT_ARG_LAST is forgotten by user to avoid segfault, bug #64990 */
++ newt_args[argc] = (void *)NEWT_ARG_LAST;
++ newt_vcall ((void *)newtCheckboxTreeAddItem, newt_args, argc+1);
+
+ efree (newt_args);
+ efree (args);
+--- pecl/newt/trunk/newt.c 2013/10/13 16:10:23 331800
++++ pecl/newt/trunk/newt.c 2013/10/13 17:13:01 331801
+@@ -249,6 +249,13 @@
+ };
+ /* }}} */
+
++ZEND_DECLARE_MODULE_GLOBALS (newt)
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
++/* This "if" allows PECL builds from this file to be portable to older PHP releases */
++static PHP_GINIT_FUNCTION(newt);
++static PHP_GSHUTDOWN_FUNCTION(newt);
++#endif
++
+ /* {{{ newt_module_entry
+ */
+ zend_module_entry newt_module_entry = {
+@@ -261,19 +268,33 @@
+ NULL,
+ PHP_MINFO(newt),
+ PHP_NEWT_VERSION,
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
++ /* This check allows PECL builds from this file to be portable to older PHP releases */
++ PHP_MODULE_GLOBALS(newt),
++ PHP_GINIT(newt),
++ PHP_GSHUTDOWN(newt),
++ NULL,
++ STANDARD_MODULE_PROPERTIES_EX
++#else
+ STANDARD_MODULE_PROPERTIES
++#endif
+ };
+ /* }}} */
+
+-ZEND_DECLARE_MODULE_GLOBALS (newt)
+-
+ #ifdef COMPILE_DL_NEWT
+ ZEND_GET_MODULE(newt)
+ #endif
+
+-/* {{{ php_newt_init_globals
++/* {{{ PHP_GINIT_FUNCTION
++ *
++ * Zerofill globals during module init
+ */
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
++/* This check allows PECL builds from this file to be portable to older PHP releases */
++static PHP_GINIT_FUNCTION(newt)
++#else
+ static void php_newt_init_globals (zend_newt_globals *newt_globals TSRMLS_DC)
++#endif
+ {
+ newt_globals->newt_has_inited = 0;
+
+@@ -282,9 +303,16 @@
+ }
+ /* }}} */
+
+-/* {{{ php_newt_destroy_globals
++/* {{{ PHP_GSHUTDOWN_FUNCTION
++ *
++ * Called for thread shutdown in ZTS, after module shutdown for non-ZTS
+ */
++/* This check allows PECL builds from this file to be portable to older PHP releases */
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
++static PHP_GSHUTDOWN_FUNCTION(newt)
++#else
+ static void php_newt_destroy_globals(zend_newt_globals *newt_globals TSRMLS_DC)
++#endif
+ {
+ if (newt_globals->newt_has_inited) {
+ newtFinished();
+@@ -295,6 +323,7 @@
+ }
+ /* }}} */
+
++
+ /* {{{ php_newt_free_cb
+ */
+ void php_newt_free_cb (php_newt_cb **cb_ptr)
+@@ -397,7 +426,12 @@
+ le_newt_comp = zend_register_list_destructors_ex(NULL, NULL, le_newt_comp_name, module_number);
+ le_newt_grid = zend_register_list_destructors_ex(NULL, NULL, le_newt_grid_name, module_number);
+
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
++ /* This check allows PECL builds from this file to be portable to older PHP releases */
++ /* this is handled by new globals management code */
++#else
+ ZEND_INIT_MODULE_GLOBALS (newt, php_newt_init_globals, php_newt_destroy_globals);
++#endif
+
+ /* Colorsets */
+ REGISTER_NEWT_CONSTANT(NEWT_COLORSET_ROOT);
+@@ -548,8 +582,11 @@
+ */
+ PHP_MSHUTDOWN_FUNCTION(newt)
+ {
++/* Work around PHP_GSHUTDOWN_FUNCTION not being called in older versions of PHP */
++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) || (PHP_MAJOR_VERSION < 5)
+ #ifndef ZTS
+ php_newt_destroy_globals (&newt_globals TSRMLS_CC);
++#endif
+ #endif
+
+ return SUCCESS;
+--- pecl/newt/trunk/php_newt.h 2013/10/13 16:10:23 331800
++++ pecl/newt/trunk/php_newt.h 2013/10/13 17:13:01 331801
+@@ -232,8 +232,6 @@
+ static void newt_suspend_callback_wrapper (void *cb_key);
+ static void newt_help_callback_wrapper (newtComponent form, char *help);
+
+-static void php_newt_init_globals (zend_newt_globals *newt_globals TSRMLS_DC);
+-static void php_newt_destroy_globals(zend_newt_globals *newt_globals TSRMLS_DC);
+ void php_newt_free_cb (php_newt_cb **cb_ptr);
+ int php_newt_fetch_resource (zval *rsrc, void *data, int le_type);
+
+--- pecl/newt/trunk/config.m4 2013/10/13 17:43:44 331807
++++ pecl/newt/trunk/config.m4 2013/10/13 17:54:46 331808
+@@ -32,12 +32,12 @@
+
+ if test "$PHP_CURSES_DIR" != "no"; then
+ for i in $PHP_CURSES_DIR /usr/local /usr; do
+- if test -f $i/lib/libncurses.$SHLIB_SUFFIX_NAME -o -f $i/lib/libncurses.a; then
+- PHP_ADD_LIBRARY_WITH_PATH(ncurses, $i/lib, NEWT_SHARED_LIBADD)
++ if test -f $i/$PHP_LIBDIR/libncurses.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libncurses.a; then
++ PHP_ADD_LIBRARY_WITH_PATH(ncurses, $i/$PHP_LIBDIR, NEWT_SHARED_LIBADD)
+ break
+ fi
+- if test -f $i/lib/libcurses.$SHLIB_SUFFIX_NAME -o -f $i/lib/libcurses.a; then
+- PHP_ADD_LIBRARY_WITH_PATH(curses, $i/lib, NEWT_SHARED_LIBADD)
++ if test -f $i/$PHP_LIBDIR/libcurses.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libcurses.a; then
++ PHP_ADD_LIBRARY_WITH_PATH(curses, $i/$PHP_LIBDIR, NEWT_SHARED_LIBADD)
+ break
+ fi
+ done
+@@ -45,8 +45,8 @@
+
+ if test "$PHP_SLANG_DIR" != "no"; then
+ for i in $PHP_SLANG_DIR /usr/local /usr; do
+- if test -f $i/lib/libslang.$SHLIB_SUFFIX_NAME -o -f $i/lib/libslang.a; then
+- PHP_ADD_LIBRARY_WITH_PATH(slang, $i/lib, NEWT_SHARED_LIBADD)
++ if test -f $i/$PHP_LIBDIR/libslang.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libslang.a; then
++ PHP_ADD_LIBRARY_WITH_PATH(slang, $i/$PHP_LIBDIR, NEWT_SHARED_LIBADD)
+ break
+ fi
+ done
+@@ -57,44 +57,44 @@
+ PHP_CHECK_LIBRARY(newt,newtInit,
+ [
+ PHP_ADD_INCLUDE($NEWT_DIR/include)
+- PHP_ADD_LIBRARY_WITH_PATH(newt, $NEWT_DIR/lib, NEWT_SHARED_LIBADD)
++ PHP_ADD_LIBRARY_WITH_PATH(newt, $NEWT_DIR/$PHP_LIBDIR, NEWT_SHARED_LIBADD)
+ AC_DEFINE(HAVE_NEWTLIB,1,[ ])
+ ],[
+ AC_MSG_ERROR([newt extension requires libnewt])
+ ],[
+- -L$NEWT_DIR/lib
++ -L$NEWT_DIR/$PHP_LIBDIR
+ ])
+
+ PHP_SUBST(NEWT_SHARED_LIBADD)
+
+- PHP_CHECK_LIBRARY(newt, newtListitem, [AC_DEFINE(HAVE_NEWT_LISTITEM,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtListitemSet, [AC_DEFINE(HAVE_NEWT_LISTITEM_SET,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtListitemGetData, [AC_DEFINE(HAVE_NEWT_LISTITEM_GET_DATA,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtResizeScreen, [AC_DEFINE(HAVE_NEWT_RESIZE_SCREEN,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtListboxItemCount, [AC_DEFINE(HAVE_NEWT_LISTBOX_ITEM_COUNT,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtSetHelpCallback, [AC_DEFINE(HAVE_NEWT_SET_HELP_CALLBACK,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtCursorOff, [AC_DEFINE(HAVE_NEWT_CURSOR_OFF,1,[ ])],, [-L$NEWT_DIR/lib])
+- PHP_CHECK_LIBRARY(newt, newtCursorOn, [AC_DEFINE(HAVE_NEWT_CURSOR_ON,1,[ ])],, [-L$NEWT_DIR/lib])
++ PHP_CHECK_LIBRARY(newt, newtListitem, [AC_DEFINE(HAVE_NEWT_LISTITEM,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtListitemSet, [AC_DEFINE(HAVE_NEWT_LISTITEM_SET,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtListitemGetData, [AC_DEFINE(HAVE_NEWT_LISTITEM_GET_DATA,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtResizeScreen, [AC_DEFINE(HAVE_NEWT_RESIZE_SCREEN,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtListboxItemCount, [AC_DEFINE(HAVE_NEWT_LISTBOX_ITEM_COUNT,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtSetHelpCallback, [AC_DEFINE(HAVE_NEWT_SET_HELP_CALLBACK,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtCursorOff, [AC_DEFINE(HAVE_NEWT_CURSOR_OFF,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
++ PHP_CHECK_LIBRARY(newt, newtCursorOn, [AC_DEFINE(HAVE_NEWT_CURSOR_ON,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeGetCurrent, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_GET_CURRENT,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_GET_CURRENT,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeSetCurrent, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_CURRENT,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_CURRENT,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeSetEntry, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_ENTRY,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_ENTRY,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeSetWidth, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_WIDTH,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_WIDTH,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeGetEntryValue, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_GET_ENTRY_VALUE,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_GET_ENTRY_VALUE,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ PHP_CHECK_LIBRARY(newt, newtCheckboxTreeSetEntryValue, [
+- AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_ENTRY_VALUE,1,[ ])],, [-L$NEWT_DIR/lib])
++ AC_DEFINE(HAVE_NEWT_CHECKBOX_TREE_SET_ENTRY_VALUE,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+- PHP_CHECK_LIBRARY(newt, newtFormSetTimer, [AC_DEFINE(HAVE_NEWT_FORM_SET_TIMER,1,[ ])],, [-L$NEWT_DIR/lib])
++ PHP_CHECK_LIBRARY(newt, newtFormSetTimer, [AC_DEFINE(HAVE_NEWT_FORM_SET_TIMER,1,[ ])],, [-L$NEWT_DIR/$PHP_LIBDIR])
+
+ AC_MSG_CHECKING([if newtExistStruct has u.watch])
+
diff --git a/php-pecl-newt.spec b/php-pecl-newt.spec
new file mode 100644
index 0000000..012aab8
--- /dev/null
+++ b/php-pecl-newt.spec
@@ -0,0 +1,179 @@
+# spec file for php-pecl-newt
+#
+# Copyright (c) 2013 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/3.0/
+#
+# Please, preserve the changelog entries
+#
+%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
+%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+
+%global with_zts 0%{?__ztsphp:1}
+%global pecl_name newt
+
+Summary: Extension for Red Hat Newt window library
+Name: php-pecl-%{pecl_name}
+Version: 1.2.6
+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
+
+# https://bugs.php.net/65889 Please Provides LICENSE file
+# Link from the headers
+Source1: http://www.php.net/license/3_0.txt
+
+# http://svn.php.net/viewvc?view=revision&revision=331792 to 331797
+# http://svn.php.net/viewvc?view=revision&revision=331801
+# http://svn.php.net/viewvc?view=revision&revision=331808
+Patch0: %{pecl_name}-svn.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: php-devel
+BuildRequires: php-pear
+BuildRequires: newt-devel
+
+Requires(post): %{__pecl}
+Requires(postun): %{__pecl}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+
+Provides: php-%{pecl_name} = %{version}
+Provides: php-%{pecl_name}%{?_isa} = %{version}
+Provides: php-pecl(%{pecl_name}) = %{version}
+Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
+
+# Filter shared private
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+
+
+%description
+HP-NEWT - PHP language extension for Red Hat Newt library,
+a terminal-based window and widget library for writing applications
+with user friendly interface. Once this extension is enabled in PHP
+it will provide the use of Newt widgets, such as windows, buttons,
+checkboxes, radiobuttons, labels, editboxes, scrolls, textareas,
+scales, etc.
+
+Use of this extension if very similar to the original
+Newt API of C programming language.
+
+
+%prep
+%setup -q -c
+mv %{pecl_name}-%{version} NTS
+
+cd NTS
+cp %{SOURCE1} LICENSE
+%patch0 -p3
+
+# Fix version
+sed -e '/PHP_NEWT_VERSION/s/1.2.3-dev/%{version}/' -i php_newt.h
+
+# Sanity check, really often broken
+extver=$(sed -n '/#define PHP_NEWT_VERSION/{s/.* "//;s/".*$//;p}' php_newt.h)
+if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever:-%{prever}}.
+ exit 1
+fi
+cd ..
+
+%if %{with_zts}
+# Duplicate source tree for NTS / ZTS build
+cp -pr NTS ZTS
+%endif
+
+# Create configuration file
+cat > %{pecl_name}.ini << 'EOF'
+; Enable %{pecl_name} 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 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+
+# 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 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
+
+
+%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
+cd NTS
+%{_bindir}/php --no-php-ini \
+ --define extension=modules/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+
+%if %{with_zts}
+: Minimal load test for ZTS extension
+cd ../ZTS
+%{__ztsphp} --no-php-ini \
+ --define extension=modules/%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%doc NTS/{LICENSE,CREDITS}
+%{pecl_xmldir}/%{name}.xml
+%config(noreplace) %{php_inidir}/%{pecl_name}.ini
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
+
+%changelog
+* Sun Oct 13 2013 Remi Collet <remi@fedoraproject.org> - 1.2.6-1
+- initial package, version 1.2.6 (stable)