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/Ada95/package/AdaCurses-doc.spec b/Ada95/package/AdaCurses-doc.spec
index 92c96ac..c5b68dd 100644
--- a/Ada95/package/AdaCurses-doc.spec
+++ b/Ada95/package/AdaCurses-doc.spec
@@ -3,13 +3,13 @@
 %define AppVersion MAJOR.MINOR
 %define AppRelease YYYYMMDD
 %define AppPackage %{AppProgram}-doc
-# $Id: AdaCurses-doc.spec,v 1.3 2015/04/26 23:39:31 tom Exp $
+# $Id: AdaCurses-doc.spec,v 1.7 2019/11/23 21:15:53 tom Exp $
 Name: %{AppPackage}
 Version: %{AppVersion}
 Release: %{AppRelease}
 License: MIT
 Group: Applications/Development
-URL: ftp://invisible-island.net/%{AppProgram}
+URL: ftp://ftp.invisible-island.net/%{AppProgram}
 Source0: %{AppProgram}-%{AppRelease}.tgz
 Packager: Thomas Dickey <dickey@invisible-island.net>
 
@@ -25,11 +25,11 @@
 %build
 
 INSTALL_PROGRAM='${INSTALL}' \
-	./configure \
-		--target %{_target_platform} \
-		--prefix=%{_prefix} \
-		--datadir=%{_datadir} \
-		--with-ada-sharedlib
+%configure \
+	--target %{_target_platform} \
+	--prefix=%{_prefix} \
+	--datadir=%{_datadir} \
+	--with-ada-sharedlib
 
 %install
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
@@ -37,14 +37,25 @@
 (cd doc && make install.html DESTDIR=$RPM_BUILD_ROOT )
 
 %clean
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+if rm -rf $RPM_BUILD_ROOT; then
+  echo OK
+else
+  find $RPM_BUILD_ROOT -type f | grep -F -v /.nfs && exit 1
+fi
+exit 0
 
 %files
 %defattr(-,root,root)
-%{_datadir}/doc/AdaCurses
+%{_datadir}/doc/%{AppProgram}
 
 %changelog
 # each patch should add its ChangeLog entries here
 
+* Sat Nov 16 2019 Thomas Dickey
+- modify clean-rule to work around Fedora NFS bugs.
+
+* Sat Sep 07 2019 Thomas Dickey
+- use AppProgram to replace "AdaCurses" globally
+
 * Sat Mar 26 2011 Thomas Dickey
 - initial version
diff --git a/Ada95/package/AdaCurses.spec b/Ada95/package/AdaCurses.spec
index 4e2354c..540e8e5 100644
--- a/Ada95/package/AdaCurses.spec
+++ b/Ada95/package/AdaCurses.spec
@@ -1,14 +1,14 @@
-Summary: AdaCurses - Ada95 binding for ncurses
+Summary: Ada95 binding for ncurses
 %define AppProgram AdaCurses
 %define AppVersion MAJOR.MINOR
 %define AppRelease YYYYMMDD
-# $Id: AdaCurses.spec,v 1.15 2015/04/26 23:55:55 tom Exp $
+# $Id: AdaCurses.spec,v 1.31 2022/12/18 00:08:17 tom Exp $
 Name: %{AppProgram}
 Version: %{AppVersion}
 Release: %{AppRelease}
 License: MIT
 Group: Applications/Development
-URL: ftp://invisible-island.net/%{AppProgram}
+URL: ftp://ftp.invisible-island.net/%{AppProgram}
 Source0: %{AppProgram}-%{AppRelease}.tgz
 Packager: Thomas Dickey <dickey@invisible-island.net>
 
@@ -17,63 +17,115 @@
 patch-date YYYYMMDD.
 
 In addition to a library, this package installs sample programs in
-"bin/AdaCurses" to avoid conflict with other packages.
+"bin/%{AppProgram}" to avoid conflict with other packages.
 %prep
 
+%global is_mandriva %(test -f /etc/mandriva-release && echo 1 || echo 0)
+%global is_redhat   %(test -f /etc/redhat-release && echo 1 || echo 0)
+%global is_suse     %(if grep -E -i '(opensuse)' /etc/issue >/dev/null; then echo 1; else echo 0; fi)
+
 %define debug_package %{nil}
 
