1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs target ncurses build
|
---|
4 | # ------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG=ncurses-target.log
|
---|
13 | libdirname="lib"
|
---|
14 |
|
---|
15 | SELF=`basename ${0}`
|
---|
16 | set_buildenv
|
---|
17 | set_libdirname
|
---|
18 | setup_multiarch
|
---|
19 |
|
---|
20 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
21 | BUILD_PREFIX=/usr
|
---|
22 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
|
---|
23 | INSTALL_OPTIONS="DESTDIR=${LFS}"
|
---|
24 | else
|
---|
25 | BUILD_PREFIX="${TGT_TOOLS}"
|
---|
26 | INSTALL_PREFIX="${TGT_TOOLS}"
|
---|
27 | INSTALL_OPTIONS=""
|
---|
28 | fi
|
---|
29 |
|
---|
30 | export CC="${TARGET}-gcc ${ARCH_CFLAGS}"
|
---|
31 | export CXX="${TARGET}-g++ ${ARCH_CFLAGS}"
|
---|
32 | export RANLIB="${TARGET}-ranlib"
|
---|
33 | export AR="${TARGET}-ar"
|
---|
34 | export LD="${TARGET}-ld"
|
---|
35 |
|
---|
36 | unpack_tarball ncurses-${NCURSES_VER} &&
|
---|
37 | cd ${PKGDIR}
|
---|
38 |
|
---|
39 | if [ ! "${libdirname}" = "lib" ]; then
|
---|
40 | extra_conf="--libdir=${BUILD_PREFIX}/${libdirname}"
|
---|
41 |
|
---|
42 | # Patch misc/run_tic.in to create
|
---|
43 | # ${libdirname}/terminfo -> share/terminfo link
|
---|
44 | test -f misc/run_tic.in-ORIG ||
|
---|
45 | mv misc/run_tic.in misc/run_tic.in-ORIG
|
---|
46 |
|
---|
47 | sed "s:^\(TICDIR.*/\)lib\(.*\):\1${libdirname}\2:g" \
|
---|
48 | misc/run_tic.in-ORIG > misc/run_tic.in
|
---|
49 | fi
|
---|
50 |
|
---|
51 | # replace some deprecated headers
|
---|
52 | # strstream deprecated in favour of sstream
|
---|
53 | test -f c++/cursesw.h-ORIG ||
|
---|
54 | mv c++/cursesw.h c++/cursesw.h-ORIG
|
---|
55 | sed 's/include <strstream.h>/include <sstream>/g' c++/cursesw.h-ORIG > c++/cursesw.h
|
---|
56 |
|
---|
57 | # CHECK THIS... Should only affect ncurses 5.2 and less,
|
---|
58 | # must check whether vsscanf is picked up or not in 5.3
|
---|
59 |
|
---|
60 | test 5.2 = "${NCURSES_VER}" &&
|
---|
61 | {
|
---|
62 | # Apply cursesw.cc vsscanf patch
|
---|
63 | # Unsure who provided the original patch used.
|
---|
64 | # Please contact the authors so we can attribute you correctly.
|
---|
65 | test -f c++/cursesw.cc-ORIG ||
|
---|
66 | cp c++/cursesw.cc c++/cursesw.cc-ORIG
|
---|
67 | grep -v strstreambuf c++/cursesw.cc-ORIG |
|
---|
68 | sed 's@ss.vscan(@::vsscanf(buf, @' > c++/cursesw.cc
|
---|
69 | }
|
---|
70 |
|
---|
71 | # Force xterm to always be colour
|
---|
72 | # ( thanks Alexander Patrakov ;-) )
|
---|
73 | # TODO: this is the default w ncurses-20040711
|
---|
74 | sed -i -e '/^xterm|/,+1s,^\(.use\)=xterm-r6,\1=xterm-xfree86,' \
|
---|
75 | misc/terminfo.src
|
---|
76 |
|
---|
77 | max_log_init Ncurses ${NCURSES_VER} "target (shared)" ${CONFLOGS} ${LOG}
|
---|
78 | ./configure --prefix=${BUILD_PREFIX} --with-shared \
|
---|
79 | --host=${TARGET} --with-build-cc=gcc \
|
---|
80 | --without-debug ${extra_conf} \
|
---|
81 | >> ${LOGFILE} 2>&1 &&
|
---|
82 | echo " o Configure OK" &&
|
---|
83 |
|
---|
84 | min_log_init ${BUILDLOGS} &&
|
---|
85 | make \
|
---|
86 | >> ${LOGFILE} 2>&1 &&
|
---|
87 | echo " o Build OK" &&
|
---|
88 |
|
---|
89 | min_log_init ${INSTLOGS} &&
|
---|
90 | make ${INSTALL_OPTIONS} install \
|
---|
91 | >> ${LOGFILE} 2>&1 &&
|
---|
92 | echo " o ALL OK" || barf
|
---|
93 |
|
---|
94 | chmod 755 ${INSTALL_PREFIX}/${libdirname}/*.${NCURSES_VER} &&
|
---|
95 | ln -s libncurses.a ${INSTALL_PREFIX}/${libdirname}/libcurses.a
|
---|
96 | ln -sf libncurses.so.5 ${INSTALL_PREFIX}/${libdirname}/libcurses.so
|
---|
97 |
|
---|
98 | #ldconfig
|
---|
99 |
|
---|
100 | if [ ! -f ${INSTALL_PREFIX}/include/term.h -a -f ${INSTALL_PREFIX}/include/ncurses/term.h ]; then
|
---|
101 | ln -sf ncurses/term.h ${INSTALL_PREFIX}/include
|
---|
102 | fi
|
---|
103 |
|
---|
104 | # also create a curses.h symlink
|
---|
105 | if [ ! -f ${INSTALL_PREFIX}/include/curses.h -a -f ${INSTALL_PREFIX}/include/ncurses/curses.h ]; then
|
---|
106 | ln -sf ncurses/curses.h ${INSTALL_PREFIX}/include
|
---|
107 | fi
|
---|
108 |
|
---|