]> ncurses.scripts.mit.edu Git - ncurses.git/blob - misc/run_tic.in
ncurses 5.7 - patch 20091031
[ncurses.git] / misc / run_tic.in
1 #!@SHELL@
2 # $Id: run_tic.in,v 1.24 2009/08/15 17:19:36 tom Exp $
3 ##############################################################################
4 # Copyright (c) 1998-2006,2009 Free Software Foundation, Inc.                #
5 #                                                                            #
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:                                                      #
13 #                                                                            #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software.                        #
16 #                                                                            #
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.                                                  #
24 #                                                                            #
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               #
28 # authorization.                                                             #
29 ##############################################################################
30 #
31 # Author: Thomas E. Dickey 1996-on
32 #
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.
35 #
36 # Assumes:
37 #       The leaf directory names (lib, tabset, terminfo)
38 #
39 echo '** Building terminfo database, please wait...'
40 #
41 # The script is designed to be run from the misc/Makefile as
42 #       make install.data
43
44 : ${suffix=@PROG_EXT@}
45 : ${DESTDIR=@DESTDIR@}
46 : ${prefix=@prefix@}
47 : ${exec_prefix=@exec_prefix@}
48 : ${bindir=@bindir@}
49 : ${top_srcdir=@top_srcdir@}
50 : ${srcdir=@srcdir@}
51 : ${datadir=@datadir@}
52 : ${ticdir=@TERMINFO@}
53 : ${source=@TERMINFO_SRC@}
54 : ${LN_S="@LN_S@"}
55 : ${cross_compiling=no}
56 : ${ext_funcs=@NCURSES_EXT_FUNCS@}
57
58 test -z "${DESTDIR}" && DESTDIR=
59
60 # Allow tic to run either from the install-path, or from the build-directory.
61 # Do not do this if we appear to be cross-compiling.  In that case, we rely
62 # on the host's copy of tic to compile the terminfo database.
63 if test "x$cross_compiling" = "xno" ; then
64 case "$PATH" in
65 @PATH_SEPARATOR@*) PATH=../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH ;;
66 *) PATH=../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH ;;
67 esac
68 export PATH
69 SHLIB="sh $srcdir/shlib"
70 else
71 # Cross-compiling, so don't set PATH or run shlib.
72 SHLIB=
73 # reset $suffix, since it applies to the target, not the build platform.
74 suffix=
75 fi
76
77
78 # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
79 # the PATH we just set.
80 SHLIB_PATH=$PATH
81 export SHLIB_PATH
82
83 # set a variable to simplify environment update in shlib
84 SHLIB_HOST=@host_os@
85 export SHLIB_HOST
86
87 # don't use user's TERMINFO variable
88 TERMINFO=${DESTDIR}$ticdir ; export TERMINFO
89 umask 022
90
91 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
92 TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'`
93
94 # Remove the old terminfo stuff; we don't care if it existed before, and it
95 # would generate a lot of confusing error messages if we tried to overwrite it.
96 # We explicitly remove its contents rather than the directory itself, in case
97 # the directory is actually a symbolic link.
98 ( test -d "$TERMINFO" && cd $TERMINFO && rm -fr ? 2>/dev/null )
99
100 if test "$ext_funcs" = 1 ; then
101 cat <<EOF
102 Running tic to install $TERMINFO ...
103
104         You may see messages regarding extended capabilities, e.g., AX.
105         These are extended terminal capabilities which are compiled
106         using
107                 tic -x
108         If you have ncurses 4.2 applications, you should read the INSTALL
109         document, and install the terminfo without the -x option.
110
111 EOF
112 if ( $SHLIB tic$suffix -x -s -o $TERMINFO $source )
113 then
114         echo '** built new '$TERMINFO
115 else
116         echo '? tic could not build '$TERMINFO
117         exit 1
118 fi
119 else
120 cat <<EOF
121 Running tic to install $TERMINFO ...
122
123         You may see messages regarding unknown capabilities, e.g., AX.
124         These are extended terminal capabilities which may be compiled
125         using
126                 tic -x
127         If you have ncurses 4.2 applications, you should read the INSTALL
128         document, and install the terminfo without the -x option.
129
130 EOF
131 if ( $SHLIB tic$suffix -s -o $TERMINFO $source )
132 then
133         echo '** built new '$TERMINFO
134 else
135         echo '? tic could not build '$TERMINFO
136         exit 1
137 fi
138 fi
139
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 )
147         then
148                 cd $TICDIR
149                 TICDIR=`pwd`
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."
156                 fi
157         else
158                 cd ${DESTDIR}$prefix
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%^/%%'`
164                 fi
165                 if ( @LN_S@ $RELATIVE $TICDIR )
166                 then
167                         echo '** sym-linked '$TICDIR' for compatibility'
168                 else
169                         echo '** could not sym-link '$TICDIR' for compatibility'
170                 fi
171         fi
172 fi
173 # vile:shmode