libnfsidmap: updated to 0.25
[tomato.git] / release / src / router / libncurses / misc / run_tic.sh
blob9d69541d6122d213b16c9b0bf0461b5f1e6b1df8
1 #!/bin/sh
2 # $Id: run_tic.in,v 1.32 2011/02/23 23:30:15 tom Exp $
3 ##############################################################################
4 # Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. #
5 # #
6 # Permission is hereby granted, free of charge, to any person obtaining a #
7 # copy of this software and associated documentation files (the "Software"), #
8 # to deal in the Software without restriction, including without limitation #
9 # the rights to use, copy, modify, merge, publish, distribute, distribute #
10 # with modifications, sublicense, and/or sell copies of the Software, and to #
11 # permit persons to whom the Software is furnished to do so, subject to the #
12 # following conditions: #
13 # #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
16 # #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
20 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
23 # DEALINGS IN THE SOFTWARE. #
24 # #
25 # Except as contained in this notice, the name(s) of the above copyright #
26 # holders shall not be used in advertising or otherwise to promote the sale, #
27 # use or other dealings in this Software without prior written #
28 # authorization. #
29 ##############################################################################
31 # Author: Thomas E. Dickey 1996-on
33 # This script is used to install terminfo.src using tic. We use a script
34 # because the path checking is too awkward to do in a makefile.
36 # Assumes:
37 # The leaf directory names (lib, tabset, terminfo)
39 echo '** Building terminfo database, please wait...'
41 # The script is designed to be run from the misc/Makefile as
42 # make install.data
44 : ${suffix:=}
45 : ${DESTDIR:=}
46 : ${prefix:=/usr}
47 : ${exec_prefix:=${prefix}}
48 : ${bindir:=${exec_prefix}/bin}
49 : ${top_srcdir:=..}
50 : ${srcdir:=.}
51 : ${datadir:=${prefix}/share}
52 : ${TIC_PATH:=/usr/bin/tic}
53 : ${ticdir:=/usr/share/terminfo}
54 : ${source:=${top_srcdir}/misc/terminfo.src}
55 : ${LN_S:="ln -s -f"}
56 : ${cross_compiling:=no}
57 : ${ext_funcs:=1}
59 test -z "${DESTDIR}" && DESTDIR=
61 # Allow tic to run either from the install-path, or from the build-directory.
62 # Do not do this if we appear to be cross-compiling. In that case, we rely
63 # on the host's copy of tic to compile the terminfo database.
64 if test "x$cross_compiling" = "xno"
65 then
66 if test -f ../progs/tic$suffix
67 then
68 case "$PATH" in
69 \:*)
70 PATH="../progs:../lib:${DESTDIR}$bindir$PATH"
73 PATH="../progs:../lib:${DESTDIR}$bindir:$PATH"
75 esac
76 export PATH
77 if test shared = shared
78 then
79 SHLIB="sh $srcdir/shlib"
80 TIC_PATH="$SHLIB tic"
81 else
82 TIC_PATH="tic"
84 elif test "$TIC_PATH" = unknown
85 then
86 echo '? no tic program found'
87 exit 1
89 else
90 # Cross-compiling, so don't set PATH or run shlib.
91 SHLIB=
92 # reset $suffix, since it applies to the target, not the build platform.
93 suffix=
97 # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
98 # the PATH we just set.
99 SHLIB_PATH=$PATH
100 export SHLIB_PATH
102 # set a variable to simplify environment update in shlib
103 SHLIB_HOST=linux-gnu
104 export SHLIB_HOST
106 # don't use user's TERMINFO variable
107 TERMINFO=${DESTDIR}$ticdir ; export TERMINFO
108 umask 022
110 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
111 TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'`
113 # Parent directory may not exist, which would confuse the install for hashed
114 # database. Fix.
115 PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'`
116 if test -n "$PARENT"
117 then
118 test -d $PARENT || mkdir -p $PARENT
121 # Remove the old terminfo stuff; we don't care if it existed before, and it
122 # would generate a lot of confusing error messages if we tried to overwrite it.
123 # We explicitly remove its contents rather than the directory itself, in case
124 # the directory is actually a symbolic link.
125 ( test -d "$TERMINFO" && cd $TERMINFO && rm -fr ? 2>/dev/null )
127 if test "$ext_funcs" = 1 ; then
128 cat <<EOF
129 Running $TIC_PATH to install $TERMINFO ...
131 You may see messages regarding extended capabilities, e.g., AX.
132 These are extended terminal capabilities which are compiled
133 using
134 tic -x
135 If you have ncurses 4.2 applications, you should read the INSTALL
136 document, and install the terminfo without the -x option.
139 if ( $TIC_PATH -x -s -o $TERMINFO $source )
140 then
141 echo '** built new '$TERMINFO
142 else
143 echo '? tic could not build '$TERMINFO
144 exit 1
146 else
147 cat <<EOF
148 Running $TIC_PATH to install $TERMINFO ...
150 You may see messages regarding unknown capabilities, e.g., AX.
151 These are extended terminal capabilities which may be compiled
152 using
153 tic -x
154 If you have ncurses 4.2 applications, you should read the INSTALL
155 document, and install the terminfo without the -x option.
158 if ( $TIC_PATH -s -o $TERMINFO $source )
159 then
160 echo '** built new '$TERMINFO
161 else
162 echo '? tic could not build '$TERMINFO
163 exit 1
167 # Make a symbolic link to provide compatibility with applications that expect
168 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
169 # all systems support symbolic links, and those that do provide a variety
170 # of options for 'test'.
171 if test "$TICDIR" != "$TERMINFO" ; then
172 ( rm -f $TICDIR 2>/dev/null )
173 if ( cd $TICDIR 2>/dev/null )
174 then
175 cd $TICDIR
176 TICDIR=`pwd`
177 if test $TICDIR != $TERMINFO ; then
178 # Well, we tried. Some systems lie to us, so the
179 # installer will have to double-check.
180 echo "Verify if $TICDIR and $TERMINFO are the same."
181 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
182 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
184 else
185 cd ${DESTDIR}$prefix
186 # Construct a symbolic link that only assumes $ticdir has the
187 # same $prefix as the other installed directories.
188 RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'`
189 if test "$RELATIVE" != "$ticdir" ; then
190 RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'`
192 if ( ln -s -f $RELATIVE $TICDIR )
193 then
194 echo '** sym-linked '$TICDIR' for compatibility'
195 else
196 echo '** could not sym-link '$TICDIR' for compatibility'
200 # vile:shmode