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 1997/05/09 10:43:29 hjl 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 = the common object directory.
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
41 if test $# != 0 ; then
46 if test $# != 0 ; then
53 if test $# != 0 ; then
57 ticdir=$prefix/share/terminfo
60 if test $# != 0 ; then
67 TERMINFO=$IP$ticdir ; export TERMINFO
70 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
71 TICDIR=`echo $TERMINFO | sed -e 's/\/share\//\/lib\//'`
73 # Remove the old terminfo stuff; we don't care if it existed before, and it
74 # would generate a lot of confusing error messages if we tried to overwrite it.
75 # We explicitly remove its contents rather than the directory itself, in case
76 # the directory is actually a symbolic link.
77 ( rm -fr $TERMINFO/[0-9A-Za-z] 2>/dev/null )
79 # If we're not installing into /usr/share/, we'll have to adjust the location
80 # of the tabset files in terminfo.src (which are in a parallel directory).
81 TABSET=`echo $ticdir | sed -e 's/\/terminfo$/\/tabset/'`
82 SRC=$srcdir/terminfo.src
83 if test "x$TABSET" != "x/usr/share/tabset" ; then
84 echo '** adjusting tabset paths'
86 sed -e s:/usr/share/tabset:$TABSET:g $SRC >$TMP
87 trap "rm -f $TMP" 0 1 2 5 15
91 LD_LIBRARY_PATH=$common_objpfx:$common_objpfx/nss:$common_objpfx/ncurses \
92 $common_objpfx/elf/ld.so \
93 $common_objpfx/ncurses/tic -s $SRC
96 echo '** built new '$TERMINFO
98 echo '? tic could not build '$TERMINFO
102 # Make a symbolic link to provide compatibility with applications that expect
103 # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
104 # all systems support symbolic links, and those that do provide a variety
105 # of options for 'test'.
106 if test "$TICDIR" != "$TERMINFO" ; then
107 ( rm -f $TICDIR 2>/dev/null )
108 if ( cd $TICDIR 2>/dev/null )
112 if test $TICDIR != $TERMINFO ; then
113 # Well, we tried. Some systems lie to us, so the
114 # installer will have to double-check.
115 echo "Verify if $TICDIR and $TERMINFO are the same."
116 echo "The new terminfo is in $TERMINFO; the other should be a link to it."
117 echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
121 # Construct a symbolic link that only assumes $ticdir has the
122 # same $prefix as the other installed directories.
123 RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'`
124 if test "$RELATIVE" != "$ticdir" ; then
125 RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'`
127 if ( ln -s $RELATIVE $TICDIR )
129 echo '** linked '$TICDIR' for compatibility'