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.

249 lines
7.5 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 - 2008 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. if [ "$arch_machine" != "i386" ]; then
  55. var_append confopt ' ' "--enable-__cxa_atexit"
  56. else
  57. var_append confopt ' ' "--disable-__cxa_atexit"
  58. fi
  59. # we might build a SVN or prereleases, disable checking
  60. var_append confopt ' ' '--disable-checking'
  61. # we build a cross compiler in stage0 and later use known good GCCs, no bstrap
  62. var_append confopt ' ' '--disable-bootstrap'
  63. # build version specific runtime libraries (default 0)
  64. # needed if multiple versions of gcc are installed
  65. [ "$SDECFG_PKG_GCC_VERSION_LIBS" = 1 ] && \
  66. var_append confopt " " "--enable-version-specific-runtime-libs"
  67. # build pre-compiled header (PCH) for libstdc++ (default 0)
  68. [ "$SDECFG_PKG_GCC_CXX_PCH" = 1 ] || \
  69. var_append confopt ' ' "--disable-libstdcxx-pch"
  70. # add the multi-lib config
  71. if [ "$SDECFG_MULTILIB" = 1 ]; then
  72. var_append confopt ' ' "--enable-multilib"
  73. if [ -n "$SDECFG_MULTILIBLIST" ]; then
  74. var_append confopt ' ' "--with-multilib-list=$SDECFG_MULTILIBLIST"
  75. fi
  76. else
  77. var_append confopt ' ' "--disable-multilib"
  78. fi
  79. if [ "${ver:0:3}" = "3.4" -o "${ver:0:1}" = "4" ]; then
  80. gcc_lib_dir="gcc/${arch_target}/${ver%%-*}"
  81. else
  82. gcc_lib_dir="gcc-lib/${arch_target}/${ver%%-*}"
  83. fi
  84. # available languages:
  85. # grep ^language= gcc/*/config-lang.in | cut -d\" -f2 | sort | tr '\n' ' '
  86. # ada c++ fortran java obj-c++ objc treelang
  87. # only C and C++ by default, and on every stage
  88. languages="c,c++"
  89. if atstage toolchain; then
  90. bindir="/$prefix/crosscc"
  91. var_append confopt " " "--with-sysroot=$sysroot"
  92. var_append confopt " " "--program-prefix=${arch_target}-"
  93. var_append confopt " " "--disable-cpp"
  94. var_append confopt " " "--disable-shared"
  95. var_append confopt " " "--disable-libssp"
  96. fi
  97. if ! atstage native; then
  98. var_append confopt " " "--disable-libmudflap"
  99. else
  100. var_append confopt " " "--with-gnu-as"
  101. var_append confopt " " "--with-gnu-ld"
  102. var_append confopt " " "--enable-threads=posix"
  103. if [ "$SDECFG_PKG_GCC_JAVA" != 1 ] ; then
  104. var_append confopt " " "--disable-libgcj"
  105. else
  106. var_append confopt ' ' "--enable-libgcj"
  107. var_append languages ',' 'java'
  108. if pkginstalled fastjar; then
  109. var_append confopt ' ' "--disable-fastjar"
  110. fi
  111. fi
  112. if [ "$SDECFG_PKG_GCC_OBJC" != 0 ] ; then
  113. var_append languages ',' 'objc'
  114. fi
  115. if [ "$SDECFG_PKG_GCC_F77" != 1 ] ; then
  116. var_append confopt " " "--disable-libgfortran"
  117. elif pkginstalled -f mpfr; then
  118. var_append languages ',' 'fortran'
  119. else
  120. echo_warning 'Fortran Compiler disabled, mpfr not found.'
  121. var_append confopt " " "--disable-libgfortran"
  122. fi
  123. # Set enable-shared
  124. if [ "$diet_dynamic_static" == "static" ] ; then
  125. var_append confopt " " "--disable-shared"
  126. else
  127. var_append confopt " " "--enable-shared"
  128. fi
  129. fi
  130. var_append confopt " " "--enable-languages=$languages"
  131. gcc_premake() {
  132. # create and set up the xgcc cmd_wrapper
  133. setup_xgcc_wrapper
  134. if [ $arch = powerpc ] ; then
  135. ln -s ppc-nocross-linux-gnu powerpc-nocross-linux-gnu
  136. fi
  137. if atstage toolchain; then
  138. mkdir -p $root/$prefix/$arch_target/{bin,lib}
  139. rm -f $root/$prefix/$arch_target/include
  140. if [ -f $root/$prefix/include/stdio.h ]; then
  141. ln -s ../include $root/$prefix/$arch_target/include
  142. elif [ -f $root/$prefix/diet-include/stdio.h ]; then
  143. ln -s ../diet-include $root/$prefix/$arch_target/include
  144. fi
  145. fi
  146. }
  147. gcc_postmake()
  148. {
  149. # force a tools rebuild
  150. rm -fv $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/.lastupdate
  151. # only minimal adaptions for stage0
  152. if atstage toolchain; then
  153. ${arch_target}-ranlib \
  154. $root/$libdir/${gcc_lib_dir}/libgcc.a
  155. for x in gcc-${ver:0:1} kcc{,-${ver:0:1}} cc; do
  156. ln -svf ${arch_target}-gcc \
  157. $root/$prefix/crosscc/${arch_target}-$x
  158. done
  159. ln -svf ${arch_target}-gcc $root/$prefix/crosscc/${arch_target}-cc
  160. rm -vf "$root/$prefix/crosscc/{gcc,gcj}"
  161. return
  162. fi
  163. if atstage cross; then
  164. # This stuff needs manual installation
  165. #
  166. echo "Creating /$prefix/${arch_target} ..."
  167. mkdir -p $root/$prefix/${arch_target}/lib
  168. # FIXME! temporal hack to install libgcc_s (Ticket #100)
  169. if [ "$SDECFG_MULTILIB" = 1 -a "$SDECFG_SPARC64_32BIT" != 1 ]; then
  170. rm -rf $root$libdir/libgcc_s*
  171. pushd $builddir/gcc-*/objdir/gcc/
  172. for x in libgcc_s*.so ; do
  173. cp -v $x $root$libdir/$x.1
  174. ln -sfv $x.1 $root$libdir/$x
  175. done
  176. popd
  177. fi
  178. else
  179. # Fix the location of any improperly installed (F77) libraries
  180. mv -vf $root/$libdir/$gcc_lib_dir/../lib* \
  181. $root/$libdir/$gcc_lib_dir || true
  182. fi
  183. # Create various symlinks for cc, c++, cpp and f77.
  184. #
  185. rm -f $root/$prefix/bin/cc
  186. ln -sfv gcc $root/$prefix/bin/cc
  187. ln -sfv ../$prefix/bin/cpp $root/lib/cpp
  188. ln -sfv gcc $root/$prefix/bin/kcc-${ver:0:1}
  189. ln -sfv gcc $root/$prefix/bin/kcc
  190. if [ -f $root/$prefix/bin/gfortran ] ; then
  191. rm -fv $root/$prefix/bin/f77
  192. ln -sfv gfortran $root/$prefix/bin/f77
  193. fi
  194. # Create symlinks for runtime libraries so they can be found by
  195. # the dynamic loader and force rebuilding of the wrapper links
  196. #
  197. if atstage native; then
  198. ( cd $root/$libdir ; ln -sfv ${gcc_lib_dir}/*.so.* . )
  199. # multilib w/ 32bit - we do just check for the output dir ...
  200. [ -e $root/$libdir/${gcc_lib_dir}/32 ] && (
  201. cd $root/$libdir/../lib/
  202. ln -sfv ../lib64/${gcc_lib_dir}/32/*.so.* .
  203. )
  204. fi
  205. true
  206. }
  207. # Apply the respective gcc-2 or gcc-3 stack protector patch.
  208. hook_add prepatch 3 ". $base/package/*/gcc/apply-protector.sh"
  209. hook_add premake 5 "gcc_premake"
  210. hook_add postmake 5 "gcc_postmake"