Install 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/sh
  2. # Install - GCC4TI source installation wizard
  3. # (created from TIGCC source installation wizard)
  4. #
  5. # Copyright (C) 2004 Kevin Kofler
  6. # Copyright (C) 2009 Lionel Debroux
  7. # Copyright (C) 2009 Patrick Pelissier
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2, or (at your option)
  12. # any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; if not, write to the Free Software Foundation,
  21. # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. oldecho=`echo -n test | grep '\-n'`
  23. if [ "x$oldecho" = "x" ]; then
  24. #This echo supports '-n' (no newline)
  25. echon="echo -n"
  26. else
  27. echon=echo
  28. fi
  29. # Move into the script directory
  30. cd $(dirname $0)
  31. echo "GCC4TI Installation Wizard"
  32. # Get GCC4TI prefix directory
  33. if [ -z "$PREFIX_GCC4TI" ]
  34. then PREFIX_GCC4TI="/usr/local/share/gcc4ti"
  35. fi
  36. ${echon} "Destination directory ($PREFIX_GCC4TI) - will become \$TIGCC: "
  37. read PREFIX_GCC4TInew
  38. # PpHd: use eval so that the user can enter e.g. $HOME/gcc4ti
  39. PREFIX_GCC4TInew=`eval echo "$PREFIX_GCC4TInew"`
  40. if [ ! -z "$PREFIX_GCC4TInew" ]
  41. then PREFIX_GCC4TI="$PREFIX_GCC4TInew"
  42. fi
  43. export PREFIX_GCC4TI
  44. # Get Bootstrap compiler
  45. if [ -z "$CC" ]
  46. then CC="gcc"
  47. fi
  48. ${echon} "Bootstrap compiler ($CC): "
  49. read CCnew
  50. if [ ! -z "$CCnew" ]
  51. then CC="$CCnew"
  52. fi
  53. export CC
  54. # Check if this is Apple GCC
  55. if [ ! -z "`$CC -v 2>&1 | grep Apple`" ]
  56. then echo "Apple GCC detected, adding -no-cpp-precomp and -DHAVE_DESIGNATED_INITIALIZERS=0 to \$CC"
  57. export CC="$CC -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
  58. fi
  59. if [ -z "$CFLAGS" ]
  60. then CFLAGS="-Os -s -fno-exceptions -fomit-frame-pointer"
  61. fi
  62. ${echon} "Optimization flags ($CFLAGS): "
  63. read CFLAGSnew
  64. if [ ! -z "$CFLAGSnew" ]
  65. then CFLAGS="$CFLAGSnew"
  66. fi
  67. export CFLAGS
  68. ${echon} "Host platform for the generated executables ($GCC4TIHOST), leave empty if not cross-compiling: "
  69. read GCC4TIHOSTnew
  70. if [ ! -z "$GCC4TIHOSTnew" ]
  71. then GCC4TIHOST="$GCC4TIHOSTnew"
  72. fi
  73. export GCC4TIHOST
  74. # Apply GCC4TI patch if desired
  75. if ./Install_step_1 ; then
  76. echo "Patching done."
  77. else
  78. echo Patching failed
  79. exit 1
  80. fi
  81. # Complete the installation
  82. if ./Install_All_nopatch ; then
  83. echo "Installation done."
  84. else
  85. echo Installation failed
  86. exit 1
  87. fi
  88. # Now offer to install environment variables
  89. ${echon} "Add environment settings (\$TIGCC, \$PATH) to bashrc [Y/n]? "
  90. read AddEnvSettings
  91. echo
  92. if [ -z "$AddEnvSettings" -o "x$AddEnvSettings" = xy -o "x$AddEnvSettings" = xY ]
  93. then
  94. TIGCC="$PREFIX_GCC4TI"
  95. export TIGCC
  96. "$PREFIX_GCC4TI/bin/envreg"
  97. echo "Done. You must restart bash for the new environment settings to take effect."
  98. exit 0;
  99. fi
  100. echo "Done. Make sure you set \$TIGCC to \"$PREFIX_GCC4TI\" and append \$TIGCC/bin to your \$PATH before using GCC4TI."
  101. exit 0