2 # $Id: run_tic.in,v 1.36 2019/06/30 16:29:23 tom Exp $
3 ##############################################################################
4 # Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. #
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: #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
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. #
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 #
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.
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
45 : ${DESTDIR:=@DESTDIR@}
47 : ${exec_prefix:=@exec_prefix@}
49 : ${top_srcdir:=@top_srcdir@}
51 : ${datarootdir:=@datarootdir@}
52 : ${datadir:=@datadir@}
54 : ${ticdir:=@TERMINFO@}
55 : ${source:=@TERMINFO_SRC@}
57 : ${cross_compiling:=no}
58 : ${ext_funcs:=@NCURSES_EXT_FUNCS@}
60 test -z "${DESTDIR}" && DESTDIR=
62 # Allow tic to run either from the install-path, or from the build-directory.
63 # Do not do this if we appear to be cross-compiling. In that case, we rely
64 # on the host's copy of tic to compile the terminfo database.
65 if test "x$cross_compiling" = "xno"
67 if test -f ../progs/tic$suffix
71 PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH"
74 PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH"
78 if test @DFT_LWR_MODEL@ = shared
80 SHLIB="sh $srcdir/shlib"
85 elif test "$TIC_PATH" = unknown
87 echo "? no tic program found"
91 # Cross-compiling, so don't set PATH or run shlib.
93 # reset $suffix, since it applies to the target, not the build platform.
98 # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
99 # the PATH we just set.
103 # set a variable to simplify environment update in shlib
107 # don't use user's TERMINFO variable
109 TERMINFO="${DESTDIR}$ticdir" ; export TERMINFO
112 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
113 TICDIR=`echo "$TERMINFO" | sed -e 's%/share/\([^/]*\)$%/lib/\1%'`
115 # Parent directory may not exist, which would confuse the install for hashed
117 PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'`
120 test -d $PARENT || mkdir -p $PARENT
123 # Remove the old terminfo stuff; we don't care if it existed before, and it
124 # would generate a lot of confusing error messages if we tried to overwrite it.
125 # We explicitly remove its contents rather than the directory itself, in case
126 # the directory is actually a symbolic link.
127 if test -d "$TERMINFO"
129 ( cd "$TERMINFO" && rm -fr ? 2>/dev/null )
130 elif test -f "$TERMINFO.db"
132 ( rm -f "$TERMINFO.db" 2>/dev/null )
135 if test "$ext_funcs" = 1 ; then
137 Running $TIC_PATH to install $TERMINFO ...
139 You may see messages regarding extended capabilities, e.g., AX.
140 These are extended terminal capabilities which are compiled
143 If you have ncurses 4.2 applications, you should read the INSTALL
144 document, and install the terminfo without the -x option.
147 if ( $TIC_PATH -x -s -o "$TERMINFO" $source )
149 echo "** built new $TERMINFO"
151 echo "? tic could not build $TERMINFO"
156 Running $TIC_PATH to install $TERMINFO ...
158 You may see messages regarding unknown capabilities, e.g., AX.
159 These are extended terminal capabilities which may be compiled
162 If you have ncurses 4.2 applications, you should read the INSTALL
163 document, and install the terminfo without the -x option.
166 if ( $TIC_PATH -s -o "$TERMINFO" $source )
168 echo "** built new $TERMINFO"
170 echo "? tic could not build $TERMINFO"
175 # Make a symbolic link to provide compatibility with applications that expect
176 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
177 # all systems support symbolic links, and those that do provide a variety
178 # of options for 'test'.
179 if test "$TICDIR" != "$TERMINFO" ; then
180 ( rm -f "$TICDIR" 2>/dev/null )
181 if ( cd "$TICDIR" 2>/dev/null )
185 if test "$TICDIR "!= "$TERMINFO "; then
186 # Well, we tried. Some systems lie to us, so the
187 # installer will have to double-check.
188 echo "Verify if $TICDIR and $TERMINFO are the same."
189 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
190 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
194 # Construct a symbolic link that only assumes $ticdir has the
195 # same $prefix as the other installed directories.
196 RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'`
197 if test "$RELATIVE" != "$ticdir" ; then
198 RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'`
200 if ( @LN_S@ "$RELATIVE" "$TICDIR" )
202 echo "** sym-linked $TICDIR for compatibility"
204 echo "** could not sym-link $TICDIR for compatibility"