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.

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