Patchwork [CONSOLIDATED,PULL,(v2),07/33] ncurses: refactor configure to avoid configuring widec when disabled

login
register
mail settings
Submitter Saul Wold
Date Nov. 10, 2011, 7:42 a.m.
Message ID <d673f2619250d7f5872d9651b916c371f333d22f.1320910946.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/14703/
State Accepted
Commit 8b995deb046469c1c713fa053510d2fe94454133
Headers show

Comments

Saul Wold - Nov. 10, 2011, 7:42 a.m.
From: Darren Hart <dvhart@linux.intel.com>

The ENABLE_WIDEC variable can be used to disable ncurses wide character support
when your C library doesn't support it. Currently, the do_configure step
configures for both narrow and wide characters regardless and only checks
ENABLE_WIDEC during compilation. This leads to QA failures with host
contamination during configure if the C library doesn't support wide characters.

Refactor do_configure with a new ncurses_configure helper function and only
configure for wide character support if ENABLE_WIDEC is true.

Ensure that configure errors are propogated back through to do_configure.

Tested with ENABLE_WIDEC as true and false via an ncurses bbappend on i586,
including basic error injection.

V2: INC_PR bump

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 meta/recipes-core/ncurses/ncurses.inc |   66 +++++++++++++++++---------------
 1 files changed, 35 insertions(+), 31 deletions(-)

Patch

diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index be7d387..df9252a 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -6,7 +6,7 @@  LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc
 SECTION = "libs"
 DEPENDS = "ncurses-native"
 DEPENDS_virtclass-native = ""
-INC_PR = "r1"
+INC_PR = "r2"
 
 inherit autotools binconfig multilib_header
 
@@ -26,6 +26,36 @@  ENABLE_WIDEC = "true"
 # builds.
 BUILD_CPPFLAGS += "-D_GNU_SOURCE"
 
+# Helper function for do_configure to allow multiple configurations
+# $1 the directory to run configure in
+# $@ the arguments to pass to configure
+ncurses_configure() {
+	mkdir -p $1
+	cd $1
+	shift
+	oe_runconf \
+	        --disable-static \
+	        --without-debug \
+	        --without-ada \
+	        --without-gpm \
+	        --enable-hard-tabs \
+	        --enable-xmc-glitch \
+	        --enable-colorfgbg \
+	        --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \
+	        --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \
+	        --with-shared \
+	        --disable-big-core \
+	        --program-prefix= \
+	        --with-ticlib \
+	        --with-termlib=tinfo \
+	        --enable-sigwinch \
+	        --enable-pc-files \
+	        --disable-rpath-hack \
+	        --with-manpage-format=normal \
+	        "$@" || return 1
+	cd ..
+}
+
 # Override the function from the autotools class; ncurses requires a
 # patched autoconf213 to generate the configure script. This autoconf
 # is not available so that the shipped script will be used.
@@ -35,36 +65,10 @@  do_configure() {
         # not the case for /dev/null redirections)
         export cf_cv_working_poll=yes
 
-        for i in \
-        'narrowc' \
-        'widec   --enable-widec --without-progs'; do
-                set -- $i
-                mkdir -p $1
-                cd $1
-                shift
-
-                oe_runconf \
-                        --disable-static \
-                        --without-debug \
-                        --without-ada \
-                        --without-gpm \
-                        --enable-hard-tabs \
-                        --enable-xmc-glitch \
-                        --enable-colorfgbg \
-                        --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \
-                        --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \
-                        --with-shared \
-                        --disable-big-core \
-                        --program-prefix= \
-                        --with-ticlib \
-                        --with-termlib=tinfo \
-                        --enable-sigwinch \
-                        --enable-pc-files \
-                        --disable-rpath-hack \
-                        --with-manpage-format=normal \
-                        "$@"
-                cd ..
-        done
+	ncurses_configure "narrowc" || \
+		return 1
+	! ${ENABLE_WIDEC} || \
+		ncurses_configure "widec" "--enable-widec" "--without-progs"
 }
 
 do_compile() {