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/package/debian/changelog b/package/debian/changelog
index 36464e0..12ba6fb 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,10 +1,10 @@
-ncurses6 (6.0+20150808) unstable; urgency=low
+ncurses6 (6.5+20240427) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Thu, 06 Aug 2015 19:13:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 27 Apr 2024 09:56:53 -0400
 
-ncurses6 (5.9-20120608) unstable; urgency=low
+ncurses6 (5.9+20120608) unstable; urgency=low
 
   * initial release
 
diff --git a/package/debian/compat b/package/debian/compat
index 7ed6ff8..48082f7 100644
--- a/package/debian/compat
+++ b/package/debian/compat
@@ -1 +1 @@
-5
+12
diff --git a/package/debian/control b/package/debian/control
index 4c6e82c..3592191 100644
--- a/package/debian/control
+++ b/package/debian/control
@@ -2,13 +2,13 @@
 Section: libdevel
 Priority: optional
 Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
-Homepage: http://invisible-island.net/ncurses/
-Build-Depends: debhelper (>= 7)
-Standards-Version: 3.8.2
+Homepage: https://invisible-island.net/ncurses/
+Build-Depends: debhelper (>= 8.1.3)
+Standards-Version: 4.6.1.0
 
 Package: ncurses6
 Architecture: any
-Depends: ${misc:Depends}
+Depends: ${misc:Depends}, libc6 (>= 2.4)
 Description: shared libraries for terminal handling
  The ncurses library routines are a terminal-independent method of
  updating character screens with reasonable optimization.
@@ -17,9 +17,28 @@
 
 Package: ncursest6
 Architecture: any
-Depends: ${misc:Depends}
+Depends: ${misc:Depends}, libc6 (>= 2.4)
 Description: shared libraries for terminal handling
  The ncurses library routines are a terminal-independent method of
  updating character screens with reasonable optimization.
  .
  This package is used for testing ABI 6 with pthreads.
+
+Package: ncurses6-doc
+Section: doc
+Architecture: all
+Depends: groff-base
+Description: shared libraries for terminal handling
+ The ncurses library routines are a terminal-independent method of
+ updating character screens with reasonable optimization.
+ .
+ This package is used for testing ncurses6 document packaging.
+
+Package: ncurses6-doc-html
+Section: doc
+Architecture: all
+Description: shared libraries for terminal handling
+ The ncurses library routines are a terminal-independent method of
+ updating character screens with reasonable optimization.
+ .
+ This package is used for testing ncurses6 document packaging.
diff --git a/package/debian/copyright b/package/debian/copyright
index 43cb3e5..3239664 100644
--- a/package/debian/copyright
+++ b/package/debian/copyright
@@ -1,20 +1,21 @@
-Upstream source http://invisible-island.net/ncurses/ncurses.html
+Upstream source https://invisible-island.net/ncurses/ncurses.html
 This package is used for testing builds of ncurses.
 
 Current ncurses maintainer: Thomas Dickey <dickey@invisible-island.net>
 
 -------------------------------------------------------------------------------
 Files: *
-Copyright: 1998-2014,2015 Free Software Foundation, Inc.
-Licence: X11
+Copyright: 2017-2023,2024 by Thomas E. Dickey
+Copyright: 1998-2016,2017 Free Software Foundation, Inc.
+License: X11
 
 Files: aclocal.m4 package
-Copyright: 1996-2014,2015 by Thomas E. Dickey
-Licence: X11
+Copyright: 1996-2023,2024 by Thomas E. Dickey
+License: X11
 
 Files: doc/html/NCURSES-Programming-HOWTO.html
 Copyright: 2001 by Pradeep Padala
