2 ################################################################################
3 # Copyright 1996 by Thomas E. Dickey <dickey@clark.net> #
4 # All Rights Reserved. #
6 # Permission to use, copy, modify, and distribute this software and its #
7 # documentation for any purpose and without fee is hereby granted, provided #
8 # that the above copyright notice appear in all copies and that both that #
9 # copyright notice and this permission notice appear in supporting #
10 # documentation, and that the name of the above listed copyright holder(s) not #
11 # be used in advertising or publicity pertaining to distribution of the #
12 # software without specific, written prior permission. THE ABOVE LISTED #
13 # COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, #
14 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
15 # SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, #
16 # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM #
17 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE #
18 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR #
19 # PERFORMANCE OF THIS SOFTWARE. #
20 ################################################################################
21 # $Id: run_tic.sh,v 1.8 1996/12/01 05:10:08 tom Exp $
22 # This script is used to install terminfo.src using tic. We use a script
23 # because the path checking is too awkward to do in a makefile.
26 # $1 = nominal directory in which to find 'tic', i.e., $(bindir).
27 # $2 = source-directory, i.e., $(srcdir)
28 # $3 = destination-directory path, i.e., $(ticdir)
29 # $4 = install-prefix, if any
32 # The leaf directory names (bin, lib, shared, tabset, terminfo)
34 echo '** Building terminfo database, please wait...'
36 # Parameter parsing is primarily for debugging. The script is designed to
37 # be run from the misc/Makefile as
40 if test $# != 0 ; then
43 PREFIX=`echo $bindir | sed -e 's/\/bin$//'`
44 test -n "$PREFIX" && test "x$PREFIX" != "x$bindir" && prefix=$PREFIX
49 if test $# != 0 ; then
56 if test $# != 0 ; then
60 ticdir=$prefix/share/terminfo
63 if test $# != 0 ; then
70 # Allow tic to run either from the install-path, or from the build-directory
72 :*) PATH=../progs:$IP$bindir$PATH ;;
73 *) PATH=../progs:$IP$bindir:$PATH ;;
76 TERMINFO=$IP$ticdir ; export TERMINFO
79 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
80 TICDIR=`echo $TERMINFO | sed -e 's/\/share\//\/lib\//'`
82 # Remove the old terminfo stuff; we don't care if it existed before, and it
83 # would generate a lot of confusing error messages if we tried to overwrite it.
84 # We explicitly remove its contents rather than the directory itself, in case
85 # the directory is actually a symbolic link.
86 ( rm -fr $TERMINFO/[0-9A-Za-z] 2>/dev/null )
88 # If we're not installing into /usr/share/, we'll have to adjust the location
89 # of the tabset files in terminfo.src (which are in a parallel directory).
90 TABSET=`echo $ticdir | sed -e 's/\/terminfo$/\/tabset/'`
91 SRC=$srcdir/terminfo.src
92 if test "x$TABSET" != "x/usr/share/tabset" ; then
93 echo '** adjusting tabset paths'
95 sed -e s:/usr/share/tabset:$TABSET:g $SRC >$TMP
96 trap "rm -f $TMP" 0 1 2 5 15
100 if ( $srcdir/shlib tic -s $SRC )
102 echo '** built new '$TERMINFO
104 echo '? tic could not build '$TERMINFO
108 # Make a symbolic link to provide compatibility with applications that expect
109 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
110 # all systems support symbolic links, and those that do provide a variety
111 # of options for 'test'.
112 if test "$TICDIR" != "$TERMINFO" ; then
113 ( rm -f $TICDIR 2>/dev/null )
114 if ( cd $TICDIR 2>/dev/null )
118 if test $TICDIR != $TERMINFO ; then
119 # Well, we tried. Some systems lie to us, so the
120 # installer will have to double-check.
121 echo "Verify if $TICDIR and $TERMINFO are the same."
122 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
123 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
127 # Construct a symbolic link that only assumes $ticdir has the
128 # same $prefix as the other installed directories.
129 RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'`
130 if test "$RELATIVE" != "$ticdir" ; then
131 RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'`
133 if ( ln -s $RELATIVE $TICDIR )
135 echo '** linked '$TICDIR' for compatibility'