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.
 
 
 
 
 
 

375 lines
11 KiB

# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/gcc3/gcc3.conf
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
# This configuration file is used for building any gcc package,
# 'gcc2', 'gcc3', 'gccx' and other versions / variants present in the
# ROCK Linux repositories.
#
# package/base/gcc2/gcc2.conf simply includes this file.
create_links() {
for x ; do
if [ -f "$root/$prefix/bin/$x-${pkg#gcc}" ] ; then
rm -vf $root/$prefix/bin/$x
ln -vs $x-${pkg#gcc} $root/$prefix/bin/$x
fi
x="${arch_target}-$x"
if [ -f $root/$prefix/bin/$x-${pkg#gcc} ] ; then
rm -vf $root/$prefix/bin/$x
ln -vs $x-${pkg#gcc} $root/$prefix/bin/$x
fi
done
}
custmain() {
# Apply the respective gcc-2 or gcc-3 stack protector patch.
. $base/package/base/gcc3/apply-protector.sh $base $pkg "$desc_D"
hook_eval preconf
# In stage 1 we only build a normal c compiler (no c++, etc)
#
if [ $stagelevel -le 1 ] ; then
echo 'Setting LANGUAGES="c" in Makefile.in.'
sed -i -e 's/LANGUAGES="[^"]*"/LANGUAGES="c"/g' \
Makefile.in
elif [ "$ROCKCFG_DEBUG" = 1 ] ; then
if [ -f libstdc++*/configure ] ; then
echo "Setting DEBUG_FLAGS='-s' in libstdc++ configure."
( cd libstdc++*
sed -i -e "s/DEBUG_FLAGS='-g'/DEBUG_FLAGS='-s'/g" \
configure )
fi
MAKE="$MAKE LIBGCC2_DEBUG_CFLAGS=-s LDFLAGS=-Wl,-s JCFLAGS=-s"
fi
# GCC rebuilds itself using the xgcc which is build first. xgcc
# should also use the cc-wrapper. It might be better to patch big
# ammounts of the gcc sources - but this should also do the job.
#
export CFLAGS="$(exec -a echo bash \
-c ". gcc-${pkg#gcc}" 2> /dev/null)"
export CXXFLAGS="$(exec -a echo bash \
-c ". g++-${pkg#gcc}" 2> /dev/null)"
#
echo "Setting \$CFLAGS to '$CFLAGS'."
echo "Setting \$CXXFLAGS to '$CXXFLAGS'."
mkdir objdir ; cd objdir
# We install binaries, info-files and man-pages in temporary
# directories so we can rename it (adding version suffix) before
# moving them to their final directories.
#
makeinstopt=""
for x in bin info man ; do
mkdir -p $builddir/inst_$x
makeinstopt="$makeinstopt ${x}dir=$builddir/inst_$x"
done
# NAMING VARIANT!? INTRODUCED IN GCC-3.2.1
if [ $arch = powerpc ] ; then
ln -s ppc-nocross-linux-gnu powerpc-nocross-linux-gnu
fi
# add the multi-lib config
if [ "$ROCKCFG_MULTILIB" = 1 ] ; then
confopt="$confopt --enable-multilib"
else
confopt="$confopt --disable-multilib"
fi
# In stage 1 everything is a little bit more complicated
#
if [ $stagelevel -le 1 ] ; then
create_config_cache > config.cache
eval $configprefix ../configure $confopt --enable-languages=c
# creating native libiberty for build system
# (needed to build helper apps like gengenrtl)
#
mkdir -p $arch_build ; cd $arch_build
CC=$BUILDCC ../../configure
make all-libiberty ; cd ..
MAKE="$MAKE LANGUAGES=c"
# GCC thinks it can share object files between build and
# target if the CPUs are compatible, which isn't true if we
# are cross-building from glibc to dietlibc. So we also build
# helper programs with dietlibc if this is not a cross build
# between cpu architectures.
#
if ! [ "$pkg_dietlibc_useit" = 1 -a "$ROCKCFG_CROSSBUILD" = 0 ]
then
MAKE="$MAKE CC_FOR_BUILD='$BUILDCC'"
fi
# Fixincludes doesn't run when cross-building, but we
# need a syslimits.h for a working gcc
#
mkdir -p gcc/include
echo '#include_next <limits.h>' > gcc/include/syslimits.h
hook_eval premake
# Build and install
#
eval $MAKE prefix=/$prefix libdir=/$prefix/lib
hook_eval inmake
eval $MAKE prefix=$root/$prefix $makeinstopt install
# This stuff needs manual installation
#
echo "Creating /$prefix/${arch_target} ..."
mkdir -p $root/$prefix/${arch_target}/lib
cd $root/$prefix/${arch_target}/lib
for x in Mcrt1.o crti.o gcrt1.o crt1.o crtn.o
do ln -sf ../../lib/$x . ; done
if [ -f ../../../lib/ld-linux-$arch_machine.so.2 ] ; then
ln -sf ../../../lib/ld-linux-$arch_machine.so.2 .
elif [ -f ../../../lib/ld-linux.so.2 ] ; then
ln -sf ../../../lib/ld-linux.so.2 .
fi
else
if [ $pkg = gcc2 -a "$ROCKCFG_PKG_GCC2_NO_CHILL" = 1 ] ; then
# gcc-2.x contains no java compiler
confopt="$confopt --enable-languages=c,c++,objc,f77"
elif [ "$ROCKCFG_DIETLIBC_ALL" = 1 -o "$ROCKCFG_DIETLIBC_gcc3" = 1 ] ; then
# FIXME: c++ and java are not working with dietlibc
confopt="$confopt --enable-languages=c,objc"
elif [ $pkg = gcc3 -a "$ROCKCFG_PKG_GCC3_NO_JAVA" = 1 ] || \
[ $pkg = gcc33 -a "$ROCKCFG_PKG_GCC33_NO_JAVA" = 1 ] || \
[ $pkg = gccx -a "$ROCKCFG_PKG_GCCX_NO_JAVA" = 1 ] ; then
# gcc-3.x contains no chill compiler
confopt="$confopt --enable-languages=c,c++,objc,f77"
elif [ "$arch" = mips ] ; then
# FIXME: MIPS doesn't like the Java compiler
confopt="$confopt --disable-libgcj"
fi
# See http://gcc.gnu.org/gcc-3.2/c++-abi.html
# and http://www.codesourcery.com/cxx-abi/.
if [ $pkg != gcc2 ] ; then
confopt="$confopt --enable-__cxa_atexit"
fi
# Set enable-shared
if [ "$diet_dynamic_static" == "static" ] ; then
confopt="$confopt --enable-shared=no"
else
confopt="$confopt --enable-shared=yes"
fi
# Configure, build and install as usual
#
eval $configprefix ../configure $confopt --with-gnu-as \
--enable-version-specific-runtime-libs \
--with-gnu-ld --enable-threads=posix
hook_eval premake
eval "$MAKE GCJFLAGS=\"$CXXFLAGS\" all"
hook_eval inmake
eval "$MAKE $makeinstopt install"
# Fix the location of any improperly installed (F77) libraries
mv -vf $root/$prefix/lib/$gcc_lib_dir/../lib* \
$root/$prefix/lib/$gcc_lib_dir || true
fi
hook_eval postmake
# Rename and install binaries
#
cd $builddir/inst_bin ; mkdir -p $root/$prefix/bin
for y in c++ c++filt g++ cpp f77 g77 gcc gcov ; do
for x in $y ${arch_target}-$y ; do
if [ -f "$x" ] ; then
mv -v $x $root/$prefix/bin/${x}-${pkg#gcc}
fi
done
done
# gcc2 does not contain an own c++filt ... - so use the binutils one
#
if [ "$pkg" = gcc2 ] ; then
ln -vsf $root/$prefix/bin/c++filt-2 c++filt-binutils
fi
# Rename and install info-files
#
cd $builddir/inst_info ; mkdir -p $root/$prefix/info
for x in * ; do
[ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
fn=$( echo $x | sed "s,\([a-z0-9]*\),\1-${pkg#gcc}," )
infoname=$( echo $x | sed "s,\([a-z0-9]*\).*,\1," )
echo "$x -> $root/$prefix/info/$fn"
sed "s,$infoname.info,$infoname-${pkg#gcc}.info," < $x \
> $root/$prefix/info/$fn
if [ $ROCKCFG_DEFAULT_CC = $pkg ] ; then
cp -v $x $root/$prefix/info/$x
fi
true
done
# Rename and install man-pages
#
cd $builddir/inst_man/man1
mkdir -p $root/$prefix/man/man1
for x in * ; do
[ ! -f $x ] && continue # e.g. if $x becomes '*' somehow
mv -v $x $root/$prefix/man/man1/${x%.1}-${pkg#gcc}.1
if [ $ROCKCFG_DEFAULT_CC = $pkg ] ; then
ln -sf ${x%.1}-${pkg#gcc}.1 $root/$prefix/man/man1/$x
fi
true
done
hook_eval postdoc
# Create various symlinks for cc, c++, cpp and f77.
#
if [ $ROCKCFG_DEFAULT_CC = $pkg ] ; then
create_links gcc cpp gcov
rm -f $root/$prefix/bin/cc
if [ "$ROCKCFG_DIETLIBC_ALL" = 1 ]; then
cat <<- 'EOT' > $root/$prefix/bin/cc
#!/bin/sh
exec diet gcc "$@"
EOT
chmod +x $root/$prefix/bin/cc
else
ln -svf gcc $root/$prefix/bin/cc
fi
ln -vsf ../$prefix/bin/cpp $root/lib/cpp
fi
ln -sf gcc-${pkg#gcc} $root/$prefix/bin/kcc-${pkg#gcc}
if [ $ROCKCFG_DEFAULT_KCC = $pkg ] ; then
ln -vsf gcc-${pkg#gcc} $root/$prefix/bin/kcc
fi
if [ $ROCKCFG_DEFAULT_CXX = $pkg ] ; then
create_links c++ c++filt g++
fi
if [ $ROCKCFG_DEFAULT_F77 = $pkg ] ; then
create_links g77
if [ -f $root/$prefix/bin/g77 ] ; then
rm -vf $root/$prefix/bin/f77
ln -vsf g77 $root/$prefix/bin/f77
fi
fi
# Create symlinks for runtime libraries so they can be found by
# the dynamic loader and force rebuilding of the wrapper links
#
if [ $stagelevel -gt 1 ] ; then
( cd $root/$prefix/lib ; ln -vfs ${gcc_lib_dir}/*.so.* . ; )
rm -fv $base/build/$ROCKCFG_ID/ROCK/$toolsdir/.lastupdate
fi
true
}
gcc_stage0() {
# Apply the respective gcc-2 or gcc-3 stack protector patch.
. $base/package/base/gcc3/apply-protector.sh $base $pkg "$desc_D"
mkdir -p $root/$prefix/$arch_target/{bin,lib}
rm -f $root/$prefix/$arch_target/include
if [ -f $root/$prefix/include/stdio.h ]; then
ln -s ../include $root/$prefix/$arch_target/include
elif [ -f $root/$prefix/diet-include/stdio.h ]; then
ln -s ../diet-include $root/$prefix/$arch_target/include
fi
mkdir objdir ; cd objdir
bindir="$root/$prefix/crosscc"; mkdir -p $root/$prefix/crosscc
[ "$pkg" != "gcc2" ] && \
confopt="$confopt --enable-languages=c"
hook_eval preconf
eval ../configure --program-prefix=${arch_target}- --disable-cpp \
--disable-shared --disable-multilib $confopt
make -C libiberty
if [ -d texinfo ] ; then make -C texinfo ; fi
hook_eval premake
if [ "$pkg" = "gcc2" ] ; then
make -C gcc all LANGUAGES="c"
hook_eval inmake
make -C gcc install LANGUAGES="c"
else
# workaround for at least gcc-3.2.3
mkdir -p $root/$prefix/lib/${gcc_lib_dir}
make -C gcc all
hook_eval inmake
make -C gcc install
fi
hook_eval postmake
${arch_target}-ranlib \
$root/$prefix/lib/${gcc_lib_dir}/libgcc.a
x="$root/$prefix/crosscc/${arch_target}"
ln -svf ${arch_target}-gcc $x-gcc-${pkg#gcc}
ln -svf ${arch_target}-gcc $x-kcc-${pkg#gcc}
ln -svf ${arch_target}-gcc $x-kcc
ln -svf ${arch_target}-gcc $x-cc
rm -vf "$root/$prefix/crosscc/gcc"
rm -vf "$root/$prefix/crosscc/gcj"
cd $root/$prefix/$arch_target/lib
for x in Mcrt1.o crt1.o crti.o crtn.o gcrt1.o \
libc.a libc.so libc_nonshared.a
do ln -fvs $root/../../usr/lib/$x $x ; done
for x in ld-linux{,-$arch_machine}.so.2 ld.so.1 libc.so.{6,6.1}
do ln -fvs $root/../../lib/$x $x ; done
echo "Adapting gcc specs file..."
cd $root/$prefix/lib/${gcc_lib_dir}
mv specs specs.orig
# Hint for the reader:
# The options are listed in _inverse_ order here.
x="$base/build/$ROCKCFG_ID"
tr '\n' '@' < specs.orig | sed \
-e "s|@\\*link:@|@*link:@-L $x/../tools.cross/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/local/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/lib |" \
-e "s|@\\*link:@|@*link:@-rpath-link $x/lib |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
| tr '@' '\n' > specs
rm -f $root/$prefix/.lastupdate
}
if [ "$stagelevel" -eq 0 ]; then
custmain="gcc_stage0"
else
custmain="custmain"
fi
gcc_lib_dir="gcc-lib/${arch_target}/${ver%%-*}"