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.

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