Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
build.sh: Print error log on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
mbitsnbites committed Nov 27, 2021
1 parent 91e5461 commit c937dec
Showing 1 changed file with 49 additions and 16 deletions.
65 changes: 49 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

err_report() {
echo "*** Failed to build: Stopped on line $1"
if [ -n "${LATEST_LOG}" ] ; then
echo ""
echo "Latest log:"
cat "${LATEST_LOG}"
fi
}
trap 'err_report $LINENO' ERR
set -e
Expand Down Expand Up @@ -160,17 +165,24 @@ if [ "$BUILD_BINUTILS" == "yes" ] ; then
rm -rf out/binutils
fi
mkdir -p out/binutils
echo " Building..."

echo " Configuring..."
cd out/binutils
LATEST_LOG=${PWD}/configure.log
../../ext/binutils-mrisc32/configure \
--prefix="$PREFIX" \
--target="$TARGET" \
--disable-gdb \
--disable-sim \
> configure.log 2>&1
make all > build.log 2>&1
> "${LATEST_LOG}" 2>&1

echo " Building..."
LATEST_LOG=${PWD}/build.log
make all > "${LATEST_LOG}" 2>&1

echo " Installing..."
make install > install.log 2>&1
LATEST_LOG=${PWD}/install.log
make install > "${LATEST_LOG}" 2>&1
cd ../..
echo ""
fi
Expand All @@ -187,8 +199,10 @@ if [ "$BUILD_BOOTSTRAP" == "yes" ] ; then
cd ext/gcc-mrisc32
./contrib/download_prerequisites > ../../out/gcc-bootstrap/prerequisites.log 2>&1
cd ../..
echo " Building..."

echo " Configuring..."
cd out/gcc-bootstrap
LATEST_LOG=${PWD}/configure.log
../../ext/gcc-mrisc32/configure \
--prefix="$PREFIX" \
--target="$TARGET" \
Expand All @@ -197,10 +211,15 @@ if [ "$BUILD_BOOTSTRAP" == "yes" ] ; then
--with-newlib \
--with-gnu-as \
--with-gnu-ld \
> configure.log 2>&1
make -j${NUM_PROCESSES} all-gcc > build.log 2>&1
> "${LATEST_LOG}" 2>&1

echo " Building..."
LATEST_LOG=${PWD}/build.log
make -j${NUM_PROCESSES} all-gcc > "${LATEST_LOG}" 2>&1

echo " Installing (temporary)..."
make install-gcc > install.log 2>&1
LATEST_LOG=${PWD}/install.log
make install-gcc > "${LATEST_LOG}" 2>&1
cd ../..
echo ""
fi
Expand All @@ -213,15 +232,22 @@ if [ "$BUILD_NEWLIB" == "yes" ] ; then
rm -rf out/newlib
fi
mkdir -p out/newlib
echo " Building..."

echo " Configuring..."
cd out/newlib
LATEST_LOG=${PWD}/configure.log
../../ext/newlib-mrisc32/configure \
--prefix="$PREFIX" \
--target="$TARGET" \
> configure.log 2>&1
make -j${NUM_PROCESSES} all > build.log 2>&1
> "${LATEST_LOG}" 2>&1

echo " Building..."
LATEST_LOG=${PWD}/build.log
make -j${NUM_PROCESSES} all > "${LATEST_LOG}" 2>&1

echo " Installing..."
make install > install.log 2>&1
LATEST_LOG=${PWD}/install.log
make install > "${LATEST_LOG}" 2>&1
cd ../..
echo ""
fi
Expand All @@ -238,7 +264,9 @@ if [ "$BUILD_GCC" == "yes" ] ; then
cd ext/gcc-mrisc32
./contrib/download_prerequisites > ../../out/gcc/prerequisites.log 2>&1
cd ../..
echo " Building..."

echo " Configuring..."
LATEST_LOG=${PWD}/configure.log
cd out/gcc
../../ext/gcc-mrisc32/configure \
--prefix="$PREFIX" \
Expand All @@ -249,10 +277,15 @@ if [ "$BUILD_GCC" == "yes" ] ; then
--with-gnu-ld \
--disable-shared \
--disable-libssp \
> configure.log 2>&1
make -j${NUM_PROCESSES} all > build.log 2>&1
> "${LATEST_LOG}" 2>&1

echo " Building..."
LATEST_LOG=${PWD}/build.log
make -j${NUM_PROCESSES} all > "${LATEST_LOG}" 2>&1

echo " Installing..."
make install > install.log 2>&1
LATEST_LOG=${PWD}/install.log
make install > "${LATEST_LOG}" 2>&1
cd ../..
echo ""
fi
Expand Down

0 comments on commit c937dec

Please sign in to comment.