2 ##############################################################################
3 # Copyright (c) 1998,2000 Free Software Foundation, Inc. #
5 # Permission is hereby granted, free of charge, to any person obtaining a #
6 # copy of this software and associated documentation files (the "Software"), #
7 # to deal in the Software without restriction, including without limitation #
8 # the rights to use, copy, modify, merge, publish, distribute, distribute #
9 # with modifications, sublicense, and/or sell copies of the Software, and to #
10 # permit persons to whom the Software is furnished to do so, subject to the #
11 # following conditions: #
13 # The above copyright notice and this permission notice shall be included in #
14 # all copies or substantial portions of the Software. #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
19 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
22 # DEALINGS IN THE SOFTWARE. #
24 # Except as contained in this notice, the name(s) of the above copyright #
25 # holders shall not be used in advertising or otherwise to promote the sale, #
26 # use or other dealings in this Software without prior written #
28 ##############################################################################
30 # Author: Thomas E. Dickey <dickey@clark.net> 1996
32 # $Id: run_tic.sh,v 1.12 2000/07/01 19:25:13 tom Exp $
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 # $1 = nominal directory in which to find 'tic', i.e., $(bindir).
38 # $2 = source-directory, i.e., $(srcdir)
39 # $3 = destination-directory path, i.e., $(ticdir)
40 # $4 = install-prefix, if any
43 # The leaf directory names (bin, lib, shared, tabset, terminfo)
45 echo '** Building terminfo database, please wait...'
47 # Parameter parsing is primarily for debugging. The script is designed to
48 # be run from the misc/Makefile as
51 if test $# != 0 ; then
54 PREFIX=`echo $bindir | sed -e 's/\/bin$//'`
55 test -n "$PREFIX" && test "x$PREFIX" != "x$bindir" && prefix=$PREFIX
60 if test $# != 0 ; then
67 if test $# != 0 ; then
71 ticdir=$prefix/share/terminfo
74 if test $# != 0 ; then
81 # Allow tic to run either from the install-path, or from the build-directory
83 :*) PATH=../progs:$IP$bindir$PATH ;;
84 *) PATH=../progs:$IP$bindir:$PATH ;;
89 # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
90 # the PATH we just set.
94 PROG_BIN_DIR=$IP$bindir
97 TERMINFO=$IP$ticdir ; export TERMINFO
100 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
101 TICDIR=`echo $TERMINFO | sed -e 's/\/share\//\/lib\//'`
103 # Remove the old terminfo stuff; we don't care if it existed before, and it
104 # would generate a lot of confusing error messages if we tried to overwrite it.
105 # We explicitly remove its contents rather than the directory itself, in case
106 # the directory is actually a symbolic link.
107 ( rm -fr $TERMINFO/[0-9A-Za-z] 2>/dev/null )
109 # If we're not installing into /usr/share/, we'll have to adjust the location
110 # of the tabset files in terminfo.src (which are in a parallel directory).
111 TABSET=`echo $ticdir | sed -e 's/\/terminfo$/\/tabset/'`
112 SRC=$srcdir/terminfo.src
113 if test "x$TABSET" != "x/usr/share/tabset" ; then
114 echo '** adjusting tabset paths'
115 TMP=${TMPDIR-/tmp}/$$
116 sed -e s:/usr/share/tabset:$TABSET:g $SRC >$TMP
117 trap "rm -f $TMP" 0 1 2 5 15
122 Running tic to install $TERMINFO ...
124 You may see messages regarding unknown capabilities, e.g., AX.
125 These are extended terminal capabilities which can be compiled
128 Read the INSTALL document before doing this - it can cause
129 problems for older ncurses applications.
132 if ( $srcdir/shlib tic -s $SRC )
134 echo '** built new '$TERMINFO
136 echo '? tic could not build '$TERMINFO
140 # Make a symbolic link to provide compatibility with applications that expect
141 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
142 # all systems support symbolic links, and those that do provide a variety
143 # of options for 'test'.
144 if test "$TICDIR" != "$TERMINFO" ; then
145 ( rm -f $TICDIR 2>/dev/null )
146 if ( cd $TICDIR 2>/dev/null )
150 if test $TICDIR != $TERMINFO ; then
151 # Well, we tried. Some systems lie to us, so the
152 # installer will have to double-check.
153 echo "Verify if $TICDIR and $TERMINFO are the same."
154 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
155 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
159 # Construct a symbolic link that only assumes $ticdir has the
160 # same $prefix as the other installed directories.
161 RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'`
162 if test "$RELATIVE" != "$ticdir" ; then
163 RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'`
165 if ( ln -s $RELATIVE $TICDIR )
167 echo '** linked '$TICDIR' for compatibility'