mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
5.1 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/gcc/parse-config
  9. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. if [ $stagelevel -gt 0 ]
  23. then
  24. # ---- NOT IN STAGE 0 ---
  25. # Use the GCC-[23] stack protector patch
  26. #
  27. if [ $pkg != glibc23 -a $pkg != glibc22 -a \
  28. $pkg != grub -a $pkg != dietlibc ]
  29. then
  30. if [ "$ROCKCFG_PKG_GCC_STACKPRO" = 1 ] ; then
  31. var_append GCC4_WRAPPER_INSERT " " "-fstack-protector"
  32. fi
  33. fi
  34. # maybe we add something more later. But imo it's better to
  35. # let the options of KCC unmodified for gcc[23]. (Clifford)
  36. #
  37. if [[ $ROCKCFG_DEFAULT_KCC = gcc* ]] ; then
  38. export KCC="${archprefix}kcc-${ROCKCFG_DEFAULT_KCC#gcc}"
  39. if [ "$ROCKCFG_OPT" = "size" ] ; then
  40. var_insert KCC_WRAPPER_REMOVE " " "-O -O[0-9]"
  41. var_insert KCC_WRAPPER_INSERT " " "-Os"
  42. fi
  43. fi
  44. # set CC, CXX and F77 environment variables
  45. #
  46. for x in CC CXX F77 ; do
  47. eval "y=\$ROCKCFG_DEFAULT_$x"
  48. if [[ $y = gcc* ]] ; then
  49. case "$x-$stagelevel" in
  50. CC-*)
  51. z="${archprefix}gcc ${archprefix}gcc-${y#gcc}" ;;
  52. CXX-[1-9])
  53. z="${archprefix}g++ ${archprefix}g++-${y#gcc}" ;;
  54. F77-[2-9])
  55. z="${archprefix}g77 ${archprefix}g77-${y#gcc}" ;;
  56. *)
  57. export $x=${x}_not_available_in_stage_${stagelevel}
  58. continue ;;
  59. esac
  60. for y in $z ; do
  61. [ "`type -p $y`" ] && export $x=$y
  62. done
  63. fi
  64. done
  65. # Use automatically precompiled C++ headers
  66. if [ "$ROCKCFG_AUTOPCH" = 1 ] ; then
  67. [ -n "$CXX" -a -n "`type -p g++-autopch`" ] && \
  68. CXX="eval AUTOPCHCXX=\"$CXX\" g++-autopch"
  69. fi
  70. # Add the usual gcc optimization options
  71. # Strip or add debug information
  72. #
  73. if [ "$ROCKCFG_DEBUG" = 0 ] ; then
  74. var_append GCC_WRAPPER_APPEND " " "-s"
  75. var_insert GCC_WRAPPER_REMOVE " " "-g*"
  76. else
  77. if [[ $pkg != glibc* ]] ; then
  78. var_append GCC_WRAPPER_APPEND " " "-ggdb"
  79. var_insert GCC_WRAPPER_REMOVE " " "-s -g*"
  80. fi
  81. fi
  82. # remove other -O options from the argument list
  83. var_insert GCC_WRAPPER_REMOVE " " "-O -O[0-9s]"
  84. case "$ROCKCFG_OPT" in
  85. smart)
  86. var_insert GCC_WRAPPER_INSERT " " "-SPEED-O2 -SIZE-Os -pipe"
  87. var_insert GCC_WRAPPER_FILTER "|" "gawk -f $base/misc/tools-source/smartwr.awk $base/scripts/smart_db.txt -"
  88. ;;
  89. bizarre)
  90. var_insert GCC_WRAPPER_INSERT " " "-SPEED-Os -SIZE-O2 -pipe"
  91. var_insert GCC_WRAPPER_FILTER "|" "gawk -f $base/misc/tools-source/smartwr.awk $base/scripts/smart_db.txt -"
  92. ;;
  93. speed)
  94. var_insert GCC_WRAPPER_INSERT " " "-O2 -pipe"
  95. ;;
  96. size)
  97. var_insert GCC_WRAPPER_INSERT " " "-Os -pipe"
  98. ;;
  99. lazy)
  100. var_insert GCC_WRAPPER_INSERT " " "-O1 -pipe"
  101. ;;
  102. test)
  103. case "$pkg" in
  104. gcc*|glibc*|binutils*|make|bzip2|gzip|coreutils|bash*|gawk|sed)
  105. var_insert GCC_WRAPPER_INSERT " " "-Os -pipe"
  106. ;;
  107. *)
  108. var_insert GCC_WRAPPER_INSERT " " "-O1 -pipe"
  109. ;;
  110. esac
  111. ;;
  112. esac
  113. var_append GCC_WRAPPER_APPEND " " "$ROCKCFG_C_FLAGS"
  114. # Compile (i.e. link) all bins statically
  115. #
  116. if [ "$ROCKCFG_STATIC" = 1 ]; then
  117. var_insert GCC_WRAPPER_INSERT " " "-static"
  118. fi
  119. # Compile with no exceptions or rtti, gcc itself must support both
  120. #
  121. if [ "$ROCKCFG_LIMITCXX" = 1 ] && [[ $pkg != gcc* ]] ; then
  122. var_append CXX_WRAPPER_APPEND " " "-fno-exceptions -fno-rtti"
  123. fi
  124. # Passing -I/usr{/local/}include creates a warning in gcc3 which is confusing
  125. # some of the configure scripts and Makefiles.
  126. #
  127. var_insert GCC3_WRAPPER_REMOVE " " "-I/usr/include"
  128. var_insert GCC3_WRAPPER_REMOVE " " "-I/usr/local/include"
  129. #
  130. var_insert GCC4_WRAPPER_REMOVE " " "-I/usr/include"
  131. var_insert GCC4_WRAPPER_REMOVE " " "-I/usr/local/include"
  132. # Add the architecture gcc optimisation options
  133. #
  134. if [ -f architecture/$arch/gcc-options ] ; then
  135. . architecture/$arch/gcc-options
  136. fi
  137. # Use our cross specs file for stage 1
  138. #
  139. if [ $stagelevel -eq 1 ]; then
  140. var_insert GCC_WRAPPER_INSERT " " "--specs=specs.cross"
  141. if [ "$ROCKCFG_CROSSBUILD" = 1 ]; then
  142. for x in $root/usr/include/c++/*; do
  143. var_insert CXX_WRAPPER_INSERT " " "-I$x"
  144. var_insert CXX_WRAPPER_INSERT " " "-I$x/$arch_target"
  145. done
  146. fi
  147. fi
  148. # Use our chroot specs file for pseudonative
  149. #
  150. if [ $stagelevel -gt 1 -a "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  151. var_insert GCC_WRAPPER_INSERT " " "--specs=specs.chroot"
  152. fi
  153. # register the forcefpic handler
  154. gcc_force_fpic_handler() {
  155. if [ "$forcefpic" = 1 ]; then
  156. # echo_status "Enabling force -fPIC mechanism for gcc."
  157. var_insert GCC_WRAPPER_INSERT " " "-fPIC"
  158. fi
  159. }
  160. hook_add prepare 7 'gcc_force_fpic_handler'
  161. # ---- NOT IN STAGE 0 ---
  162. fi