diff --git a/packages/devel/ncurses/package.mk b/packages/devel/ncurses/package.mk
index a91f95e454..84531af439 100644
--- a/packages/devel/ncurses/package.mk
+++ b/packages/devel/ncurses/package.mk
@@ -17,7 +17,7 @@
################################################################################
PKG_NAME="ncurses"
-PKG_VERSION="5.7"
+PKG_VERSION="5.9"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="MIT"
diff --git a/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch b/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch
new file mode 100644
index 0000000000..2506bf31a6
--- /dev/null
+++ b/packages/devel/ncurses/patches/ncurses-20140308-20140323.patch
@@ -0,0 +1,204827 @@
+diff -Naur ncurses-5.9/aclocal.m4 ncurses-5.9.patch/aclocal.m4
+--- ncurses-5.9/aclocal.m4 2011-04-01 01:35:38.000000000 +0200
++++ ncurses-5.9.patch/aclocal.m4 2014-09-01 16:33:22.236791923 +0200
+@@ -1,5 +1,5 @@
+ dnl***************************************************************************
+-dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
++dnl Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ dnl *
+ dnl Permission is hereby granted, free of charge, to any person obtaining a *
+ dnl copy of this software and associated documentation files (the *
+@@ -28,7 +28,7 @@
+ dnl
+ dnl Author: Thomas E. Dickey 1995-on
+ dnl
+-dnl $Id: aclocal.m4,v 1.553 2011/03/31 23:35:38 tom Exp $
++dnl $Id: aclocal.m4,v 1.686 2014/02/10 00:37:02 tom Exp $
+ dnl Macros used in NCURSES auto-configuration script.
+ dnl
+ dnl These macros are maintained separately from NCURSES. The copyright on
+@@ -62,7 +62,33 @@
+ fi
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
++dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
++dnl ------------------
++dnl Conditionally generate script according to whether we're using a given autoconf.
++dnl
++dnl $1 = version to compare against
++dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
++dnl $3 = code to use if AC_ACVERSION is older than $1.
++define([CF_ACVERSION_CHECK],
++[
++ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
++ifdef([m4_version_compare],
++[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
++[CF_ACVERSION_COMPARE(
++AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
++AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
++dnl ---------------------------------------------------------------------------
++dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
++dnl --------------------
++dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
++dnl MAJOR2, MINOR2, TERNARY2,
++dnl PRINTABLE2, not FOUND, FOUND)
++define([CF_ACVERSION_COMPARE],
++[ifelse(builtin([eval], [$2 < $5]), 1,
++[ifelse([$8], , ,[$8])],
++[ifelse([$9], , ,[$9])])])dnl
++dnl ---------------------------------------------------------------------------
++dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
+ dnl -------------------
+ dnl Construct the list of include-options for the C programs in the Ada95
+ dnl binding.
+@@ -76,7 +102,7 @@
+ ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
+ elif test "$includedir" != "/usr/include"; then
+ if test "$includedir" = '${prefix}/include' ; then
+- if test $prefix != /usr ; then
++ if test x$prefix != x/usr ; then
+ ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
+ fi
+ else
+@@ -291,7 +317,7 @@
+ dnl $2 = variable to update (default $LIBS)
+ AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
++dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
+ dnl ------------------
+ dnl Append to a search-list for a nonstandard header/lib-file
+ dnl $1 = the variable to return as result
+@@ -301,9 +327,9 @@
+ dnl $5 = a directory that we do not want $4 to match
+ AC_DEFUN([CF_ADD_SUBDIR_PATH],
+ [
+-test "$4" != "$5" && \
++test "x$4" != "x$5" && \
+ test -d "$4" && \
+-ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
++ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
+ test -n "$verbose" && echo " ... testing for $3-directories under $4"
+ test -d $4/$3 && $1="[$]$1 $4/$3"
+ test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
+@@ -313,76 +339,6 @@
+ }
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
+-dnl ----------------
+-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
+-dnl in the sharutils 4.2 distribution.
+-AC_DEFUN([CF_ANSI_CC_CHECK],
+-[
+-AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
+-cf_cv_ansi_cc=no
+-cf_save_CFLAGS="$CFLAGS"
+-cf_save_CPPFLAGS="$CPPFLAGS"
+-# Don't try gcc -ansi; that turns off useful extensions and
+-# breaks some systems' header files.
+-# AIX -qlanglvl=ansi
+-# Ultrix and OSF/1 -std1
+-# HP-UX -Aa -D_HPUX_SOURCE
+-# SVR4 -Xc
+-# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
+-for cf_arg in "-DCC_HAS_PROTOS" \
+- "" \
+- -qlanglvl=ansi \
+- -std1 \
+- -Ae \
+- "-Aa -D_HPUX_SOURCE" \
+- -Xc
+-do
+- CF_ADD_CFLAGS($cf_arg)
+- AC_TRY_COMPILE(
+-[
+-#ifndef CC_HAS_PROTOS
+-#if !defined(__STDC__) || (__STDC__ != 1)
+-choke me
+-#endif
+-#endif
+-],[
+- int test (int i, double x);
+- struct s1 {int (*f) (int a);};
+- struct s2 {int (*f) (double a);};],
+- [cf_cv_ansi_cc="$cf_arg"; break])
+-done
+-CFLAGS="$cf_save_CFLAGS"
+-CPPFLAGS="$cf_save_CPPFLAGS"
+-])
+-
+-if test "$cf_cv_ansi_cc" != "no"; then
+-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
+- CF_ADD_CFLAGS($cf_cv_ansi_cc)
+-else
+- AC_DEFINE(CC_HAS_PROTOS)
+-fi
+-fi
+-])dnl
+-dnl ---------------------------------------------------------------------------
+-dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
+-dnl ---------------
+-dnl For programs that must use an ANSI compiler, obtain compiler options that
+-dnl will make it recognize prototypes. We'll do preprocessor checks in other
+-dnl macros, since tools such as unproto can fake prototypes, but only part of
+-dnl the preprocessor.
+-AC_DEFUN([CF_ANSI_CC_REQD],
+-[AC_REQUIRE([CF_ANSI_CC_CHECK])
+-if test "$cf_cv_ansi_cc" = "no"; then
+- AC_MSG_ERROR(
+-[Your compiler does not appear to recognize prototypes.
+-You have the following choices:
+- a. adjust your compiler options
+- b. get an up-to-date compiler
+- c. use a wrapper such as unproto])
+-fi
+-])dnl
+-dnl ---------------------------------------------------------------------------
+ dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
+ dnl --------------
+ dnl Allow user to disable a normally-on option.
+@@ -465,7 +421,7 @@
+ AC_SUBST(ARFLAGS)
+ ])
+ dnl ---------------------------------------------------------------------------
+-dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
++dnl CF_AWK_BIG_PRINTF version: 4 updated: 2011/10/30 17:09:50
+ dnl -----------------
+ dnl Check if awk can handle big strings using printf. Some older versions of
+ dnl awk choke on large strings passed via "%s".
+@@ -479,8 +435,8 @@
+ eval $2=no
+ ;;
+ *) #(vi
+- if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
+- | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
++ if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
++ | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
+ eval $2=yes
+ else
+ eval $2=no
+@@ -536,7 +492,7 @@
+ fi
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
++dnl CF_BOOL_SIZE version: 13 updated: 2013/04/13 18:03:21
+ dnl ------------
+ dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
+ dnl Don't bother looking for bool.h, since it's been deprecated.
+@@ -570,7 +526,7 @@
+
+ #endif
+
+-main()
++int main()
+ {
+ FILE *fp = fopen("cf_test.out", "w");
+ if (fp != 0) {
+@@ -604,7 +560,7 @@
+ fi
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
++dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
+ dnl -----------
+ dnl If we're cross-compiling, allow the user to override the tools and their
+ dnl options. The configure script is oriented toward identifying the host
+@@ -614,7 +570,8 @@
+ dnl $1 = default for $CPPFLAGS
+ dnl $2 = default for $LIBS
+ AC_DEFUN([CF_BUILD_CC],[
+-AC_REQUIRE([CF_PROG_EXT])
++CF_ACVERSION_CHECK(2.52,,
++ [AC_REQUIRE([CF_PROG_EXT])])
+ if test "$cross_compiling" = yes ; then
+
+ # defaults that we might want to override
+@@ -695,7 +652,33 @@
+ AC_SUBST(BUILD_OBJEXT)
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
++dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
++dnl ---------------
++dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
++dnl into CC. This will not help with broken scripts that wrap the compiler with
++dnl options, but eliminates a more common category of user confusion.
++AC_DEFUN([CF_CC_ENV_FLAGS],
++[
++# This should have been defined by AC_PROG_CC
++: ${CC:=cc}
++
++AC_MSG_CHECKING(\$CC variable)
++case "$CC" in #(vi
++*[[\ \ ]]-[[IUD]]*)
++ AC_MSG_RESULT(broken)
++ AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
++ # humor him...
++ cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
++ CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
++ CF_ADD_CFLAGS($cf_flags)
++ ;;
++*)
++ AC_MSG_RESULT(ok)
++ ;;
++esac
++])dnl
++dnl ---------------------------------------------------------------------------
++dnl CF_CFG_DEFAULTS version: 10 updated: 2013/09/07 13:54:05
+ dnl ---------------
+ dnl Determine the default configuration into which we'll install ncurses. This
+ dnl can be overridden by the user's command-line options. There's two items to
+@@ -713,7 +696,7 @@
+ if test "x$prefix" = "xNONE" ; then
+ case "$cf_cv_system_name" in
+ # non-vendor systems don't have a conflict
+- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
++ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
+ prefix=/usr
+ ;;
+ *) prefix=$ac_default_prefix
+@@ -749,30 +732,51 @@
+ fi
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+-dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
++dnl CF_CGETENT version: 5 updated: 2012/10/06 17:56:13
+ dnl ----------
+ dnl Check if the terminal-capability database functions are available. If not,
+ dnl ncurses has a much-reduced version.
+ AC_DEFUN([CF_CGETENT],[
+-AC_MSG_CHECKING(for terminal-capability database functions)
+-AC_CACHE_VAL(cf_cv_cgetent,[
++AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
+ AC_TRY_LINK([
+ #include The ncurses (new curses) library is a free software emulation
++ of curses in System V Release 4.0, and more. It uses terminfo
++ format, supports pads and color and multiple highlights and forms
++ characters and function-key mapping, and has all the other
++ SYSV-curses enhancements over BSD curses. In mid-June 1995, the maintainer of 4.4BSD curses declared
+ that he considered 4.4BSD curses obsolete, and encouraged the
+@@ -73,38 +74,50 @@
+ It is also available at ftp://invisible-island.net/ncurses/ .
+- This is a bug-fix release, correcting a small number of urgent problems
+- in the ncurses library from the 5.8 release.
+-
+- It also improves the Ada95 binding:
++ This release is designed to be upward compatible from ncurses
++ 5.0 through 5.8; very few applications will require
++ recompilation, depending on the platform. These are the
++ highlights from the change-log since ncurses 5.8 release. This is a bug-fix release, correcting a small number of urgent
++ problems in the ncurses library from the 5.8 release. It also improves the Ada95 binding: Those were a proof of concept. For the 5.9 release, those
+- scripts are augmented with rpm- and dpkg-scripts used in test builds
+- against a variety of gnat- and system ncurses versions as old as
+- gnat 3.15 and ncurses 5.4 (see snapshots and systems tested
+- here.
+- Those were a proof of concept. For the 5.9 release, those
++ scripts are augmented with rpm- and dpkg-scripts used in test
++ builds against a variety of gnat- and system ncurses versions
++ as old as gnat 3.15 and ncurses 5.4 (see snapshots and
++ systems tested here. The ncurses package is fully compatible with SVr4 (System V
++ Release 4) curses: The ncurses package also has many useful extensions over
++ SVr4: Numerous bugs present in earlier versions have been fixed; the
++ library is far more reliable than it used to be. Bounds checking
++ in many `dangerous' entry points has been improved. The code is
++ now type-safe according to gcc -Wall. The library has been
++ checked for malloc leaks and arena corruption by the Purify
++ memory-allocation tester. The ncurses code has been tested with a wide variety of
+ applications including (versions starting with those noted): as well as some that use ncurses for the terminfo support
++ alone: The ncurses distribution includes a selection of test programs
+ (including a few games). Zeyd Ben-Halim started it from a previous package pcurses,
++ written by Pavel Curtis. Eric S. Raymond continued development.
++ Jürgen Pfeifer wrote most of the form and menu libraries.
++ Ongoing work is being done by Thomas Dickey. Thomas
++ Dickey acts as the maintainer for the Free Software Foundation,
++ which holds the copyright on ncurses. Contact the current
++ maintainers at bug-ncurses@gnu.org. To join the ncurses mailing list, please write email to
+ Announcing ncurses @VERSION@
The ncurses (new curses)
+- library is a free software emulation of curses in System V
+- Release 4.0, and more. It uses terminfo format, supports pads and
+- color and multiple highlights and forms characters and
+- function-key mapping, and has all the other SYSV-curses
+- enhancements over BSD curses.
++ Announcing ncurses @VERSION@
++
++ Release Notes
This release is designed to be upward
+- compatible from ncurses 5.0 through 5.8; very few applications
+- will require recompilation, depending on the platform. These are
+- the highlights from the change-log since ncurses 5.8 release.
+- Release Notes
++
++
+-
+
+- Features of Ncurses
The ncurses package is fully
+- compatible with SVr4 (System V Release 4) curses:
++ Features of Ncurses
++
++
+
The ncurses package also has many useful extensions over
+- SVr4:
++
++
++
+
+
+- State of the Package
Numerous bugs present in earlier
+- versions have been fixed; the library is far more reliable than
+- it used to be. Bounds checking in many `dangerous' entry points
+- has been improved. The code is now type-safe according to gcc
+- -Wall. The library has been checked for malloc leaks and arena
+- corruption by the Purify memory-allocation tester.
++ State of the Package
++
++
+
Who's Who and What's What
Zeyd Ben-Halim started it from
+- a previous package pcurses, written by Pavel Curtis. Eric S.
+- Raymond continued development. Jürgen Pfeifer wrote most of
+- the form and menu libraries. Ongoing work is being done by
+- Thomas Dickey.
+- Thomas Dickey acts as the maintainer for the Free Software
+- Foundation, which holds the copyright on ncurses. Contact the
+- current maintainers at bug-ncurses@gnu.org.
++ Who's Who and What's What
++
++ bug-ncurses-request@gnu.org
containing the line:
There is an archive of the mailing list here:
++ ++http://lists.gnu.org/archive/html/bug-ncurses ++ (also https)
++ +We need people to help with these projects. If you are ++ interested in working on them, please join the ncurses list.
++ ++The distribution provides a newer version of the ++ terminfo-format terminal description file once maintained by ++ Eric + Raymond . Unlike the older version, the termcap and + terminfo data are provided in the same file, and provides several +- user-definable extensions beyond the X/Open specification. ++ user-definable extensions beyond the X/Open specification.
+ +