ladybird/Toolchain/BuildIt.sh

100 lines
2.8 KiB
Bash
Raw Normal View History

2019-04-15 16:16:47 +03:00
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $DIR
2019-04-15 16:16:47 +03:00
TARGET=i686-pc-serenity
PREFIX="$DIR/Local"
SYSROOT="$DIR/../Root"
2019-04-15 16:16:47 +03:00
echo PREFIX is $PREFIX
echo SYSROOT is $SYSROOT
2019-04-15 16:16:47 +03:00
mkdir -p "$DIR/Tarballs"
source "$DIR/UseIt.sh"
2019-04-15 16:16:47 +03:00
pushd "$DIR/Tarballs"
md5="$(md5sum binutils-2.32.tar.gz | cut -f1 -d' ')"
echo "bu md5='$md5'"
if [ ! -e "binutils-2.32.tar.gz" ] || [ "$md5" != "d1119c93fc0ed3007be4a84dd186af55" ] ; then
rm -f binutils-2.32.tar.gz
2019-04-15 16:16:47 +03:00
wget "http://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.gz"
else
echo "Skipped downloading binutils"
2019-04-15 16:16:47 +03:00
fi
md5="$(md5sum gcc-8.3.0.tar.gz | cut -f1 -d' ')"
echo "gc md5='$md5'"
if [ ! -e "gcc-8.3.0.tar.gz" ] || [ "$md5" != "9972f8c24c02ebcb5a342c1b30de69ff" ] ; then
rm -f gcc-8.3.0.tar.gz
2019-04-15 16:16:47 +03:00
wget "http://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz"
else
echo "Skipped downloading gcc"
2019-04-15 16:16:47 +03:00
fi
if [ ! -d "binutils-2.32" ]; then
echo "Extracting binutils..."
2019-04-15 16:16:47 +03:00
tar -xf "binutils-2.32.tar.gz"
pushd "binutils-2.32"
patch -p1 < $DIR/Patches/binutils.patch > /dev/null
2019-04-15 16:16:47 +03:00
popd
else
echo "Skipped extracting binutils"
2019-04-15 16:16:47 +03:00
fi
if [ ! -d "gcc-8.3.0" ]; then
echo "Extracting gcc..."
2019-04-15 16:16:47 +03:00
tar -xf "gcc-8.3.0.tar.gz"
pushd "gcc-8.3.0"
patch -p1 < $DIR/Patches/gcc.patch > /dev/null
2019-04-15 16:16:47 +03:00
popd
else
echo "Skipped extracting gcc"
2019-04-15 16:16:47 +03:00
fi
popd
mkdir -p $PREFIX
mkdir -p "$DIR/Build/binutils"
mkdir -p "$DIR/Build/gcc"
pushd "$DIR/Build/"
unset PKG_CONFIG_LIBDIR # Just in case
pushd binutils
$DIR/Tarballs/binutils-2.32/configure --prefix=$PREFIX \
--target=$TARGET \
--with-sysroot=$SYSROOT \
--disable-nls || exit 1
make -j $(nproc) || exit 1
make install || exit 1
2019-04-15 16:16:47 +03:00
popd
pushd gcc
$DIR/Tarballs/gcc-8.3.0/configure --prefix=$PREFIX \
--target=$TARGET \
--with-sysroot=$SYSROOT \
--disable-nls \
--with-newlib \
--enable-languages=c,c++ || exit 1
echo "XXX build gcc and libgcc"
make -j $(nproc) all-gcc all-target-libgcc || exit 1
echo "XXX install gcc and libgcc"
make install-gcc install-target-libgcc || exit 1
echo "XXX serenity libc and libm"
make -C "$DIR/../LibC/" install
make -C "$DIR/../LibM/" install
echo "XXX build libstdc++"
make all-target-libstdc++-v3 || exit 1
echo "XXX install libstdc++"
make install-target-libstdc++-v3 || exit 1
2019-04-15 16:16:47 +03:00
popd
popd