run_tic.in 6.4 KB

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