-Licence: X11
+License: X11
 
     Permission is hereby granted, free of charge, to any person obtaining a
     copy of this software and associated documentation files (the
@@ -43,7 +44,7 @@
 -------------------------------------------------------------------------------
 Files: install-sh
 Copyright:  1994 X Consortium
-Licence: X11
+License: X11
 
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to
diff --git a/package/debian/ncurses6.lintian-overrides b/package/debian/ncurses6.lintian-overrides
new file mode 100644
index 0000000..8bd4945
--- /dev/null
+++ b/package/debian/ncurses6.lintian-overrides
@@ -0,0 +1,9 @@
+# This is intentional.
+ncurses6: package-name-doesnt-match-sonames libformw6-6 libmenuw6-6 libncurses++w6-6 libncursesw6-6 libpanelw6-6 libticw6-6 libtinfow6-6
+
+# This is intentional.
+ncurses6: binary-without-manpage
+ncurses6: non-dev-pkg-with-shlib-symlink
+ncurses6: embedded-library ncurses [usr/lib/x86_64-linux-gnu/libtinfow6.so.6.4]
+
+# vile: confmode
diff --git a/package/debian/ncurses6.triggers b/package/debian/ncurses6.triggers
new file mode 100644
index 0000000..dd86603
--- /dev/null
+++ b/package/debian/ncurses6.triggers
@@ -0,0 +1 @@
+activate-noawait ldconfig
diff --git a/package/debian/ncursest6.lintian-overrides b/package/debian/ncursest6.lintian-overrides
new file mode 100644
index 0000000..5a1b83b
--- /dev/null
+++ b/package/debian/ncursest6.lintian-overrides
@@ -0,0 +1,9 @@
+# This is intentional.
+ncursest6: package-name-doesnt-match-sonames libformtw6-6 libmenutw6-6 libncurses++tw6-6 libncursestw6-6 libpaneltw6-6 libtictw6-6 libtinfotw6-6
+
+# This is intentional.
+ncursest6: binary-without-manpage
+ncursest6: non-dev-pkg-with-shlib-symlink
+ncursest6: embedded-library ncurses [usr/lib/x86_64-linux-gnu/libtinfotw6.so.6.4]
+
+# vile: confmode
diff --git a/package/debian/ncursest6.triggers b/package/debian/ncursest6.triggers
new file mode 100644
index 0000000..dd86603
--- /dev/null
+++ b/package/debian/ncursest6.triggers
@@ -0,0 +1 @@
+activate-noawait ldconfig
diff --git a/package/debian/rules b/package/debian/rules
index e77fd69..648939b 100755
--- a/package/debian/rules
+++ b/package/debian/rules
@@ -1,35 +1,41 @@
 #!/usr/bin/make -f
-# 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.
+# $Id: rules,v 1.53 2024/04/08 15:31:32 tom Exp $
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+SHELL = /bin/bash
+DPKG_EXPORT_BUILDFLAGS = 1
+
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+include /usr/share/dpkg/buildflags.mk
+
 # packages
-PACKAGES.indep = # ncurses6-docs
+PACKAGES.indep = ncurses6-doc ncurses6-doc-html
 PACKAGES.arch  = ncurses6 ncursest6
 
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
 CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
 
 MY_ABI=6
 MY_DIR=/usr
+BINDIR=$(MY_DIR)/bin
+LIBDIR=$(MY_DIR)/lib/$(DEB_HOST_MULTIARCH)
 MYDATA=/usr/local/ncurses/share/terminfo
 NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI)
 THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI)
 
-CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
-CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
-LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
+CFLAGS   += $(CC_NORMAL)
 
 ifneq ($(MY_DIR),/usr)
-	RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
+	RPATH_ENV = RPATH_LIST=../lib:$(LIBDIR)
 	RPATH_OPT = --enable-rpath
 else
 	RPATH_ENV =
@@ -55,33 +61,47 @@
 		--host=$(DEB_HOST_GNU_TYPE) \
 		--build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=$(MY_DIR) \
-		--with-default-terminfo-dir=$(MYDATA) \
-		--with-terminfo-dirs=$(MYDATA):/usr/share/terminfo \
+		--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
 		--disable-echo \
 		--disable-getcap \
 		--disable-leaks \
 		--disable-macros  \
 		--disable-overwrite  \
+		--disable-relink \
+		--disable-root-access \
+		--disable-root-environ \
 		--disable-termcap \
+		--enable-check-size \
 		--enable-hard-tabs \
+		--enable-opaque-curses \
+		--enable-opaque-form \
+		--enable-opaque-menu \
+		--enable-opaque-panel \
 		--enable-pc-files \
+		--enable-stdnoreturn \
 		--enable-warnings \
 		--enable-wgetch-events \
 		--enable-widec \
+		--enable-xmc-glitch \
 		--program-suffix=$(MY_ABI) \
 		--verbose \
 		--with-abi-version=$(MY_ABI) \
+		--with-config-suffix=dev \
+		--with-cxx-shared \
+		--with-default-terminfo-dir=$(MYDATA) \
 		--with-develop \
 		--with-extra-suffix=$(MY_ABI) \
 		--with-shared \
+		--with-terminfo-dirs=$(MYDATA):/lib/terminfo:/usr/share/terminfo \
 		--with-termlib \
 		--with-ticlib \
 		--with-trace \
-		--with-cxx-shared \
 		--with-versioned-syms \
 		--with-xterm-kbs=DEL \
 		--without-ada \
 		--without-debug \
+		--with-manpage-aliases \
+		--with-manpage-symlinks \
 		--without-normal
 
 NCURSES6_DIR = $(CURDIR)/debian/ncurses6
@@ -112,14 +132,29 @@
 install-indep: $(PACKAGES.indep:%=install-%-stamp)
 install-arch: $(PACKAGES.arch:%=install-%-stamp)
 
