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.

513 lines
16 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/gcc.conf
  9. # ROCK Linux is Copyright (C) 1998 - 2004 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. pkg_gcc_version=${xpkg#gcc}
  23. pkg_gcc_target=${arch_target}
  24. pkg_gcc_cross=""
  25. case "$xpkg" in
  26. gcc?-cross-*|gcc??-cross-*)
  27. pkg_gcc_cross="${xpkg#gcc*-cross-}"
  28. pkg_gcc_version=${pkg_gcc_version%-cross-*}
  29. pkg_gcc_target="${pkg_gcc_cross}-unknown-linux-gnu"
  30. var_append confopt " " "--target=$pkg_gcc_target"
  31. echo_status "Preparing to build a cross-gcc package for $pkg_gcc_cross."
  32. var_append INSTALL_WRAPPER_FILTER "|" 'sed -r "\,/share/(info|locale)/, d"'
  33. ;;
  34. gcc?|gcc??)
  35. ;;
  36. *)
  37. echo_error "Not supported $pkg package name: $xpkg"
  38. exit 1
  39. ;;
  40. esac
  41. patchfiles="`ls $confdir/gcc$pkg_gcc_version/*.patch \
  42. $confdir/gcc$pkg_gcc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
  43. create_links() {
  44. for x ; do
  45. if [ -f "$root/$prefix/bin/$x-${pkg_gcc_version}" ] ; then
  46. rm -vf $root/$prefix/bin/$x
  47. ln -vs $x-${pkg_gcc_version} $root/$prefix/bin/$x
  48. fi
  49. x="${pkg_gcc_target}-$x"
  50. if [ -f $root/$prefix/bin/$x-${pkg_gcc_version} ] ; then
  51. rm -vf $root/$prefix/bin/$x
  52. ln -vs $x-${pkg_gcc_version} $root/$prefix/bin/$x
  53. fi
  54. done
  55. }
  56. genrockspecs() {
  57. # Hint for the reader:
  58. # The options are listed in _inverse_ order here.
  59. x="$base/build/$ROCKCFG_ID"
  60. tr '\n' '@' < specs | sed \
  61. -e "s|@\\*link:@|@*link:@-L $x/usr/$arch_target/lib |" \
  62. -e "s|@\\*link:@|@*link:@-L $x/usr/local/lib |" \
  63. -e "s|@\\*link:@|@*link:@-L $x/usr/lib |" \
  64. -e "s|@\\*link:@|@*link:@-L $x/lib |" \
  65. -e "s|@\\*link:@|@*link:@-L $x/ROCK/tools.cross/$arch_target/lib |" \
  66. -e "s|@\\*link:@|@*link:@-rpath-link $x/lib:$x/usr/lib |" \
  67. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
  68. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
  69. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
  70. | tr '@' '\n' > specs.cross
  71. tr '\n' '@' < specs | sed \
  72. -e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /ROCK/tools.cross/$arch_target/lib |" \
  73. -e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/$arch_target/lib |" \
  74. -e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/local/lib |" \
  75. -e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/lib |" \
  76. -e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /lib |" \
  77. -e "s|@\\*link:@|@*link:@-rpath-link /lib:/usr/lib |" \
  78. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
  79. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
  80. -e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
  81. | tr '@' '\n' > specs.chroot
  82. }
  83. custmain() {
  84. # Apply the respective gcc-2 or gcc-3 stack protector patch.
  85. . $base/package/base/gcc/apply-protector.sh $base gcc${pkg_gcc_version} "$desc_D"
  86. hook_eval preconf
  87. # In stage 1 we only build a normal c compiler (no c++, etc)
  88. #
  89. if [ $stagelevel -le 1 ] ; then
  90. echo 'Setting LANGUAGES="c" in Makefile.in.'
  91. sed -i -e 's/LANGUAGES="[^"]*"/LANGUAGES="c"/g' \
  92. Makefile.in
  93. elif [ "$ROCKCFG_DEBUG" = 1 ] ; then
  94. if [ -f libstdc++*/configure ] ; then
  95. echo "Setting DEBUG_FLAGS='-s' in libstdc++ configure."
  96. sed -i -e "s/DEBUG_FLAGS='-g'/DEBUG_FLAGS='-s'/g" libstdc++*/configure
  97. fi
  98. MAKE="$MAKE LIBGCC2_DEBUG_CFLAGS=-s LDFLAGS=-Wl,-s JCFLAGS=-s"
  99. fi
  100. # GCC rebuilds itself using the xgcc which is build first. xgcc
  101. # should also use the cc-wrapper. It might be better to patch big
  102. # ammounts of the gcc sources - but this should also do the job.
  103. #
  104. export CFLAGS="$(exec -a echo bash \
  105. -c ". gcc-${pkg_gcc_version}" 2> /dev/null)"
  106. export CXXFLAGS="$(exec -a echo bash \
  107. -c ". g++-${pkg_gcc_version}" 2> /dev/null)"
  108. #
  109. echo "Setting \$CFLAGS to '$CFLAGS'."
  110. echo "Setting \$CXXFLAGS to '$CXXFLAGS'."
  111. mkdir objdir ; cd objdir
  112. # We install binaries, info-files and man-pages in temporary
  113. # directories so we can rename it (adding version suffix) before
  114. # moving them to their final directories.
  115. #
  116. makeinstopt=""
  117. for x in bin info man ; do
  118. mkdir -p $builddir/inst_$x
  119. makeinstopt="$makeinstopt ${x}dir=$builddir/inst_$x"
  120. done
  121. # NAMING VARIANT!? INTRODUCED IN GCC-3.2.1
  122. if [ $arch = powerpc ] ; then
  123. ln -s ppc-nocross-linux-gnu powerpc-nocross-linux-gnu
  124. fi
  125. # add the multi-lib config
  126. if [ "$ROCKCFG_MULTILIB" = 1 ] ; then
  127. confopt="$confopt --enable-multilib"
  128. else
  129. confopt="$confopt --disable-multilib"
  130. fi
  131. # do not install gc headers
  132. sed -i 's, install-includeHEADERS,,;' ../boehm-gc/include/Makefile.in
  133. # In stage 1 everything is a little bit more complicated
  134. #
  135. if [ $stagelevel -le 1 ] ; then
  136. create_config_cache > config.cache
  137. eval $configprefix bash ../configure $confopt --enable-languages=c
  138. # creating native libiberty for build system
  139. # (needed to build helper apps like gengenrtl)
  140. #
  141. mkdir -p $arch_build ; cd $arch_build
  142. CC=$BUILDCC bash ../../configure
  143. make all-libiberty ; cd ..
  144. MAKE="$MAKE LANGUAGES=c"
  145. # GCC thinks it can share object files between build and
  146. # target if the CPUs are compatible, which isn't true if we
  147. # are cross-building from glibc to dietlibc. So we also build
  148. # helper programs with dietlibc if this is not a cross build
  149. # between cpu architectures.
  150. #
  151. if ! [ "$pkg_dietlibc_useit" = 1 -a "$ROCKCFG_CROSSBUILD" = 0 ]
  152. then
  153. MAKE="$MAKE CC_FOR_BUILD='$BUILDCC'"
  154. fi
  155. # Fixincludes doesn't run when cross-building, but we
  156. # need a syslimits.h for a working gcc
  157. #
  158. mkdir -p gcc/include
  159. echo '#include_next <limits.h>' > gcc/include/syslimits.h
  160. hook_eval premake
  161. # Build and install
  162. #
  163. eval $MAKE prefix=/$prefix libdir=/$prefix/lib
  164. hook_eval inmake
  165. eval $MAKE prefix=$root/$prefix $makeinstopt install
  166. # This stuff needs manual installation
  167. #
  168. echo "Creating /$prefix/${pkg_gcc_target} ..."
  169. mkdir -p $root/$prefix/${pkg_gcc_target}/lib
  170. cd $root/$prefix/${pkg_gcc_target}/lib
  171. for x in Mcrt1.o crti.o gcrt1.o crt1.o crtn.o
  172. do ln -sf ../../lib/$x . ; done
  173. if [ -f ../../../lib/ld-linux-$arch_machine.so.2 ] ; then
  174. ln -sf ../../../lib/ld-linux-$arch_machine.so.2 .
  175. elif [ -f ../../../lib/ld-linux.so.2 ] ; then
  176. ln -sf ../../../lib/ld-linux.so.2 .
  177. fi
  178. else
  179. if [ $xpkg = gcc2 -a "$ROCKCFG_PKG_GCC2_NO_CHILL" = 1 ] ; then
  180. # gcc-2.x contains no java compiler
  181. confopt="$confopt --enable-languages=c,c++,objc,f77"
  182. elif [ "$ROCKCFG_DIETLIBC_ALL" = 1 -o "$ROCKCFG_DIETLIBC_gcc3" = 1 ] ; then
  183. # FIXME: c++ and java are not working with dietlibc
  184. confopt="$confopt --enable-languages=c,objc"
  185. elif [ $xpkg = gcc32 -a "$ROCKCFG_PKG_GCC32_NO_JAVA" = 1 ] || \
  186. [ $xpkg = gcc33 -a "$ROCKCFG_PKG_GCC33_NO_JAVA" = 1 ] || \
  187. [ $xpkg = gcc34 -a "$ROCKCFG_PKG_GCC34_NO_JAVA" = 1 ]; then
  188. # gcc-3.x contains no chill compiler
  189. confopt="$confopt --enable-languages=c,c++,objc,f77"
  190. elif [ "$arch" = mips ] ; then
  191. # FIXME: MIPS doesn't like the Java compiler
  192. confopt="$confopt --disable-libgcj"
  193. fi
  194. # See http://gcc.gnu.org/gcc-3.2/c++-abi.html
  195. # and http://www.codesourcery.com/cxx-abi/.
  196. if [ $xpkg != gcc2 ] ; then
  197. confopt="$confopt --enable-__cxa_atexit"
  198. fi
  199. # Set enable-shared
  200. if [ "$diet_dynamic_static" == "static" ] ; then
  201. confopt="$confopt --enable-shared=no"
  202. else
  203. confopt="$confopt --enable-shared=yes"
  204. fi
  205. # Configure, build and install as usual
  206. #
  207. eval $configprefix bash ../configure $confopt --with-gnu-as \
  208. --enable-version-specific-runtime-libs \
  209. --with-gnu-ld --enable-threads=posix
  210. hook_eval premake
  211. if [ $xpkg = gcc34 -a "$ROCKCFG_PKG_GCC34_PROFILED" != 0 ]; then
  212. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" profiledbootstrap"
  213. else
  214. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" all"
  215. fi
  216. hook_eval inmake
  217. eval "$MAKE $makeinstopt install"
  218. # Fix the location of any improperly installed (F77) libraries
  219. mv -vf $root/$prefix/lib/$gcc_lib_dir/../lib* \
  220. $root/$prefix/lib/$gcc_lib_dir || true
  221. fi
  222. hook_eval postmake
  223. # Rename and install binaries
  224. #
  225. cd $builddir/inst_bin ; mkdir -p $root/$prefix/bin
  226. for y in c++ c++filt g++ cpp f77 g77 gcc gcov ; do
  227. for x in $y ${pkg_gcc_target}-$y ; do
  228. if [ -f "$x" ] ; then
  229. mv -v $x $root/$prefix/bin/${x}-${pkg_gcc_version}
  230. fi
  231. done
  232. done
  233. # gcc2 does not contain an own c++filt ... - so use the binutils one
  234. #
  235. if [ "$xpkg" = gcc2 ] ; then
  236. ln -vsf $root/$prefix/bin/c++filt-2 c++filt-binutils
  237. fi
  238. # Rename and install info-files
  239. #
  240. cd $builddir/inst_info ; mkdir -p $root/$prefix/info
  241. for x in * ; do
  242. [ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
  243. fn=$( echo $x | sed "s,\([a-z0-9]*\),\1-${pkg_gcc_version}," )
  244. infoname=$( echo $x | sed "s,\([a-z0-9]*\).*,\1," )
  245. echo "$x -> $root/$prefix/info/$fn"
  246. sed "s,$infoname.info,$infoname-${pkg_gcc_version}.info," < $x \
  247. > $root/$prefix/info/$fn
  248. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  249. cp -v $x $root/$prefix/info/$x
  250. fi
  251. true
  252. done
  253. # Rename and install man-pages
  254. #
  255. cd $builddir/inst_man/man1
  256. mkdir -p $root/$prefix/man/man1
  257. for x in * ; do
  258. [ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
  259. mv -v $x $root/$prefix/man/man1/${x%.1}-${pkg_gcc_version}.1
  260. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  261. ln -sf ${x%.1}-${pkg_gcc_version}.1 $root/$prefix/man/man1/$x
  262. fi
  263. true
  264. done
  265. hook_eval postdoc
  266. # Create various symlinks for cc, c++, cpp and f77.
  267. #
  268. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  269. create_links gcc cpp gcov
  270. rm -f $root/$prefix/bin/cc
  271. if [ "$ROCKCFG_DIETLIBC_ALL" = 1 ]; then
  272. cat <<- 'EOT' > $root/$prefix/bin/cc
  273. #!/bin/sh
  274. exec diet gcc "$@"
  275. EOT
  276. chmod +x $root/$prefix/bin/cc
  277. else
  278. ln -svf gcc $root/$prefix/bin/cc
  279. fi
  280. ln -vsf ../$prefix/bin/cpp $root/lib/cpp
  281. fi
  282. ln -sf gcc-${pkg_gcc_version} $root/$prefix/bin/kcc-${pkg_gcc_version}
  283. if [ $ROCKCFG_DEFAULT_KCC = $xpkg ] ; then
  284. ln -vsf gcc-${pkg_gcc_version} $root/$prefix/bin/kcc
  285. fi
  286. if [ $ROCKCFG_DEFAULT_CXX = $xpkg ] ; then
  287. create_links c++ c++filt g++
  288. fi
  289. if [ $ROCKCFG_DEFAULT_F77 = $xpkg ] ; then
  290. create_links g77
  291. if [ -f $root/$prefix/bin/g77 ] ; then
  292. rm -vf $root/$prefix/bin/f77
  293. ln -vsf g77 $root/$prefix/bin/f77
  294. fi
  295. fi
  296. # Inject our default optimisation options so when the user calls
  297. # gcc/g++ they match the ones used to precompile the headers ...
  298. # Save the options affectioning optimization only.
  299. #
  300. if [ $ROCKCFG_DEFAULT_CC = $xpkg ]; then
  301. echo "Creating /etc/profile.d/gcc ..."
  302. {
  303. echo "export CFLAGS_SIZE=\"$(echo $(
  304. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  305. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  306. tr ' ' '\n' | sed -e 's/^-SIZE-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  307. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  308. ))\""
  309. echo "export CFLAGS_SPEED=\"$(echo $(
  310. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  311. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  312. tr ' ' '\n' | sed -e 's/^-SPEED-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  313. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  314. ))\""
  315. echo "export CFLAGS=\"\$CFLAGS_SIZE\""
  316. } > $root/etc/profile.d/gcc
  317. fi
  318. if [ $ROCKCFG_DEFAULT_CXX = $xpkg ]; then
  319. echo "Creating /etc/profile.d/gxx ..."
  320. {
  321. echo "export CXXFLAGS_SIZE=\"$(echo $(
  322. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  323. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  324. tr ' ' '\n' | sed -e 's/^-SIZE-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  325. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  326. ))\""
  327. echo "export CXXFLAGS_SPEED=\"$(echo $(
  328. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  329. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  330. tr ' ' '\n' | sed -e 's/^-SPEED-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  331. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  332. ))\""
  333. echo "export CXXFLAGS=\"\$CFLAGS_SIZE\""
  334. } > $root/etc/profile.d/gxx
  335. fi
  336. # Create symlinks for runtime libraries so they can be found by
  337. # the dynamic loader and force rebuilding of the wrapper links
  338. #
  339. if [ $stagelevel -gt 1 ] ; then
  340. ( cd $root/$prefix/lib ; ln -vfs ${gcc_lib_dir}/*.so.* . ; )
  341. rm -fv $base/build/$ROCKCFG_ID/ROCK/$toolsdir/.lastupdate
  342. fi
  343. if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  344. echo "Adapting gcc specs file..."
  345. cd $root/$prefix/lib/${gcc_lib_dir}
  346. genrockspecs
  347. # echo "Linking gcc libs to tools.cross..."
  348. # cd $root/ROCK/tools.cross/lib/${gcc_lib_dir}/
  349. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.a .
  350. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.la .
  351. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so .
  352. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so.* .
  353. fi
  354. true
  355. }
  356. gcc_cross() {
  357. # Apply the respective gcc-2 or gcc-3 stack protector patch.
  358. . $base/package/base/gcc/apply-protector.sh $base gcc${pkg_gcc_version} "$desc_D"
  359. mkdir -p $root/$prefix/$pkg_gcc_target/{bin,lib}
  360. if [ "$stagelevel" -eq 0 ]
  361. then
  362. rm -f $root/$prefix/$pkg_gcc_target/include
  363. if [ -f $root/$prefix/include/stdio.h ]; then
  364. ln -s ../include $root/$prefix/$pkg_gcc_target/include
  365. elif [ -f $root/$prefix/diet-include/stdio.h ]; then
  366. ln -s ../diet-include $root/$prefix/$pkg_gcc_target/include
  367. fi
  368. bindir="$root/$prefix/crosscc"
  369. mkdir -p $root/$prefix/crosscc
  370. fi
  371. if [ "$pkg_gcc_version" != "2" ]; then
  372. if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  373. confopt="$confopt --enable-languages=c,c++"
  374. else
  375. confopt="$confopt --enable-languages=c"
  376. fi
  377. fi
  378. mkdir objdir ; cd objdir ; hook_eval preconf
  379. eval bash ../configure --program-prefix=${pkg_gcc_target}- --disable-cpp \
  380. --disable-shared --disable-multilib $confopt
  381. if [ -d libiberty ]; then make -C libiberty; fi
  382. if [ -d texinfo ]; then make -C texinfo; fi
  383. hook_eval premake
  384. if [ "$xpkg" = "gcc2" ] ; then
  385. make -C gcc all LANGUAGES="c"
  386. hook_eval inmake
  387. make -C gcc install LANGUAGES="c"
  388. else
  389. # workaround for at least gcc-3.2.3
  390. mkdir -p $root/$prefix/lib/${gcc_lib_dir}
  391. if [ -d gcc ]; then
  392. make -C gcc all
  393. hook_eval inmake
  394. make -C gcc install
  395. else
  396. make all-gcc
  397. hook_eval inmake
  398. make install-gcc
  399. fi
  400. fi
  401. hook_eval postmake
  402. if [ -f $root/$prefix/lib/${gcc_lib_dir}/libgcc.a ]; then
  403. ${pkg_gcc_target}-ranlib \
  404. $root/$prefix/lib/${gcc_lib_dir}/libgcc.a
  405. fi
  406. if [ "$stagelevel" -eq 0 ]; then
  407. x="$root/$prefix/crosscc/${arch_target}"
  408. ln -svf ${arch_target}-gcc $x-gcc-${pkg_gcc_version}
  409. ln -svf ${arch_target}-g++ $x-g++-${pkg_gcc_version}
  410. ln -svf ${arch_target}-gcc $x-kcc-${pkg_gcc_version}
  411. ln -svf ${arch_target}-gcc $x-kcc
  412. ln -svf ${arch_target}-gcc $x-cc
  413. rm -vf "$root/$prefix/crosscc/gcc"
  414. rm -vf "$root/$prefix/crosscc/gcj"
  415. cd $root/$prefix/$arch_target/lib
  416. for x in Mcrt1.o crt1.o crti.o crtn.o gcrt1.o \
  417. libc.a libc.so libc_nonshared.a
  418. do
  419. if [ ! -e $x ]; then
  420. ln -fvs $root/../../usr/lib/$x $x
  421. fi
  422. done
  423. for x in ld-linux{,-$arch_machine}.so.2 ld.so.1 libc.so.{6,6.1}
  424. do ln -fvs $root/../../lib/$x $x ; done
  425. # glibc uses -lgcc_s with --as-needed, which fails if libgcc_s.{so,a}
  426. # is not even there. -- clifford & fake
  427. #
  428. # the shared object is not really needed.
  429. #if [ ! -e $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.so ]; then
  430. # ${pkg_gcc_target}-gcc -shared -nostdlib \
  431. # -o $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.so -x c /dev/null
  432. #fi
  433. if [ ! -e $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.a ]; then
  434. ${pkg_gcc_target}-gcc -x c /dev/null -c -o null.o
  435. ${pkg_gcc_target}-ar q null.a null.o; rm -f null.o
  436. ${pkg_gcc_target}-ranlib null.a
  437. mv null.a $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.a
  438. fi
  439. rm -f $root/$prefix/.lastupdate
  440. fi
  441. if [ "$stagelevel" -eq 0 -o "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  442. echo "Adapting gcc specs file..."
  443. cd $root/$prefix/lib/${gcc_lib_dir}
  444. genrockspecs
  445. fi
  446. true
  447. }
  448. if [ "$stagelevel" -eq 0 -o -n "$pkg_gcc_cross" ]
  449. then
  450. custmain="gcc_cross"
  451. else
  452. custmain="custmain"
  453. fi
  454. gcc_lib_dir="gcc-lib/${pkg_gcc_target}/${ver%%-*}"
  455. [ $pkg_gcc_version = 34 ] && gcc_lib_dir="gcc/${pkg_gcc_target}/${ver%%-*}"