install.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #!/bin/sh
  2. #
  3. # Free Pascal installation script for Linux.
  4. # Copyright 1996-2000 Michael Van Canneyt and Peter Vreman
  5. #
  6. # Don't edit this file.
  7. # Everything can be set when the script is run.
  8. #
  9. # Release Version
  10. VERSION=1.0.4
  11. # some useful functions
  12. # ask displays 1st parameter, and ask new value for variable, whose name is
  13. # in the second parameter.
  14. ask ()
  15. {
  16. askvar=$2
  17. eval old=\$$askvar
  18. eval echo -n \""$1 [$old] : "\"
  19. read $askvar
  20. eval test -z \"\$$askvar\" && eval $askvar=\'$old\'
  21. }
  22. # yesno gives 1 on no, 0 on yes $1 gives text to display.
  23. yesno ()
  24. {
  25. while true; do
  26. echo -n "$1 (Y/n) ? "
  27. read ans
  28. case X$ans in
  29. X|Xy|XY) return 0;;
  30. Xn|XN) return 1;;
  31. esac
  32. done
  33. }
  34. # Untar files ($3,optional) from file ($1) to the given directory ($2)
  35. unztar ()
  36. {
  37. tar -xzf $HERE/$1 --directory $2 $3
  38. }
  39. # Make all the necessary directories to get $1
  40. makedirhierarch ()
  41. {
  42. OLDDIR=`pwd`
  43. case $1 in
  44. /*) cd /;;
  45. esac
  46. OLDIFS=$IFS;IFS=/;eval set $1; IFS=$OLDIFS
  47. for i
  48. do
  49. test -d $i || mkdir $i || break
  50. cd $i ||break
  51. done
  52. cd $OLDDIR
  53. }
  54. # check to see if something is in the path
  55. checkpath ()
  56. {
  57. ARG=$1
  58. OLDIFS=$IFS; IFS=":";eval set $PATH;IFS=$OLDIFS
  59. for i
  60. do
  61. if [ $i = $ARG ]; then
  62. return 0
  63. fi
  64. done
  65. return 1
  66. }
  67. # --------------------------------------------------------------------------
  68. # welcome message.
  69. #
  70. clear
  71. echo "This shell script will attempt to install the Free Pascal Compiler"
  72. echo "version $VERSION with the items you select"
  73. echo
  74. # Here we start the thing.
  75. HERE=`pwd`
  76. # Install in /usr/local or /usr ?
  77. if checkpath /usr/local/bin; then
  78. PREFIX=/usr/local
  79. else
  80. PREFIX=/usr
  81. fi
  82. ask "Install prefix (/usr or /usr/local) " PREFIX
  83. makedirhierarch $PREFIX
  84. # Set some defaults.
  85. LIBDIR=$PREFIX/lib/fpc/$VERSION
  86. SRCDIR=$PREFIX/src/fpc-$VERSION
  87. DOCDIR=$PREFIX/doc/fpc-$VERSION
  88. DEMODIR=$DOCDIR/examples
  89. EXECDIR=$PREFIX/bin
  90. # Install compiler/RTL. Mandatory.
  91. echo Unpacking ...
  92. tar xf binary.tar
  93. echo Installing compiler and RTL ...
  94. unztar baselinux.tar.gz $PREFIX
  95. rm -f $EXECDIR/ppc386
  96. ln -sf $LIBDIR/ppc386 $EXECDIR/ppc386
  97. echo Installing utilities...
  98. unztar utillinux.tar.gz $PREFIX
  99. if yesno "Install FCL"; then
  100. unztar unitsfcllinux.tar.gz $PREFIX
  101. fi
  102. if yesno "Install API"; then
  103. unztar unitsapilinux.tar.gz $PREFIX
  104. fi
  105. if yesno "Install Base (zlib,ncurses,x11) Packages"; then
  106. unztar unitsbaselinux.tar.gz $PREFIX
  107. fi
  108. if yesno "Install Net (inet,uncgi) Packages"; then
  109. unztar unitsnetlinux.tar.gz $PREFIX
  110. fi
  111. if yesno "Install Database (mysql,interbase,postgres) Packages"; then
  112. unztar unitsdblinux.tar.gz $PREFIX
  113. fi
  114. if yesno "Install Graphics (svgalib,opengl,ggi,forms) Packages"; then
  115. unztar unitsgfxlinux.tar.gz $PREFIX
  116. fi
  117. if yesno "Install Misc (utmp,paszlib) Packages"; then
  118. unztar unitsmisclinux.tar.gz $PREFIX
  119. fi
  120. rm -f *linux.tar.gz
  121. echo Done.
  122. echo
  123. # Install the sources. Optional.
  124. if yesno "Install sources"; then
  125. echo Unpacking ...
  126. tar xf sources.tar
  127. echo Installing sources in $SRCDIR ...
  128. unztar basesrc.tar.gz $PREFIX
  129. if yesno "Install compiler source"; then
  130. unztar compilersrc.tar.gz $PREFIX
  131. fi
  132. if yesno "Install RTL source"; then
  133. unztar rtlsrc.tar.gz $PREFIX
  134. fi
  135. if yesno "Install FCL source"; then
  136. unztar fclsrc.tar.gz $PREFIX
  137. fi
  138. if yesno "Install API source"; then
  139. unztar apisrc.tar.gz $PREFIX
  140. fi
  141. if yesno "Install Packages source"; then
  142. unztar packagessrc.tar.gz $PREFIX
  143. fi
  144. if yesno "Install Utils source"; then
  145. unztar utilsrc.tar.gz $PREFIX
  146. fi
  147. rm -f *src.tar.gz
  148. echo Done.
  149. fi
  150. echo
  151. # Install the documentation. Optional.
  152. if yesno "Install documentation"; then
  153. echo Installing documentation in $DOCDIR ...
  154. unztar docs.tar.gz $PREFIX
  155. echo Done.
  156. fi
  157. echo
  158. # Install the demos. Optional.
  159. if yesno "Install demos"; then
  160. ask "Install demos in" DEMODIR
  161. echo Installing demos in $DEMODIR ...
  162. makedirhierarch $DEMODIR
  163. unztar demo.tar.gz $DEMODIR
  164. echo Done.
  165. fi
  166. echo
  167. # Install /etc/fpc.cfg, this is done using the samplecfg script
  168. $LIBDIR/samplecfg $LIBDIR
  169. # The End
  170. echo
  171. echo End of installation.
  172. echo
  173. echo Refer to the documentation for more information.
  174. echo