Subject: [alpine-devel] [PATCH] main/mc: rebuild with ncurses support

From: "Valery Kartel" <[email-masked]>
Date: Thu, 27 Nov 2014 15:10:16 +0200

---
 main/mc/APKBUILD      | 23 ++++++++++++++++-------
 main/mc/ncurses.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 7 deletions(-)
 create mode 100644 main/mc/ncurses.patch

diff --git a/main/mc/APKBUILD b/main/mc/APKBUILD
index 0e6e3ae..3b8807c 100644
--- a/main/mc/APKBUILD
+++ b/main/mc/APKBUILD
@@ -1,20 +1,26 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=mc
 pkgver=4.8.13
-pkgrel=0
+pkgrel=1
 pkgdesc="A filemanager/shell that emulates Norton Commander"
 url="http://www.ibiblio.org/mc/"
 arch="all"
 license="GPL3+"
 depends=""
 subpackages="$pkgname-doc $pkgname-lang"
-makedepends="e2fsprogs-dev glib-dev pcre-dev slang-dev"
-source="http://www.midnight-commander.org/downloads/mc-$pkgver.tar.bz2"
+makedepends="e2fsprogs-dev glib-dev pcre-dev ncurses-dev"
+source="http://www.midnight-commander.org/downloads/mc-$pkgver.tar.bz2
+	ncurses.patch"
 
 _builddir="$srcdir"/$pkgname-$pkgver
 
 prepare() {
 	cd "$_builddir"
+	for i in $source; do
+		case $i in
+			*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
 }
 build() {
 	cd "$_builddir"
@@ -30,7 +36,7 @@ build() {
 		--enable-largefile \
 		--with-edit \
 		--with-mmap \
-		--with-screen=slang \
+		--with-screen=ncurses \
 		--with-subshell \
 		--with-vfs \
 		--without-debug \
@@ -48,6 +54,9 @@ package() {
 	make DESTDIR="$pkgdir" install || return 1
 }
 
-md5sums="12a521a50da6a86852177591b9623d5e  mc-4.8.13.tar.bz2"
-sha256sums="22e1b809edba957eb9a392138bf87fea3877f7ca0b7463b7cc2eb94afa6f3e49  mc-4.8.13.tar.bz2"
-sha512sums="9b5fc3c8a3c98ad2ed15e569d80f7b9d40749ff91239e0f0d12d103b40e43e8acdb2dec1fcc1b6543a3038dd4df0bfe48b32c61db491551b22fc0ff7c5ffee27  mc-4.8.13.tar.bz2"
+md5sums="12a521a50da6a86852177591b9623d5e  mc-4.8.13.tar.bz2
+b00ff697691ea1669347d4740e261420  ncurses.patch"
+sha256sums="22e1b809edba957eb9a392138bf87fea3877f7ca0b7463b7cc2eb94afa6f3e49  mc-4.8.13.tar.bz2
+75beb9f02f7b0a801abd4c823923c3c2f729a953a4b8cb79493fa5ecd5e640cf  ncurses.patch"
+sha512sums="9b5fc3c8a3c98ad2ed15e569d80f7b9d40749ff91239e0f0d12d103b40e43e8acdb2dec1fcc1b6543a3038dd4df0bfe48b32c61db491551b22fc0ff7c5ffee27  mc-4.8.13.tar.bz2
+8ff16486b9261d06c95eb8465aee5ad8ee4857c4e10ddb4b3ae0cfb52bfc29a2e6a70de67a080ec63b075a3a485322adbefb6aaeffdaa255e9c19e2bd58564a7  ncurses.patch"
diff --git a/main/mc/ncurses.patch b/main/mc/ncurses.patch
new file mode 100644
index 0000000..8c6f1dc
--- /dev/null
+++ b/main/mc/ncurses.patch
@@ -0,0 +1,50 @@
+Gentoo-bug: https://bugs.gentoo.org/527118
+--- a/m4.include/mc-with-screen-ncurses.m4
++++ b/m4.include/mc-with-screen-ncurses.m4
+@@ -101,6 +101,9 @@
+         LIBS=
+         AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"], 
+                        [AC_MSG_ERROR([Cannot find ncurses library])])
++        AC_SEARCH_LIBS([stdscr],[tinfo ncurses],[MCLIBS="$MCLIBS $LIBS"],
++                       [AC_MSG_ERROR([Cannot find a library providing stdscr])])
++
+ 
+         screen_type=ncurses
+         screen_msg="Ncurses library"
+@@ -111,10 +114,15 @@
+         AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
+                        [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
+ 
++        AC_SEARCH_LIBS([stdscr],[tinfo ncursesw ncurses curses],[MCLIBS="$MCLIBS $LIBS"],
++                       [AC_MSG_ERROR([Cannot find a library providing stdscr])])
++
+         if test x"$ncursesw_found" = "x"; then
+             LIBS=
+             AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"], 
+                            [AC_MSG_ERROR([Cannot find ncurses library])])
++            AC_SEARCH_LIBS([stdscr],[tinfo ncurses curses],[MCLIBS="$MCLIBS $LIBS"],
++                           [AC_MSG_ERROR([Cannot find a library providing stdscr])])
+         fi
+ 
+         dnl Check the header
+@@ -166,6 +174,9 @@
+     LIBS=
+     AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
+ 		   [AC_MSG_ERROR([Cannot find ncursesw library])])
++    AC_SEARCH_LIBS([stdscr],[tinfow ncursesw],[MCLIBS="$MCLIBS $LIBS"],
++           [AC_MSG_ERROR([Cannot find a library providing stdscr])])
++
+ 
+     dnl Check the header
+     ncurses_h_found=
+--- a/lib/tty/tty-ncurses.c
++++ b/lib/tty/tty-ncurses.c
+@@ -66,7 +66,7 @@
+ 
+ /*** file scope macro definitions ****************************************************************/
+ 
+-#if defined(_AIX) && !defined(CTRL)
++#if !defined(CTRL)
+ #define CTRL(x) ((x) & 0x1f)
+ #endif
+ 
-- 
2.2.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---