newt: Add new package

From the README:
Newt is a programming library for color text mode, widget based user
interfaces.  Newt can be used to add stacked windows, entry widgets,
checkboxes, radio buttons, labels, plain text fields, scrollbars,
etc., to text mode user interfaces.  Newt is based on the slang library.

Adapted from the old packages feed:
https://git.openwrt.org/?p=openwrt/svn-archive/packages.git;a=tree;f=libs/newt

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To
2019-04-30 20:35:13 +08:00
parent 46a658748d
commit 80c95fc082
5 changed files with 222 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
--- a/configure
+++ b/configure
@@ -3957,7 +3957,6 @@ if test "x$with_python" = "xno"; then
$as_echo "skipped" >&6; }
PYTHONVERS=
else
- PYTHONVERS=$(ls /usr/include/python*/Python.h 2> /dev/null | sed 's|.*\(python[0-9]*\.[0-9]*\).*|\1|g' | tr '\n' ' ')
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHONVERS" >&5
$as_echo "$PYTHONVERS" >&6; }
fi
@@ -0,0 +1,25 @@
--- a/Makefile.in
+++ b/Makefile.in
@@ -84,12 +84,7 @@ showkey: showkey.o $(LIBNEWT)
_snack.$(SOEXT): snack.c $(LIBNEWTSH)
@[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS); do \
- pyconfig=$$ver-config; \
- if ! $$pyconfig --cflags > /dev/null 2>&1 && \
- python-config --cflags > /dev/null 2>&1; then \
- echo $$pyconfig not found, using python-config; \
- pyconfig=python-config; \
- fi; \
+ pyconfig=$(PYTHON_CONFIG_PATH)/$$ver-config; \
mkdir -p $$ver; \
PCFLAGS=`$$pyconfig --cflags`; \
PIFLAGS=`$$pyconfig --includes`; \
@@ -109,7 +104,7 @@ whiptcl.$(SOEXT): $(WHIPTCLOBJS) $(LIBNE
$(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.$(SOEXT) $(WHIPTCLOBJS) -L. -lnewt $(LIBTCL) -lpopt $(LIBS)
$(LIBNEWT): $(LIBOBJS)
- ar rv $@ $^
+ $(AR) rv $@ $^
newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
+24
View File
@@ -0,0 +1,24 @@
Author: Alastair McKinstry <mckinstry@debian.org>
Description: newtInit() should only be called once
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557960
Forwarded: no
Last-Updated: 2014-06-11
--- a/snack.c
+++ b/snack.c
@@ -377,10 +377,15 @@ static snackWidget * snackWidgetNew (voi
}
static PyObject * initScreen(PyObject * s, PyObject * args) {
+ static int init_newt = 1;
suspend.cb = NULL;
suspend.data = NULL;
newtInit();
+ if (init_newt) {
+ newtInit();
+ init_newt = 0;
+ }
newtCls();
Py_INCREF(Py_None);
@@ -0,0 +1,35 @@
Author: Thomas Viehmann <tv@beamnet.de>
Description: Fix for python memory handling
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=445392
Last-Updated: 2014-06-11
Forwarded: no
--- a/snack.c
+++ b/snack.c
@@ -366,7 +366,7 @@ static PyTypeObject snackWidgetType = {
static snackWidget * snackWidgetNew (void) {
snackWidget * widget;
- widget = PyObject_NEW(snackWidget, &snackWidgetType);
+ widget = PyObject_New(snackWidget, &snackWidgetType);
if (!widget)
return NULL;
@@ -937,7 +937,7 @@ static snackForm * formCreate(PyObject *
if (help == Py_None)
help = NULL;
- form = PyObject_NEW(snackForm, &snackFormType);
+ form = PyObject_New(snackForm, &snackFormType);
form->fo = newtForm(NULL, help, 0);
return form;
@@ -949,7 +949,7 @@ static snackGrid * gridCreate(PyObject *
if (!PyArg_ParseTuple(args, "ii", &cols, &rows)) return NULL;
- grid = PyObject_NEW(snackGrid, &snackGridType);
+ grid = PyObject_New(snackGrid, &snackGridType);
grid->grid = newtCreateGrid(cols, rows);
return grid;