install.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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=0.99.14
  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. if yesno "Install FCL"; then
  98. unztar unitsfcllinux.tar.gz $PREFIX
  99. fi
  100. if yesno "Install API"; then
  101. unztar unitsapilinux.tar.gz $PREFIX
  102. fi
  103. if yesno "Install Base (zlib,ncurses,x11) Packages"; then
  104. unztar unitsbaselinux.tar.gz $PREFIX
  105. fi
  106. if yesno "Install Net (inet,uncgi) Packages"; then
  107. unztar unitsnetlinux.tar.gz $PREFIX
  108. fi
  109. if yesno "Install Database (mysql,interbase,postgres) Packages"; then
  110. unztar unitsdblinux.tar.gz $PREFIX
  111. fi
  112. if yesno "Install Graphics (svgalib,opengl,ggi,forms) Packages"; then
  113. unztar unitsgfxlinux.tar.gz $PREFIX
  114. fi
  115. if yesno "Install Misc (utmp,paszlib) Packages"; then
  116. unztar unitsmisclinux.tar.gz $PREFIX
  117. fi
  118. rm -f *linux.tar.gz
  119. echo Done.
  120. echo
  121. # Install the sources. Optional.
  122. if yesno "Install sources"; then
  123. echo Unpacking ...
  124. tar xf sources.tar
  125. echo Installing sources in $SRCDIR ...
  126. unztar basesrc.tar.gz $PREFIX
  127. if yesno "Install compiler source"; then
  128. unztar compilersrc.tar.gz $PREFIX
  129. fi
  130. if yesno "Install RTL source"; then
  131. unztar rtlsrc.tar.gz $PREFIX
  132. fi
  133. if yesno "Install FCL source"; then
  134. unztar fclsrc.tar.gz $PREFIX
  135. fi
  136. if yesno "Install API source"; then
  137. unztar apisrc.tar.gz $PREFIX
  138. fi
  139. if yesno "Install Packages source"; then
  140. unztar packagessrc.tar.gz $PREFIX
  141. fi
  142. if yesno "Install Utils source"; then
  143. unztar utilssrc.tar.gz $PREFIX
  144. fi
  145. rm -f *src.tar.gz
  146. echo Done.
  147. fi
  148. echo
  149. # Install the documentation. Optional.
  150. if yesno "Install documentation"; then
  151. echo Installing documentation in $DOCDIR ...
  152. unztar docs.tar.gz $PREFIX
  153. echo Done.
  154. fi
  155. echo
  156. # Install the demos. Optional.
  157. if yesno "Install demos"; then
  158. ask "Install demos in" DEMODIR
  159. echo Installing demos in $DEMODIR ...
  160. makedirhierarch $DEMODIR
  161. unztar demo.tar.gz $DEMODIR
  162. echo Done.
  163. fi
  164. echo
  165. # Install /etc/ppc386.cfg, this is done using the samplecfg script
  166. $LIBDIR/samplecfg $LIBDIR
  167. # Cleanup
  168. SOURCES=`/bin/ls *src.tar.gz`
  169. FILES=`/bin/ls *linux.tar.gz`
  170. # The End
  171. echo
  172. echo End of installation.
  173. echo
  174. echo Refer to the documentation for more information.
  175. echo