+%define need_filter %(if grep -E -i '(red hat|fedora)' /etc/issue >/dev/null; then echo 1; elif test -f /etc/fedora-release; then echo 1; else echo 0; fi)
+
+%if %{need_filter} == 1
 # http://fedoraproject.org/wiki/EPEL:Packaging_Autoprovides_and_Requires_Filtering
-%filter_from_requires /libAdaCurses.so.1/d
+%filter_from_requires /lib%{AppProgram}.so.1/d
 %filter_setup
+%endif
 
 %setup -q -n %{AppProgram}-%{AppRelease}
 
 %build
 
-%define ada_libdir %{_prefix}/lib/ada/adalib
+%define ada_libdir %{_libdir}/ada/adalib
+%define ada_include %{_prefix}/share/ada/adainclude
+
+%if %{is_mandriva}
+# Mageia 8 lacks gprbuild, needed for building shared libraries.
+%define ada_model --without-shared --without-ada-sharedlib --with-ada-objects=%{_libdir}/adalib
+%else
+# OpenSUSE actually lacks gprbuild, but there is a workable "community" package.
+%define ada_model --with-shared --with-ada-sharedlib
+%if %{is_redhat}
+# Fedora 36 LTO does not work with gprbuild system configuration.
+unset CFLAGS
+unset LDFLAGS
+unset LT_SYS_LIBRARY_PATH
+%endif
+%endif
 
 INSTALL_PROGRAM='${INSTALL}' \
-	./configure \
+	./configure %{ada_model} \
 		--target %{_target_platform} \
 		--prefix=%{_prefix} \
 		--bindir=%{_bindir} \
 		--libdir=%{_libdir} \
+		--libexecdir=%{_libexecdir} \
+		--with-ada-include=%{ada_include} \
+		--with-ada-objects=%{ada_libdir} \
 		--mandir=%{_mandir} \
 		--datadir=%{_datadir} \
 		--disable-rpath-link \
-		--with-shared \
-		--with-ada-sharedlib
+		--disable-echo \
+		--verbose \
+		--enable-warnings
 
 make
 
 %install
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
 
-make install               DESTDIR=$RPM_BUILD_ROOT
-
-( cd samples &&
-  make install.examples \
-  	DESTDIR=$RPM_BUILD_ROOT \
-	BINDIR=$RPM_BUILD_ROOT%{_bindir}/%{AppProgram}
-)
+make install DESTDIR=$RPM_BUILD_ROOT
+make install.examples DESTDIR=$RPM_BUILD_ROOT
 
 %clean
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+if rm -rf $RPM_BUILD_ROOT; then
+  echo OK
+else
+  find $RPM_BUILD_ROOT -type f | grep -F -v /.nfs && exit 1
+fi
+exit 0
 
 %files
 %defattr(-,root,root)
+%{_bindir}/%{AppProgram}
 %{_bindir}/adacurses*-config
