2017年6月24日 星期六

[Arduino][ncurses-5.9] Compile ncurses-5.9 by using gcc-5

Download package
ncurses-5.9.tar.gz


Decompress package, and configure it.
./configure –prefix=/opt –with-shared –without-normal –without-debug –without-cxx-binding CC=/usr/bin/gcc-5


Patch into current file.
./script/build failure with GCC 5.1.0


Create patch file
modules/ncurses - fix complation on gcc 5.1


Save following file into a.patch
--- a/ncurses/base/MKlib_gen.sh
+++ b/ncurses/base/MKlib_gen.sh
@@ -474,11 +474,22 @@ sed -n -f $ED1 \
    -e 's/gen_$//' \
    -e 's/  / /g' >>$TMP

+cat >$ED1 <<EOF
+s/  / /g
+s/^ //
+s/ $//
+s/P_NCURSES_BOOL/NCURSES_BOOL/g
+EOF
+
+# A patch discussed here:
+#  https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
+# introduces spurious #line markers.  Work around that by ignoring the system's
+# attempt to define "bool" and using our own symbol here.
+sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2
+cat $ED2 >$TMP
+
 $preprocessor $TMP 2>/dev/null \
-| sed \
-   -e 's/  / /g' \
-   -e 's/^ //' \
-   -e 's/_Bool/NCURSES_BOOL/g' \
+| sed -f $ED1 \
 | $AWK -f $AW2 \
 | sed -f $ED3 \
 | sed \
Under the folder of ncurses-5.9
patch -p1 < a.patch


Start to compile and install
make && make install


link file into /usr/lib/
sudo ln -s /opt/lib/libncurses.so /usr/lib/libncurses.so.5
sudo ln -s /opt/lib/libncurses.so /usr/lib/libtinfo.so.5


Reference:

0 意見:

張貼留言