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.

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