libncurses: Import https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz changes

Change-Id: I3433d30ca01359fd2e3623ede96b531f0b39cbfa
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/test/package/debian/rules b/test/package/debian/rules
index bed7a82..2cc34f7 100755
--- a/test/package/debian/rules
+++ b/test/package/debian/rules
@@ -1,5 +1,5 @@
 #!/usr/bin/make -f
-# MAde with the aid of dh_make, by Craig Small
+# Made with the aid of dh_make, by Craig Small
 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
 # Some lines taken from debmake, by Cristoph Lameter.
 
@@ -18,7 +18,9 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CFLAGS =
+CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
+LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS += -O0
@@ -32,7 +34,9 @@
 verbose = # -v
 
 configure = \
-	CFLAGS="$(CFLAGS)" ../../configure \
+	CFLAGS="$(CFLAGS)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	LDFLAGS="$(LDFLAGS)" ../../configure \
 		--host=$(DEB_HOST_GNU_TYPE) \
 		--build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=/usr \
@@ -70,7 +74,7 @@
 	mkdir -p t/ncurses6
 
 	cd t/ncurses6; $(configure) \
-		--bindir=\$${prefix}/bin/$(NCURSES_PKG) \
+		--datadir=\$${datarootdir}/$(NCURSES_PKG) \
 		--with-screen=ncursesw6
 
 	touch $@
@@ -82,7 +86,7 @@
 	mkdir -p t/ncursest6
 
 	cd t/ncursest6; $(configure) \
-		--bindir=\$${prefix}/bin/$(NCURSEST_PKG) \
+		--datadir=\$${datarootdir}/$(NCURSEST_PKG) \
 		--with-screen=ncursestw6
 
 	touch $@
@@ -107,7 +111,9 @@
 	dh_installdirs $(verbose)
 	dh_prep        $(verbose) -p$(NCURSES_PKG)
 
-	$(MAKE) -C t/ncurses6 install DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG)
+	$(MAKE) -C t/ncurses6 install \
+		PACKAGE=$(NCURSES_PKG) \
+		DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG)
 
 	touch $@
 
@@ -117,7 +123,9 @@
 	dh_installdirs $(verbose)
 	dh_prep        $(verbose) -p$(NCURSEST_PKG)
 
-	$(MAKE) -C t/ncursest6 install DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG)
+	$(MAKE) -C t/ncursest6 install \
+		PACKAGE=$(NCURSEST_PKG) \
+		DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG)
 
 	touch $@
 
@@ -145,6 +153,7 @@
 	rm -f $(PACKAGES.arch:%=install-%-stamp)
 	dh_testdir
 	dh_testroot
+	dh_installdocs       $(verbose) $(PACKAGES.arch:%=-p%)
 	dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
 	dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
 	dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)