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.

549 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 - 2005 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. confopt="$confopt --enable-languages=c,c++,objc,f77"
  191. elif [ $xpkg = gcc40 -a "$ROCKCFG_PKG_GCC40_NO_JAVA" != 0 ] || \
  192. [ $xpkg = gcc41 -a "$ROCKCFG_PKG_GCC41_NO_JAVA" != 0 ]; then
  193. confopt="$confopt --enable-languages=c,c++,objc,f95"
  194. elif [ "$arch" = mips ] ; then
  195. # FIXME: MIPS doesn't like the Java compiler
  196. confopt="$confopt --disable-libgcj"
  197. fi
  198. # See http://gcc.gnu.org/gcc-3.2/c++-abi.html
  199. # and http://www.codesourcery.com/cxx-abi/.
  200. if [ $xpkg != gcc2 ] ; then
  201. confopt="$confopt --enable-__cxa_atexit"
  202. fi
  203. # Set enable-shared
  204. if [ "$diet_dynamic_static" == "static" ] ; then
  205. confopt="$confopt --enable-shared=no"
  206. else
  207. confopt="$confopt --enable-shared=yes"
  208. fi
  209. # Configure, build and install as usual
  210. #
  211. eval $configprefix bash ../configure $confopt --with-gnu-as \
  212. --enable-version-specific-runtime-libs \
  213. --with-gnu-ld --enable-threads=posix
  214. hook_eval premake
  215. if [ $xpkg = gcc34 -a "$ROCKCFG_PKG_GCC34_PROFILED" != 0 ]; then
  216. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" profiledbootstrap"
  217. elif [ $xpkg = gcc40 -a "$ROCKCFG_PKG_GCC40_PROFILED" != 0 ]; then
  218. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" profiledbootstrap"
  219. elif [ $xpkg = gcc41 -a "$ROCKCFG_PKG_GCC41_PROFILED" != 0 ]; then
  220. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" profiledbootstrap"
  221. else
  222. eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" all"
  223. fi
  224. hook_eval inmake
  225. eval "$MAKE $makeinstopt install"
  226. # Fix the location of any improperly installed (F77) libraries
  227. mv -vf $root/$prefix/lib/$gcc_lib_dir/../lib* \
  228. $root/$prefix/lib/$gcc_lib_dir || true
  229. fi
  230. hook_eval postmake
  231. # Rename and install binaries
  232. #
  233. cd $builddir/inst_bin ; mkdir -p $root/$prefix/bin
  234. for y in c++ c++filt g++ cpp f77 g77 gcc gcov ; do
  235. for x in $y ${pkg_gcc_target}-$y ; do
  236. if [ -f "$x" ] ; then
  237. mv -v $x $root/$prefix/bin/${x}-${pkg_gcc_version}
  238. fi
  239. done
  240. done
  241. # gcc2 does not contain an own c++filt ... - so use the binutils one
  242. #
  243. if [ "$xpkg" = gcc2 ] ; then
  244. ln -vsf $root/$prefix/bin/c++filt-2 c++filt-binutils
  245. fi
  246. # Rename and install info-files
  247. #
  248. cd $builddir/inst_info ; mkdir -p $root/$prefix/info
  249. for x in * ; do
  250. [ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
  251. fn=$( echo $x | sed "s,\([a-z0-9]*\),\1-${pkg_gcc_version}," )
  252. infoname=$( echo $x | sed "s,\([a-z0-9]*\).*,\1," )
  253. echo "$x -> $root/$prefix/info/$fn"
  254. sed "s,$infoname.info,$infoname-${pkg_gcc_version}.info," < $x \
  255. > $root/$prefix/info/$fn
  256. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  257. cp -v $x $root/$prefix/info/$x
  258. fi
  259. true
  260. done
  261. # Rename and install man-pages
  262. #
  263. cd $builddir/inst_man/man1
  264. mkdir -p $root/$prefix/man/man1
  265. for x in * ; do
  266. [ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
  267. mv -v $x $root/$prefix/man/man1/${x%.1}-${pkg_gcc_version}.1
  268. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  269. ln -sf ${x%.1}-${pkg_gcc_version}.1 $root/$prefix/man/man1/$x
  270. fi
  271. true
  272. done
  273. # Rename and install locales
  274. #
  275. if [ -d "$builddir/inst_data/locale" ] ; then
  276. cd $builddir/inst_data/locale
  277. for x in */LC_MESSAGES/*.mo ; do
  278. [ ! -f "$x" ] && continue # e.g. if $x becomes '*' somehow
  279. y="$root/$prefix/share/locale/$x"
  280. y="${y%.mo}-${pkg_gcc_version}.mo"
  281. mkdir -p ${y%/*}
  282. echo "$x -> $y"
  283. mv $x $y
  284. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  285. echo "symlink $x -> $y"
  286. ln -svf ${y##*/} $root/$prefix/share/locale/$x
  287. fi
  288. true
  289. done
  290. fi
  291. hook_eval postdoc
  292. # Create various symlinks for cc, c++, cpp and f77.
  293. #
  294. if [ $ROCKCFG_DEFAULT_CC = $xpkg ] ; then
  295. create_links gcc cpp gcov
  296. rm -f $root/$prefix/bin/cc
  297. if [ "$ROCKCFG_DIETLIBC_ALL" = 1 ]; then
  298. cat <<- 'EOT' > $root/$prefix/bin/cc
  299. #!/bin/sh
  300. exec diet gcc "$@"
  301. EOT
  302. chmod +x $root/$prefix/bin/cc
  303. else
  304. ln -svf gcc $root/$prefix/bin/cc
  305. fi
  306. ln -vsf ../$prefix/bin/cpp $root/lib/cpp
  307. fi
  308. ln -sf gcc-${pkg_gcc_version} $root/$prefix/bin/kcc-${pkg_gcc_version}
  309. if [ $ROCKCFG_DEFAULT_KCC = $xpkg ] ; then
  310. ln -vsf gcc-${pkg_gcc_version} $root/$prefix/bin/kcc
  311. fi
  312. if [ $ROCKCFG_DEFAULT_CXX = $xpkg ] ; then
  313. create_links c++ c++filt g++
  314. fi
  315. if [ $ROCKCFG_DEFAULT_F77 = $xpkg ] ; then
  316. create_links g77
  317. if [ -f $root/$prefix/bin/g77 ] ; then
  318. rm -vf $root/$prefix/bin/f77
  319. ln -vsf g77 $root/$prefix/bin/f77
  320. fi
  321. fi
  322. # Inject our default optimisation options so when the user calls
  323. # gcc/g++ they match the ones used to precompile the headers ...
  324. # Save the options affectioning optimization only.
  325. #
  326. if [ $ROCKCFG_DEFAULT_CC = $xpkg ]; then
  327. echo "Creating /etc/profile.d/gcc ..."
  328. {
  329. echo "export CFLAGS_SIZE=\"$(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/^-SIZE-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  333. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  334. ))\""
  335. echo "export CFLAGS_SPEED=\"$(echo $(
  336. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  337. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  338. tr ' ' '\n' | sed -e 's/^-SPEED-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  339. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  340. ))\""
  341. echo "export CFLAGS=\"\$CFLAGS_SIZE\""
  342. } > $root/etc/profile.d/gcc
  343. fi
  344. if [ $ROCKCFG_DEFAULT_CXX = $xpkg ]; then
  345. echo "Creating /etc/profile.d/gxx ..."
  346. {
  347. echo "export CXXFLAGS_SIZE=\"$(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/^-SIZE-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  351. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  352. ))\""
  353. echo "export CXXFLAGS_SPEED=\"$(echo $(
  354. eval echo \$GCC_WRAPPER_INSERT \$GCC_WRAPPER_APPEND \
  355. \$GCC${ver:0:1}_WRAPPER_INSERT \$GCC${ver:0:1}_WRAPPER_APPEND | \
  356. tr ' ' '\n' | sed -e 's/^-SPEED-/-/' -e '/^-O/ { p; d; }' -e '/^-mcpu=/ { p; d; }' \
  357. -e '/-march=/ { p; d; }' -e '/-mtune=/ { p; d; }' -e 'd'
  358. ))\""
  359. echo "export CXXFLAGS=\"\$CFLAGS_SIZE\""
  360. } > $root/etc/profile.d/gxx
  361. fi
  362. # Create symlinks for runtime libraries so they can be found by
  363. # the dynamic loader and force rebuilding of the wrapper links
  364. #
  365. if [ $stagelevel -gt 1 ] ; then
  366. [ $ROCKCFG_DEFAULT_CC = $xpkg ] && \
  367. ( mkdir -p $root/$prefix/lib ; cd $root/$prefix/lib ; \
  368. ln -vfs ${gcc_lib_dir}/*.so.* . ; )
  369. rm -fv $base/build/$ROCKCFG_ID/ROCK/$toolsdir/.lastupdate
  370. fi
  371. if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  372. echo "Adapting gcc specs file..."
  373. cd $root/$prefix/lib/${gcc_lib_dir}
  374. genrockspecs
  375. # echo "Linking gcc libs to tools.cross..."
  376. # cd $root/ROCK/tools.cross/lib/${gcc_lib_dir}/
  377. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.a .
  378. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.la .
  379. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so .
  380. # ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so.* .
  381. fi
  382. true
  383. }
  384. gcc_cross() {
  385. # Apply the respective gcc-2 or gcc-3 stack protector patch.
  386. . $base/package/base/gcc/apply-protector.sh $base gcc${pkg_gcc_version} "$desc_D"
  387. mkdir -p $root/$prefix/$pkg_gcc_target/{bin,lib}
  388. if [ "$stagelevel" -eq 0 ]
  389. then
  390. rm -f $root/$prefix/$pkg_gcc_target/include
  391. if [ -f $root/$prefix/include/stdio.h ]; then
  392. ln -s ../include $root/$prefix/$pkg_gcc_target/include
  393. elif [ -f $root/$prefix/diet-include/stdio.h ]; then
  394. ln -s ../diet-include $root/$prefix/$pkg_gcc_target/include
  395. fi
  396. bindir="$root/$prefix/crosscc"
  397. mkdir -p $root/$prefix/crosscc
  398. fi
  399. if [ "$pkg_gcc_version" != "2" ]; then
  400. if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  401. confopt="$confopt --enable-languages=c,c++"
  402. else
  403. confopt="$confopt --enable-languages=c"
  404. fi
  405. fi
  406. mkdir objdir ; cd objdir ; hook_eval preconf
  407. eval bash ../configure --program-prefix=${pkg_gcc_target}- --disable-cpp \
  408. --disable-shared --disable-multilib $confopt
  409. if [ -d libiberty ]; then make -C libiberty; fi
  410. if [ -d texinfo ]; then make -C texinfo; fi
  411. hook_eval premake
  412. if [ "$xpkg" = "gcc2" ] ; then
  413. make -C gcc all LANGUAGES="c"
  414. hook_eval inmake
  415. make -C gcc install LANGUAGES="c"
  416. else
  417. # workaround for at least gcc-3.2.3
  418. mkdir -p $root/$prefix/lib/${gcc_lib_dir}
  419. if [ -d gcc ]; then
  420. make -C gcc all
  421. hook_eval inmake
  422. make -C gcc install
  423. else
  424. make all-gcc
  425. hook_eval inmake
  426. make install-gcc
  427. fi
  428. fi
  429. hook_eval postmake
  430. if [ -f $root/$prefix/lib/${gcc_lib_dir}/libgcc.a ]; then
  431. ${pkg_gcc_target}-ranlib \
  432. $root/$prefix/lib/${gcc_lib_dir}/libgcc.a
  433. fi
  434. if [ "$stagelevel" -eq 0 ]; then
  435. x="$root/$prefix/crosscc/${arch_target}"
  436. ln -svf ${arch_target}-gcc $x-gcc-${pkg_gcc_version}
  437. ln -svf ${arch_target}-g++ $x-g++-${pkg_gcc_version}
  438. ln -svf ${arch_target}-gcc $x-kcc-${pkg_gcc_version}
  439. ln -svf ${arch_target}-gcc $x-kcc
  440. ln -svf ${arch_target}-gcc $x-cc
  441. rm -vf "$root/$prefix/crosscc/gcc"
  442. rm -vf "$root/$prefix/crosscc/gcj"
  443. cd $root/$prefix/$arch_target/lib
  444. for x in Mcrt1.o crt1.o crti.o crtn.o gcrt1.o \
  445. libc.a libc.so libc_nonshared.a
  446. do
  447. if [ ! -e $x ]; then
  448. ln -fvs $root/../../usr/lib/$x $x
  449. fi
  450. done
  451. for x in ld-linux{,-$arch_machine}.so.2 ld.so.1 libc.so.{6,6.1}
  452. do ln -fvs $root/../../lib/$x $x ; done
  453. # glibc uses -lgcc_s with --as-needed, which fails if libgcc_s.{so,a}
  454. # is not even there. -- clifford & fake
  455. #
  456. # the shared object is not really needed.
  457. #if [ ! -e $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.so ]; then
  458. # ${pkg_gcc_target}-gcc -shared -nostdlib \
  459. # -o $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.so -x c /dev/null
  460. #fi
  461. if [ ! -e $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.a ]; then
  462. ${pkg_gcc_target}-gcc -x c /dev/null -c -o null.o
  463. ${pkg_gcc_target}-ar q null.a null.o; rm -f null.o
  464. ${pkg_gcc_target}-ranlib null.a
  465. mv null.a $root/$prefix/lib/${gcc_lib_dir}/libgcc_s.a
  466. fi
  467. rm -f $root/$prefix/.lastupdate
  468. fi
  469. if [ "$stagelevel" -eq 0 -o "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
  470. echo "Adapting gcc specs file..."
  471. cd $root/$prefix/lib/${gcc_lib_dir}
  472. genrockspecs
  473. fi
  474. true
  475. }
  476. if [ "$stagelevel" -eq 0 -o -n "$pkg_gcc_cross" ]
  477. then
  478. custmain="gcc_cross"
  479. else
  480. custmain="custmain"
  481. fi
  482. case "$pkg_gcc_version" in
  483. 34|4*)
  484. gcc_lib_dir="gcc/${pkg_gcc_target}/${ver%%-*}"
  485. ;;
  486. *)
  487. gcc_lib_dir="gcc-lib/${pkg_gcc_target}/${ver%%-*}"
  488. ;;
  489. esac