Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | #!@SHELL@ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 2 | # $Id: run_tic.in,v 1.34 2012/10/06 19:00:51 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 3 | ############################################################################## |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 4 | # Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. # |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | # |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | # Author: Thomas E. Dickey 1996-on |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 44 | : ${suffix:=@EXEEXT@} |
| 45 | : ${DESTDIR:=@DESTDIR@} |
| 46 | : ${prefix:=@prefix@} |
| 47 | : ${exec_prefix:=@exec_prefix@} |
| 48 | : ${bindir:=@bindir@} |
| 49 | : ${top_srcdir:=@top_srcdir@} |
| 50 | : ${srcdir:=@srcdir@} |
| 51 | : ${datarootdir:=@datarootdir@} |
| 52 | : ${datadir:=@datadir@} |
| 53 | : ${TIC_PATH:=@TIC_PATH@} |
| 54 | : ${ticdir:=@TERMINFO@} |
| 55 | : ${source:=@TERMINFO_SRC@} |
| 56 | : ${LN_S:="@LN_S@"} |
| 57 | : ${cross_compiling:=no} |
| 58 | : ${ext_funcs:=@NCURSES_EXT_FUNCS@} |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 59 | |
| 60 | test -z "${DESTDIR}" && DESTDIR= |
| 61 | |
| 62 | # Allow tic to run either from the install-path, or from the build-directory. |
| 63 | # Do not do this if we appear to be cross-compiling. In that case, we rely |
| 64 | # on the host's copy of tic to compile the terminfo database. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 65 | if test "x$cross_compiling" = "xno" |
| 66 | then |
| 67 | if test -f ../progs/tic$suffix |
| 68 | then |
| 69 | case "$PATH" in |
| 70 | \@PATH_SEPARATOR@*) |
| 71 | PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH" |
| 72 | ;; |
| 73 | *) |
| 74 | PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH" |
| 75 | ;; |
| 76 | esac |
| 77 | export PATH |
| 78 | if test @DFT_LWR_MODEL@ = shared |
| 79 | then |
| 80 | SHLIB="sh $srcdir/shlib" |
| 81 | TIC_PATH="$SHLIB tic" |
| 82 | else |
| 83 | TIC_PATH="tic" |
| 84 | fi |
| 85 | elif test "$TIC_PATH" = unknown |
| 86 | then |
| 87 | echo '? no tic program found' |
| 88 | exit 1 |
| 89 | fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 90 | else |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 91 | # Cross-compiling, so don't set PATH or run shlib. |
| 92 | SHLIB= |
| 93 | # reset $suffix, since it applies to the target, not the build platform. |
| 94 | suffix= |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 95 | fi |
| 96 | |
| 97 | |
| 98 | # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses |
| 99 | # the PATH we just set. |
| 100 | SHLIB_PATH=$PATH |
| 101 | export SHLIB_PATH |
| 102 | |
| 103 | # set a variable to simplify environment update in shlib |
| 104 | SHLIB_HOST=@host_os@ |
| 105 | export SHLIB_HOST |
| 106 | |
| 107 | # don't use user's TERMINFO variable |
| 108 | TERMINFO=${DESTDIR}$ticdir ; export TERMINFO |
| 109 | umask 022 |
| 110 | |
| 111 | # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. |
| 112 | TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'` |
| 113 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 114 | # Parent directory may not exist, which would confuse the install for hashed |
| 115 | # database. Fix. |
| 116 | PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'` |
| 117 | if test -n "$PARENT" |
| 118 | then |
| 119 | test -d $PARENT || mkdir -p $PARENT |
| 120 | fi |
| 121 | |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 122 | # Remove the old terminfo stuff; we don't care if it existed before, and it |
| 123 | # would generate a lot of confusing error messages if we tried to overwrite it. |
| 124 | # We explicitly remove its contents rather than the directory itself, in case |
| 125 | # the directory is actually a symbolic link. |
| 126 | ( test -d "$TERMINFO" && cd $TERMINFO && rm -fr ? 2>/dev/null ) |
| 127 | |
| 128 | if test "$ext_funcs" = 1 ; then |
| 129 | cat <<EOF |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 130 | Running $TIC_PATH to install $TERMINFO ... |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 131 | |
| 132 | You may see messages regarding extended capabilities, e.g., AX. |
| 133 | These are extended terminal capabilities which are compiled |
| 134 | using |
| 135 | tic -x |
| 136 | If you have ncurses 4.2 applications, you should read the INSTALL |
| 137 | document, and install the terminfo without the -x option. |
| 138 | |
| 139 | EOF |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 140 | if ( $TIC_PATH -x -s -o $TERMINFO $source ) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 141 | then |
| 142 | echo '** built new '$TERMINFO |
| 143 | else |
| 144 | echo '? tic could not build '$TERMINFO |
| 145 | exit 1 |
| 146 | fi |
| 147 | else |
| 148 | cat <<EOF |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 149 | Running $TIC_PATH to install $TERMINFO ... |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 150 | |
| 151 | You may see messages regarding unknown capabilities, e.g., AX. |
| 152 | These are extended terminal capabilities which may be compiled |
| 153 | using |
| 154 | tic -x |
| 155 | If you have ncurses 4.2 applications, you should read the INSTALL |
| 156 | document, and install the terminfo without the -x option. |
| 157 | |
| 158 | EOF |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 159 | if ( $TIC_PATH -s -o $TERMINFO $source ) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 160 | then |
| 161 | echo '** built new '$TERMINFO |
| 162 | else |
| 163 | echo '? tic could not build '$TERMINFO |
| 164 | exit 1 |
| 165 | fi |
| 166 | fi |
| 167 | |
| 168 | # Make a symbolic link to provide compatibility with applications that expect |
| 169 | # to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not |
| 170 | # all systems support symbolic links, and those that do provide a variety |
| 171 | # of options for 'test'. |
| 172 | if test "$TICDIR" != "$TERMINFO" ; then |
| 173 | ( rm -f $TICDIR 2>/dev/null ) |
| 174 | if ( cd $TICDIR 2>/dev/null ) |
| 175 | then |
| 176 | cd $TICDIR |
| 177 | TICDIR=`pwd` |
| 178 | if test $TICDIR != $TERMINFO ; then |
| 179 | # Well, we tried. Some systems lie to us, so the |
| 180 | # installer will have to double-check. |
| 181 | echo "Verify if $TICDIR and $TERMINFO are the same." |
| 182 | echo "The new terminfo is in $TERMINFO; the other should be a link to it." |
| 183 | echo "Otherwise, remove $TICDIR and link it to $TERMINFO." |
| 184 | fi |
| 185 | else |
| 186 | cd ${DESTDIR}$prefix |
| 187 | # Construct a symbolic link that only assumes $ticdir has the |
| 188 | # same $prefix as the other installed directories. |
| 189 | RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'` |
| 190 | if test "$RELATIVE" != "$ticdir" ; then |
| 191 | RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'` |
| 192 | fi |
| 193 | if ( @LN_S@ $RELATIVE $TICDIR ) |
| 194 | then |
| 195 | echo '** sym-linked '$TICDIR' for compatibility' |
| 196 | else |
| 197 | echo '** could not sym-link '$TICDIR' for compatibility' |
| 198 | fi |
| 199 | fi |
| 200 | fi |
| 201 | # vile:shmode |