OpenSDE Packages Database (without history before r20070)
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.

234 lines
7.0 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../gcc/gcc.conf
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. # create and set up cmd_wrapper for xgcc
  16. function setup_xgcc_wrapper() {
  17. mkdir gcc ; pushd gcc
  18. cat <<-EOF > xgcc-wrapper
  19. #!/bin/bash
  20. # place the xgcc in the path
  21. export PATH="$PWD:\$PATH"
  22. [ "\$GCC_WRAPPER_DEBUG" = 1 ] && export CMD_WRAPPER_DEBUG=1
  23. mycmd=\$1
  24. if [ "\${mycmd%gcj}" != "\$mycmd" ]; then
  25. export CMD_WRAPPER_OTHERS="\$GCJ_WRAPPER_OTHERS"
  26. export CMD_WRAPPER_INSERT="\$GCJ_WRAPPER_INSERT"
  27. export CMD_WRAPPER_REMOVE="\$GCJ_WRAPPER_REMOVE"
  28. export CMD_WRAPPER_APPEND="\$GCJ_WRAPPER_APPEND"
  29. export CMD_WRAPPER_FILTER="\$GCJ_WRAPPER_FILTER"
  30. elif [ "\${mycmd%gfortran}" != "\$mycmd" ]; then
  31. export CMD_WRAPPER_OTHERS="\$F95_WRAPPER_OTHERS"
  32. export CMD_WRAPPER_INSERT="\$F95_WRAPPER_INSERT"
  33. export CMD_WRAPPER_REMOVE="\$F95_WRAPPER_REMOVE"
  34. export CMD_WRAPPER_APPEND="\$F95_WRAPPER_APPEND"
  35. export CMD_WRAPPER_FILTER="\$F95_WRAPPER_FILTER"
  36. else
  37. export CMD_WRAPPER_OTHERS="\$CC_WRAPPER_OTHERS:\$GCC_WRAPPER_OTHERS:\$GCC3_WRAPPER_OTHERS"
  38. export CMD_WRAPPER_INSERT="\$CC_WRAPPER_INSERT \$GCC_WRAPPER_INSERT \$GCC3_WRAPPER_INSERT"
  39. export CMD_WRAPPER_REMOVE="\$CC_WRAPPER_REMOVE \$GCC_WRAPPER_REMOVE \$GCC3_WRAPPER_REMOVE"
  40. export CMD_WRAPPER_APPEND="\$CC_WRAPPER_APPEND \$GCC_WRAPPER_APPEND \$GCC3_WRAPPER_APPEND"
  41. export CMD_WRAPPER_FILTER="\$CC_WRAPPER_FILTER|\$GCC_WRAPPER_FILTER|\$GCC3_WRAPPER_FILTER"
  42. fi
  43. exec cmd_wrapper "\$@"
  44. EOF
  45. chmod 0755 xgcc-wrapper
  46. export STAGE_CC_WRAPPER=$PWD/xgcc-wrapper
  47. popd
  48. }
  49. # We must use an 'objdir' directory for building gcc.
  50. hook_add preconf 9 "mkdir -p objdir; cd objdir"
  51. configscript="../configure"
  52. # See http://gcc.gnu.org/gcc-3.2/c++-abi.html
  53. # and http://www.codesourcery.com/cxx-abi/.
  54. var_append confopt ' ' "--enable-__cxa_atexit"
  55. # we might build a SVN or prereleases, disable checking
  56. var_append confopt ' ' '--disable-checking'
  57. # we build a cross compiler in stage0 and later use known good GCCs, no bstrap
  58. var_append confopt ' ' '--disable-bootstrap'
  59. # add the multi-lib config
  60. if [ "$SDECFG_MULTILIB" = 1 ]; then
  61. var_append confopt ' ' "--enable-multilib"
  62. if [ -n "$SDECFG_MULTILIBLIST" ]; then
  63. var_append confopt ' ' "--with-multilib-list=$SDECFG_MULTILIBLIST"
  64. fi
  65. else
  66. var_append confopt ' ' "--disable-multilib"
  67. fi
  68. if [ "${ver:0:3}" = "3.4" -o "${ver:0:1}" = "4" ]; then
  69. gcc_lib_dir="gcc/${arch_target}/${ver%%-*}"
  70. else
  71. gcc_lib_dir="gcc-lib/${arch_target}/${ver%%-*}"
  72. fi
  73. # available languages:
  74. # grep ^language= gcc/*/config-lang.in | cut -d\" -f2 | sort | tr '\n' ' '
  75. # ada c++ fortran java obj-c++ objc treelang
  76. # only C and C++ by default, and on every stage
  77. languages="c,c++"
  78. if atstage toolchain; then
  79. bindir="/$prefix/crosscc"
  80. var_append confopt " " "--with-sysroot=$sysroot"
  81. var_append confopt " " "--program-prefix=${arch_target}-"
  82. var_append confopt " " "--disable-cpp"
  83. var_append confopt " " "--disable-shared"
  84. var_append confopt " " "--disable-libssp"
  85. fi
  86. if ! atstage native; then
  87. var_append confopt " " "--disable-libmudflap"
  88. else
  89. var_append confopt " " "--with-gnu-as"
  90. var_append confopt " " "--with-gnu-ld"
  91. var_append confopt " " "--enable-threads=posix"
  92. var_append confopt " " "--enable-version-specific-runtime-libs"
  93. if [ "$SDECFG_PKG_GCC_JAVA" != 1 ] ; then
  94. var_append confopt " " "--disable-libgcj"
  95. else
  96. var_append confopt ' ' "--enable-libgcj"
  97. var_append languages ',' 'java'
  98. fi
  99. if [ "$SDECFG_PKG_GCC_OBJC" != 0 ] ; then
  100. var_append languages ',' 'objc'
  101. fi
  102. if [ "$SDECFG_PKG_GCC_F77" != 1 ] ; then
  103. var_append confopt " " "--disable-libgfortran"
  104. elif pkginstalled -f mpfr; then
  105. var_append languages ',' 'fortran'
  106. else
  107. echo_warning 'Fortran Compiler disabled, mpfr not found.'
  108. var_append confopt " " "--disable-libgfortran"
  109. fi
  110. # Set enable-shared
  111. if [ "$diet_dynamic_static" == "static" ] ; then
  112. var_append confopt " " "--disable-shared"
  113. else
  114. var_append confopt " " "--enable-shared"
  115. fi
  116. fi
  117. var_append confopt " " "--enable-languages=$languages"
  118. gcc_premake() {
  119. # create and set up the xgcc cmd_wrapper
  120. setup_xgcc_wrapper
  121. if [ $arch = powerpc ] ; then
  122. ln -s ppc-nocross-linux-gnu powerpc-nocross-linux-gnu
  123. fi
  124. if atstage toolchain; then
  125. mkdir -p $root/$prefix/$arch_target/{bin,lib}
  126. rm -f $root/$prefix/$arch_target/include
  127. if [ -f $root/$prefix/include/stdio.h ]; then
  128. ln -s ../include $root/$prefix/$arch_target/include
  129. elif [ -f $root/$prefix/diet-include/stdio.h ]; then
  130. ln -s ../diet-include $root/$prefix/$arch_target/include
  131. fi
  132. fi
  133. }
  134. gcc_postmake()
  135. {
  136. # force a tools rebuild
  137. rm -fv $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/.lastupdate
  138. # only minimal adaptions for stage0
  139. if atstage toolchain; then
  140. ${arch_target}-ranlib \
  141. $root/$libdir/${gcc_lib_dir}/libgcc.a
  142. for x in gcc-${ver:0:1} kcc{,-${ver:0:1}} cc; do
  143. ln -svf ${arch_target}-gcc \
  144. $root/$prefix/crosscc/${arch_target}-$x
  145. done
  146. ln -svf ${arch_target}-gcc $root/$prefix/crosscc/${arch_target}-cc
  147. rm -vf "$root/$prefix/crosscc/{gcc,gcj}"
  148. return
  149. fi
  150. if atstage cross; then
  151. # This stuff needs manual installation
  152. #
  153. echo "Creating /$prefix/${arch_target} ..."
  154. mkdir -p $root/$prefix/${arch_target}/lib
  155. # FIXME! temporal hack to install libgcc_s (Ticket #100)
  156. if [ "$SDECFG_MULTILIB" = 1 -a "$SDECFG_SPARC64_32BIT" != 1 ]; then
  157. rm -rf $root$libdir/libgcc_s*
  158. pushd $builddir/gcc-*/objdir/gcc/
  159. for x in libgcc_s*.so ; do
  160. cp -v $x $root$libdir/$x.1
  161. ln -sfv $x.1 $root$libdir/$x
  162. done
  163. popd
  164. fi
  165. else
  166. # Fix the location of any improperly installed (F77) libraries
  167. mv -vf $root/$libdir/$gcc_lib_dir/../lib* \
  168. $root/$libdir/$gcc_lib_dir || true
  169. fi
  170. # Create various symlinks for cc, c++, cpp and f77.
  171. #
  172. rm -f $root/$prefix/bin/cc
  173. ln -sfv gcc $root/$prefix/bin/cc
  174. ln -sfv ../$prefix/bin/cpp $root/lib/cpp
  175. ln -sfv gcc $root/$prefix/bin/kcc-${ver:0:1}
  176. ln -sfv gcc $root/$prefix/bin/kcc
  177. if [ -f $root/$prefix/bin/gfortran ] ; then
  178. rm -fv $root/$prefix/bin/f77
  179. ln -sfv gfortran $root/$prefix/bin/f77
  180. fi
  181. # Create symlinks for runtime libraries so they can be found by
  182. # the dynamic loader and force rebuilding of the wrapper links
  183. #
  184. if atstage native; then
  185. ( cd $root/$libdir ; ln -sfv ${gcc_lib_dir}/*.so.* . )
  186. # multilib w/ 32bit - we do just check for the output dir ...
  187. [ -e $root/$libdir/${gcc_lib_dir}/32 ] && (
  188. cd $root/$libdir/../lib/
  189. ln -sfv ../lib64/${gcc_lib_dir}/32/*.so.* .
  190. )
  191. fi
  192. true
  193. }
  194. # Apply the respective gcc-2 or gcc-3 stack protector patch.
  195. hook_add prepatch 3 ". $base/package/*/gcc/apply-protector.sh"
  196. hook_add premake 5 "gcc_premake"
  197. hook_add postmake 5 "gcc_postmake"