-%{_bindir}/%{AppProgram}/*
-%{_libdir}/libAdaCurses.*
-%{ada_libdir}/libAdaCurses.*
-%{ada_libdir}/terminal_interface*
+%{_libexecdir}/%{AppProgram}/*
+%{ada_libdir}/
+%if %{need_filter} == 1
+%{_libdir}/lib%{AppProgram}.*
+%endif
+%if %{is_suse}
+%{_libdir}/lib%{AppProgram}.*
+%endif
 %{_mandir}/man1/adacurses*-config.1*
 %{_datadir}/%{AppProgram}/*
-%{_datadir}/ada/adainclude/terminal_interface*
+%{ada_include}/
 
 %changelog
 # each patch should add its ChangeLog entries here
 
+* Sat Dec 17 2022 Thomas Dickey
+- install sample programs in libexec
+
+* Sat Nov 19 2022 Thomas Dickey
+- use static libraries for Mageia.
+
+* Sat Nov 12 2022 Thomas Dickey
+- unset environment variables to work around Fedora LTO bugs.
+- build-fix for OpenSUSE with gprbuild.
+
+* Sat Nov 16 2019 Thomas Dickey
+- modify clean-rule to work around Fedora NFS bugs.
+
+* Sat Sep 14 2019 Thomas Dickey
+- build-fixes for Fedora29, OpenSUSE
+
+* Sat Sep 07 2019 Thomas Dickey
+- use AppProgram to replace "AdaCurses" globally
+- amend install-paths to work with Fedora30
+
 * Thu Mar 31 2011 Thomas Dickey
 - use --with-shared option for consistency with --with-ada-sharelib
 - ensure that MY_DATADIR is set when installing examples
diff --git a/Ada95/package/debian/compat b/Ada95/package/debian/compat
index 7ed6ff8..48082f7 100644
--- a/Ada95/package/debian/compat
+++ b/Ada95/package/debian/compat
@@ -1 +1 @@
-5
+12
diff --git a/Ada95/package/debian/control b/Ada95/package/debian/control
index 88af970..1a9aefd 100644
--- a/Ada95/package/debian/control
+++ b/Ada95/package/debian/control
@@ -2,14 +2,16 @@
 Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
 Section: misc
 Priority: optional
-Standards-Version: 3.8.4
-Build-Depends: debhelper (>= 5)
-Homepage: http://invisible-island.net/adacurses/
+Build-Depends: debhelper (>= 5),
+  gnat,
+  gprbuild
+Homepage: https://invisible-island.net/adacurses/
+Standards-Version: 4.6.1.0
 
 Package: adacurses
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: AdaCurses - Ada95 binding for ncurses
+Description: Ada95 binding for ncurses
  This package installs as "adacurses" to avoid conflict with other packages.
  This is the Ada95 binding from the ncurses distribution.
  .
diff --git a/Ada95/package/debian/copyright b/Ada95/package/debian/copyright
index b24950a..b406015 100644
--- a/Ada95/package/debian/copyright
+++ b/Ada95/package/debian/copyright
@@ -1,15 +1,16 @@
-Upstream source http://invisible-island.net/ncurses/ncurses-examples.html
+Upstream source https://invisible-island.net/ncurses/Ada95.html
 
 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: 2010-2014,2015 by Thomas E. Dickey
-Licence: X11
+Copyright: 2010-2023,2024 by Thomas E. Dickey
+License: X11
 
     Permission is hereby granted, free of charge, to any person obtaining a
     copy of this software and associated documentation files (the
@@ -38,7 +39,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/Ada95/package/debian/rules b/Ada95/package/debian/rules
index 5805f8b..0adde8d 100755
--- a/Ada95/package/debian/rules
+++ b/Ada95/package/debian/rules
@@ -12,9 +12,11 @@
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 TARGET_DIR = $(CURDIR)/debian/adacurses
-SAMPLE_DIR = $(TARGET_DIR)/usr/bin/AdaCurses
+SAMPLE_DIR = $(TARGET_DIR)/usr/libexec/AdaCurses
 
-CFLAGS =
+CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
+LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS += -O0
@@ -30,7 +32,9 @@
 configure-stamp:
 	dh_testdir
 
-	CFLAGS="$(CFLAGS)" ./configure \
+	CFLAGS="$(CFLAGS)" \
+	CPPFLAGS="$(CPPFLAGS)" \
+	LDFLAGS="$(LDFLAGS)" ./configure \
 		--host=$(DEB_HOST_GNU_TYPE) \
 		--build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=/usr \
@@ -63,11 +67,11 @@
 install-stamp: build-stamp
 	dh_testdir
 	dh_testroot
-	dh_clean -k
+	dh_prep
 	dh_installdirs
 
 	$(MAKE) install DESTDIR=$(TARGET_DIR)
-	
+
 	# FIXME: it would be nice to make these into separate packages
 	( cd samples && $(MAKE) install.examples DESTDIR=$(TARGET_DIR) BINDIR=$(SAMPLE_DIR) )
 	( cd doc && $(MAKE) install.html DESTDIR=$(TARGET_DIR) )
diff --git a/Ada95/package/debian/watch b/Ada95/package/debian/watch
index 4794ae3..1b870ba 100644
--- a/Ada95/package/debian/watch
+++ b/Ada95/package/debian/watch
@@ -1,4 +1,4 @@
 version=3
 
-opts=passive ftp://invisible-island.net/AdaCurses/AdaCurses-([\d.]+)\.tgz \
+opts=passive ftp://ftp.invisible-island.net/AdaCurses/AdaCurses-([\d.]+)\.tgz \
  debian  uupdate