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.

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