-config-ncurses6-stamp:
+# make the doc-package installable by renaming everything to avoid clashing
+patch-ncurses6-stamp:
+	dh_testdir
+	sed -i.bak \
+		-e 's/-config\.1$$/dev-config.1/;t' \
+		-e 's/\.3ncurses$$/.3ncurses6/' \
+		-e 's/\.3curses$$/.3curses6/' \
+		-e 's/\.3form$$/.3form6/' \
+		-e 's/\.3menu$$/.3menu6/' \
+		-e 's/\.3panel$$/.3panel6/' \
+		-e 's/\.\([157]\)$$/6.\1/' \
+		man/man_db.renames.in
+	diff -u man/man_db.renames.in.bak man/man_db.renames.in || true
+	touch $@
+
+config-ncurses6-stamp: patch-ncurses6-stamp
 	dh_testdir
 	rm -rf t/ncurses6
 	mkdir -p t/ncurses6
 	cd t/ncurses6; $(configure)
 	touch $@
 
-config-ncursest6-stamp:
+config-ncursest6-stamp: patch-ncurses6-stamp
 	dh_testdir
 	rm -rf t/ncursest6
 	mkdir -p t/ncursest6
@@ -130,6 +165,10 @@
 		--with-pthread
 	touch $@
 
+config-ncurses6-doc-stamp \
+config-ncurses6-doc-html-stamp: config-ncurses6-stamp
+	touch $@
+
 build-ncurses6-stamp: config-ncurses6-stamp
 	dh_testdir
 
@@ -144,6 +183,10 @@
 
 	touch $@
 
+build-ncurses6-doc-stamp \
+build-ncurses6-doc-html-stamp: build-ncurses6-stamp
+	touch $@
+
 install-ncurses6-stamp: build-ncurses6-stamp
 	dh_testdir
 	dh_testroot
@@ -151,9 +194,9 @@
 	dh_prep        $(verbose) -pncurses6
 
 	$(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
-	$(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
+	$(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(LIBDIR)
 
-	mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
+	mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(BINDIR)/ncurses$(MY_ABI)
 
 	touch $@
 
@@ -164,9 +207,36 @@
 	dh_prep        $(verbose) -pncursest6
 
 	$(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
-	$(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
+	$(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(LIBDIR)
 
-	mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
+	mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(BINDIR)/ncursest$(MY_ABI)
+
+	touch $@
+
+install-ncurses6-doc-stamp: build-ncurses6-stamp
+	dh_testdir
+	dh_testroot
+	dh_installdirs $(verbose)
+	dh_prep        $(verbose) -pncurses6-doc
+
+	$(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc
+	find $(NCURSES6_DIR)-doc -name 'ncursesw6-config.*' -print -delete
+
+	cd $(NCURSES6_DIR)-doc/usr/share/man/man1 && ln -sf tset6.1.gz reset6.1.gz
+
+	touch $@
+
+HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/doc/ncurses6-doc-html
+install-ncurses6-doc-html-stamp: build-ncurses6-stamp
+	dh_testdir
+	dh_testroot
+	dh_installdirs $(verbose)
+	dh_prep        $(verbose) -pncurses6-doc-html
+
+	cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
+	cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}
+	find $(HTML_DESTDIR) -type d -empty -delete -print
+	find $(HTML_DESTDIR) -type d -empty -delete -print
 
 	touch $@
 
@@ -176,6 +246,7 @@
 	rm -f $(PACKAGES.indep:%=install-%-stamp)
 	dh_testdir
 	dh_testroot
+	dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
 	dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
 	dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
 	dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
@@ -194,6 +265,15 @@
 	rm -f $(PACKAGES.arch:%=install-%-stamp)
 	dh_testdir
 	dh_testroot
+
+	version=`set -x; awk 'BEGIN{major=minor=0} /^NCURSES_MAJOR/{major=$$3} /^NCURSES_MINOR/{minor=$$3} END{print major "." minor}' < dist.mk`; \
+	sed -i \
+		-e "s, usr/lib, usr/lib/$(DEB_HOST_MULTIARCH)," \
+		-e "s,6\.1,$${version}," \
+		debian/*.lintian-overrides
+
+	dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
+	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%)
diff --git a/package/debian/watch b/package/debian/watch
index 945a996..f6b3987 100644
--- a/package/debian/watch
+++ b/package/debian/watch
@@ -1,4 +1,4 @@
 version=3
 
-opts=passive ftp://invisible-island.net/ncurses/current/ncurses\.tar.gz \
+opts=passive ftp://ftp.invisible-island.net/ncurses/current/ncurses\.tar.gz \
  debian  uupdate