| 1 | #!@SHELL@ | 
|---|
| 2 | ############################################################################## | 
|---|
| 3 | # Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.                # | 
|---|
| 4 | #                                                                            # | 
|---|
| 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:                                                      # | 
|---|
| 12 | #                                                                            # | 
|---|
| 13 | # The above copyright notice and this permission notice shall be included in # | 
|---|
| 14 | # all copies or substantial portions of the Software.                        # | 
|---|
| 15 | #                                                                            # | 
|---|
| 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.                                                  # | 
|---|
| 23 | #                                                                            # | 
|---|
| 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               # | 
|---|
| 27 | # authorization.                                                             # | 
|---|
| 28 | ############################################################################## | 
|---|
| 29 | # | 
|---|
| 30 | # Author: Thomas E. Dickey 1996,2000 | 
|---|
| 31 | # | 
|---|
| 32 | # $Id: run_tic.in,v 1.20 2005/09/17 23:13:49 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. | 
|---|
| 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 | : ${THAT_CC=cc} | 
|---|
| 56 | : ${THIS_CC=cc} | 
|---|
| 57 | : ${ext_funcs=@NCURSES_EXT_FUNCS@} | 
|---|
| 58 |  | 
|---|
| 59 | test -z "${DESTDIR}" && DESTDIR= | 
|---|
| 60 |  | 
|---|
| 61 | # Allow tic to run either from the install-path, or from the build-directory. | 
|---|
| 62 | # Do not do this if we appear to be cross-compiling.  In that case, we rely | 
|---|
| 63 | # on the host's copy of tic to compile the terminfo database. | 
|---|
| 64 | if test "$THAT_CC" = "$THIS_CC" ; then | 
|---|
| 65 | case "$PATH" in | 
|---|
| 66 | @PATH_SEPARATOR@*) PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH" ;; | 
|---|
| 67 | *) PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH" ;; | 
|---|
| 68 | esac | 
|---|
| 69 | export PATH | 
|---|
| 70 | SHLIB="sh $srcdir/shlib" | 
|---|
| 71 | else | 
|---|
| 72 | # Cross-compiling, so don't set PATH or run shlib. | 
|---|
| 73 | SHLIB= | 
|---|
| 74 | # reset $suffix, since it applies to the target, not the build platform. | 
|---|
| 75 | suffix= | 
|---|
| 76 | fi | 
|---|
| 77 |  | 
|---|
| 78 |  | 
|---|
| 79 | # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses | 
|---|
| 80 | # the PATH we just set. | 
|---|
| 81 | SHLIB_PATH=$PATH | 
|---|
| 82 | export SHLIB_PATH | 
|---|
| 83 |  | 
|---|
| 84 | # set a variable to simplify environment update in shlib | 
|---|
| 85 | SHLIB_HOST=@host_os@ | 
|---|
| 86 | export SHLIB_HOST | 
|---|
| 87 |  | 
|---|
| 88 | # don't use user's TERMINFO variable | 
|---|
| 89 | TERMINFO=${DESTDIR}$ticdir ; export TERMINFO | 
|---|
| 90 | umask 022 | 
|---|
| 91 |  | 
|---|
| 92 | # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. | 
|---|
| 93 | TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'` | 
|---|
| 94 |  | 
|---|
| 95 | # Remove the old terminfo stuff; we don't care if it existed before, and it | 
|---|
| 96 | # would generate a lot of confusing error messages if we tried to overwrite it. | 
|---|
| 97 | # We explicitly remove its contents rather than the directory itself, in case | 
|---|
| 98 | # the directory is actually a symbolic link. | 
|---|
| 99 | ( cd $TERMINFO && rm -fr ? 2>/dev/null ) | 
|---|
| 100 |  | 
|---|
| 101 | if test "$ext_funcs" = 1 ; then | 
|---|
| 102 | cat <<EOF | 
|---|
| 103 | Running tic to install $TERMINFO ... | 
|---|
| 104 |  | 
|---|
| 105 | You may see messages regarding extended capabilities, e.g., AX. | 
|---|
| 106 | These are extended terminal capabilities which are compiled | 
|---|
| 107 | using | 
|---|
| 108 | tic -x | 
|---|
| 109 | If you have ncurses 4.2 applications, you should read the INSTALL | 
|---|
| 110 | document, and install the terminfo without the -x option. | 
|---|
| 111 |  | 
|---|
| 112 | EOF | 
|---|
| 113 | if ( $SHLIB tic$suffix -x -s -o $TERMINFO $source ) | 
|---|
| 114 | then | 
|---|
| 115 | echo '** built new '$TERMINFO | 
|---|
| 116 | else | 
|---|
| 117 | echo '? tic could not build '$TERMINFO | 
|---|
| 118 | exit 1 | 
|---|
| 119 | fi | 
|---|
| 120 | else | 
|---|
| 121 | cat <<EOF | 
|---|
| 122 | Running tic to install $TERMINFO ... | 
|---|
| 123 |  | 
|---|
| 124 | You may see messages regarding unknown capabilities, e.g., AX. | 
|---|
| 125 | These are extended terminal capabilities which may be compiled | 
|---|
| 126 | using | 
|---|
| 127 | tic -x | 
|---|
| 128 | If you have ncurses 4.2 applications, you should read the INSTALL | 
|---|
| 129 | document, and install the terminfo without the -x option. | 
|---|
| 130 |  | 
|---|
| 131 | EOF | 
|---|
| 132 | if ( $SHLIB tic$suffix -s -o $TERMINFO $source ) | 
|---|
| 133 | then | 
|---|
| 134 | echo '** built new '$TERMINFO | 
|---|
| 135 | else | 
|---|
| 136 | echo '? tic could not build '$TERMINFO | 
|---|
| 137 | exit 1 | 
|---|
| 138 | fi | 
|---|
| 139 | fi | 
|---|
| 140 |  | 
|---|
| 141 | # Make a symbolic link to provide compatibility with applications that expect | 
|---|
| 142 | # to find terminfo under /usr/lib.  That is, we'll _try_ to do that.  Not | 
|---|
| 143 | # all systems support symbolic links, and those that do provide a variety | 
|---|
| 144 | # of options for 'test'. | 
|---|
| 145 | if test "$TICDIR" != "$TERMINFO" ; then | 
|---|
| 146 | ( rm -f $TICDIR 2>/dev/null ) | 
|---|
| 147 | if ( cd $TICDIR 2>/dev/null ) | 
|---|
| 148 | then | 
|---|
| 149 | cd $TICDIR | 
|---|
| 150 | TICDIR=`pwd` | 
|---|
| 151 | if test $TICDIR != $TERMINFO ; then | 
|---|
| 152 | # Well, we tried.  Some systems lie to us, so the | 
|---|
| 153 | # installer will have to double-check. | 
|---|
| 154 | echo "Verify if $TICDIR and $TERMINFO are the same." | 
|---|
| 155 | echo "The new terminfo is in $TERMINFO; the other should be a link to it." | 
|---|
| 156 | echo "Otherwise, remove $TICDIR and link it to $TERMINFO." | 
|---|
| 157 | fi | 
|---|
| 158 | else | 
|---|
| 159 | cd ${DESTDIR}$prefix | 
|---|
| 160 | # Construct a symbolic link that only assumes $ticdir has the | 
|---|
| 161 | # same $prefix as the other installed directories. | 
|---|
| 162 | RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'` | 
|---|
| 163 | if test "$RELATIVE" != "$ticdir" ; then | 
|---|
| 164 | RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'` | 
|---|
| 165 | fi | 
|---|
| 166 | if ( @LN_S@ $RELATIVE $TICDIR ) | 
|---|
| 167 | then | 
|---|
| 168 | echo '** sym-linked '$TICDIR' for compatibility' | 
|---|
| 169 | else | 
|---|
| 170 | echo '** could not sym-link '$TICDIR' for compatibility' | 
|---|
| 171 | fi | 
|---|
| 172 | fi | 
|---|
| 173 | fi | 
|---|