2 # $Id: run_tic.in,v 1.37 2020/02/02 23:34:34 tom Exp $
3 ##############################################################################
4 # Copyright 2019,2020 Thomas E. Dickey #
5 # Copyright 2000-2012,2017 Free Software Foundation, Inc. #
7 # Permission is hereby granted, free of charge, to any person obtaining a #
8 # copy of this software and associated documentation files (the "Software"), #
9 # to deal in the Software without restriction, including without limitation #
10 # the rights to use, copy, modify, merge, publish, distribute, distribute #
11 # with modifications, sublicense, and/or sell copies of the Software, and to #
12 # permit persons to whom the Software is furnished to do so, subject to the #
13 # following conditions: #
15 # The above copyright notice and this permission notice shall be included in #
16 # all copies or substantial portions of the Software. #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
21 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
23 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
24 # DEALINGS IN THE SOFTWARE. #
26 # Except as contained in this notice, the name(s) of the above copyright #
27 # holders shall not be used in advertising or otherwise to promote the sale, #
28 # use or other dealings in this Software without prior written #
30 ##############################################################################
32 # Author: Thomas E. Dickey 1996-on
34 # This script is used to install terminfo.src using tic. We use a script
35 # because the path checking is too awkward to do in a makefile.
38 # The leaf directory names (lib, tabset, terminfo)
40 echo "** Building terminfo database, please wait..."
42 # The script is designed to be run from the misc/Makefile as
46 : ${DESTDIR:=@DESTDIR@}
48 : ${exec_prefix:=@exec_prefix@}
50 : ${top_srcdir:=@top_srcdir@}
52 : ${datarootdir:=@datarootdir@}
53 : ${datadir:=@datadir@}
55 : ${ticdir:=@TERMINFO@}
56 : ${source:=@TERMINFO_SRC@}
58 : ${cross_compiling:=no}
59 : ${ext_funcs:=@NCURSES_EXT_FUNCS@}
61 test -z "${DESTDIR}" && DESTDIR=
63 # Allow tic to run either from the install-path, or from the build-directory.
64 # Do not do this if we appear to be cross-compiling. In that case, we rely
65 # on the host's copy of tic to compile the terminfo database.
66 if test "x$cross_compiling" = "xno"
68 if test -f ../progs/tic$suffix
72 PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH"
75 PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH"
79 if test @DFT_LWR_MODEL@ = shared
81 SHLIB="sh $srcdir/shlib"
86 elif test "$TIC_PATH" = unknown
88 echo "? no tic program found"
92 # Cross-compiling, so don't set PATH or run shlib.
94 # reset $suffix, since it applies to the target, not the build platform.
99 # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
100 # the PATH we just set.
104 # set a variable to simplify environment update in shlib
108 # don't use user's TERMINFO variable
110 TERMINFO="${DESTDIR}$ticdir" ; export TERMINFO
113 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
114 TICDIR=`echo "$TERMINFO" | sed -e 's%/share/\([^/]*\)$%/lib/\1%'`
116 # Parent directory may not exist, which would confuse the install for hashed
118 PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'`
121 test -d $PARENT || mkdir -p $PARENT
124 # Remove the old terminfo stuff; we don't care if it existed before, and it
125 # would generate a lot of confusing error messages if we tried to overwrite it.
126 # We explicitly remove its contents rather than the directory itself, in case
127 # the directory is actually a symbolic link.
128 if test -d "$TERMINFO"
130 ( cd "$TERMINFO" && rm -fr ? 2>/dev/null )
131 elif test -f "$TERMINFO.db"
133 ( rm -f "$TERMINFO.db" 2>/dev/null )
136 if test "$ext_funcs" = 1 ; then
138 Running $TIC_PATH to install $TERMINFO ...
140 You may see messages regarding extended capabilities, e.g., AX.
141 These are extended terminal capabilities which are compiled
144 If you have ncurses 4.2 applications, you should read the INSTALL
145 document, and install the terminfo without the -x option.
148 if ( $TIC_PATH -x -s -o "$TERMINFO" $source )
150 echo "** built new $TERMINFO"
152 echo "? tic could not build $TERMINFO"
157 Running $TIC_PATH to install $TERMINFO ...
159 You may see messages regarding unknown capabilities, e.g., AX.
160 These are extended terminal capabilities which may be compiled
163 If you have ncurses 4.2 applications, you should read the INSTALL
164 document, and install the terminfo without the -x option.
167 if ( $TIC_PATH -s -o "$TERMINFO" $source )
169 echo "** built new $TERMINFO"
171 echo "? tic could not build $TERMINFO"
176 # Make a symbolic link to provide compatibility with applications that expect
177 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
178 # all systems support symbolic links, and those that do provide a variety
179 # of options for 'test'.
180 if test "$TICDIR" != "$TERMINFO" ; then
181 ( rm -f "$TICDIR" 2>/dev/null )
182 if ( cd "$TICDIR" 2>/dev/null )
186 if test "$TICDIR "!= "$TERMINFO "; then
187 # Well, we tried. Some systems lie to us, so the
188 # installer will have to double-check.
189 echo "Verify if $TICDIR and $TERMINFO are the same."
190 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
191 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
195 # Construct a symbolic link that only assumes $ticdir has the
196 # same $prefix as the other installed directories.
197 RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'`
198 if test "$RELATIVE" != "$ticdir" ; then
199 RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'`
201 if ( @LN_S@ "$RELATIVE" "$TICDIR" )
203 echo "** sym-linked $TICDIR for compatibility"
205 echo "** could not sym-link $TICDIR for compatibility"