summaryrefslogtreecommitdiffstats
path: root/gnu/FUNCTIONS
diff options
context:
space:
mode:
authorFlorian Franzmann2010-03-19 10:29:51 +0100
committerFlorian Franzmann2010-03-19 10:29:51 +0100
commitbbaaca54c1957e86abfddedd8df4b5410f9e6e2e (patch)
treee286189146e910913375ff74e143b0049f39422e /gnu/FUNCTIONS
parent4d56a8b19c55ed552b8d7cc02916de30ee591fa2 (diff)
gnu/FUNCTIONS: added functions to avoid code duplication in gnu spells
Diffstat (limited to 'gnu/FUNCTIONS')
-rwxr-xr-xgnu/FUNCTIONS106
1 files changed, 106 insertions, 0 deletions
diff --git a/gnu/FUNCTIONS b/gnu/FUNCTIONS
index c78b411a49..eb720d1f43 100755
--- a/gnu/FUNCTIONS
+++ b/gnu/FUNCTIONS
@@ -18,3 +18,109 @@ function default_configure_gcc ()
'--disable-multilib'
fi
}
+
+function default_build_configure_gcc ()
+{
+ cd ${SOURCE_DIRECTORY}.bld &&
+ persistent_read gmp GMP_BUILD_ARCH GMP_BUILD_ARCH &&
+ persistent_read mpfr MPFR_BUILD_ARCH MPFR_BUILD_ARCH &&
+
+ if [[ $GMP_BUILD_ARCH != ${SMGL_COMPAT_ARCHS[4]}
+ || $MPFR_BUILD_ARCH != ${SMGL_COMPAT_ARCHS[4]} ]]; then
+ message "${PROBLEM_COLOR}" 1>&2 &&
+ message "gmp and/or mpfr have been built with a different archspec, building gcc now" 1>&2 &&
+ message "would result in a broken compiler" 1>&2 &&
+ message "${DEFAULT_COLOR}" 1>&2
+ return 1
+ fi &&
+
+ # install gcc libraries to /lib instead of /lib64
+ sedit "s/lib64/lib/" ${SOURCE_DIRECTORY}/gcc/config/i386/linux64.h &&
+ if [[ "$GCC_NOLIB64" == 'y' ]]; then
+ # tell gcc to target binaries to expect the linker in /lib instead of /lib64
+ sedit "s/lib64/lib/" ${SOURCE_DIRECTORY}gcc/config/i386/t-linux64 || return 1
+ fi &&
+
+ if [[ "$ARCHITECTURE" == "pentium4" ||
+ "$ARCHITECTURE" == "pentium-m" ]]; then
+ CFLAGS=${CFLAGS//-ffast-math/} &&
+ CXXFLAGS=${CXXFLAGS//-ffast-math/} || return 1
+ fi &&
+
+ # fixes seg-fault on libiberty/splay.c in v 4.3.2
+ CFLAGS="-O1 $CFLAGS" &&
+
+ if [[ $CROSS_INSTALL == on ]]; then
+ OPTS="--host=$HOST $OPTS" || return 1
+ else
+ OPTS="--build=$HOST $OPTS" || return 1
+ fi &&
+
+ $SOURCE_DIRECTORY/configure \
+ --prefix="${INSTALL_ROOT}/usr" \
+ --infodir="${INSTALL_ROOT}/usr/share/info" \
+ --mandir="${INSTALL_ROOT}/usr/share/man" \
+ --enable-threads=posix \
+ --with-system-zlib \
+ $GCC_MULTILIB \
+ $OPTS
+}
+
+function default_build_make_gcc ()
+{
+ cd ${SOURCE_DIRECTORY}.bld &&
+#make_single &&
+ make CFLAGS="$CFLAGS" BOOT_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+ profiledbootstrap-lean
+#make_normal
+}
+
+function default_build_gcc ()
+{
+ default_build_configure_gcc &&
+ default_build_make_gcc
+}
+
+function default_install_gcc ()
+{
+ local COMPILER1 &&
+ local LIBRARY &&
+ local SPECSNAME &&
+ SPECSNAME=$SPELL
+
+ if [[ "$SPELL" == "ada" ]]; then
+ COMPILER1=gnat1
+ LIBRARY=libada
+ elif [[ "$SPELL" == "fortran" ]]; then
+ COMPILER1=f951
+ LIBRARY=libgfortran
+ elif [[ "$SPELL" == "g++" ]]; then
+ COMPILER1=cc1plus
+ LIBRARY=libstdc++-v3
+ elif [[ "$SPELL" == "gcj" ]]; then
+ COMPILER1={jc1,jvgenmain}
+ LIBRARY=libjava
+ elif [[ "$SPELL" == "objc" ]]; then
+ COMPILER1=cc1obj
+ LIBRARY=libobjc
+ else
+ message "default_install_gcc: unknown spell $SPELL"
+ return 1
+ fi &&
+
+ cd $SOURCE_DIRECTORY.bld &&
+
+ make_single &&
+
+ make -C gcc lang.install-common lang.install-man &&
+ install gcc/${COMPILER1} ${INSTALL_ROOT}/usr/libexec/gcc/$HOST/$VERSION &&
+ make -C $HOST/$LIBRARY install &&
+
+ make_normal &&
+
+ # specs file stuff
+ local SPECSDIR=${INSTALL_ROOT}/usr/lib/gcc/$HOST/$VERSION &&
+ if [[ -f $SPELL_DIRECTORY/specs_$SPECSNAME ]]; then
+ install $SPELL_DIRECTORY/specs_$SPECSNAME $SPECSDIR/specs-local || return 1
+ fi
+}