--- /dev/null
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2011 SMBPhone Inc.
+# Copyright (C) 2019 Jeffery To
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=newt
+PKG_VERSION:=0.52.20
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://releases.pagure.org/newt
+PKG_HASH:=8d66ba6beffc3f786d4ccfee9d2b43d93484680ef8db9397a4fb70b5adbb6dbc
+
+PKG_LICENSE:=LGPL-2.0
+PKG_LICENSE_FILES:=COPYING
+PKG_CPE_ID:=cpe:/a:fedorahosted:newt
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/python/python3-package.mk
+
+define Package/newt/Default
+ TITLE:=Newt
+ URL:=https://pagure.io/newt
+endef
+
+define Package/newt/Default/description
+ 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.
+endef
+
+define Package/libnewt
+$(call Package/newt/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE+= library
+ DEPENDS:=+libslang2
+endef
+
+define Package/libnewt/description
+$(call Package/newt/Default/description)
+endef
+
+define Package/whiptail
+$(call Package/newt/Default)
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Display dialog boxes from shell scripts
+ DEPENDS:=+libnewt +libpopt +libslang2
+endef
+
+define Package/whiptail/description
+ A lightweight replacement for the dialog command (dialog boxes from shell
+ scripts), based on libnewt.
+endef
+
+define Package/python3-newt
+$(call Package/newt/Default)
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ TITLE+= module for Python
+ DEPENDS:=+libnewt +python3-light
+ VARIANT:=python3
+endef
+
+define Package/python3-newt/description
+$(call Package/newt/Default/description)
+
+ This is the Newt module for Python 3.
+endef
+
+TARGET_CFLAGS+= $(FPIC)
+
+CONFIGURE_ARGS+= \
+ --enable-largefile \
+ --with-python \
+ --without-tcl \
+ --without-gpm-support \
+ --with-colorsfile=/etc/newt/palette
+
+CONFIGURE_VARS+= PYTHONVERS="python$(PYTHON3_VERSION)"
+
+MAKE_VARS+= PYTHON_CONFIG_PATH="$(STAGING_DIR)/usr/bin"
+
+Build/Compile=$(call Build/Compile/Default,)
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/newt.h $(1)/usr/include/
+
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnewt.{a,so*} $(1)/usr/lib/
+
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnewt.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libnewt/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnewt.so* $(1)/usr/lib/
+endef
+
+define Package/whiptail/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/whiptail $(1)/usr/bin/
+endef
+
+# Don't install files from usr/bin
+Py3Package/python3-newt/install:=:
+
+$(eval $(call BuildPackage,libnewt))
+$(eval $(call BuildPackage,whiptail))
+
+$(eval $(call Py3Package,python3-newt))
+$(eval $(call BuildPackage,python3-newt))
+$(eval $(call BuildPackage,python3-newt-src))
--- /dev/null
+--- 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
+
--- /dev/null
+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;