2019-04-15 16:16:47 +03:00
|
|
|
#!/bin/bash
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2019-04-15 17:34:41 +03:00
|
|
|
echo $DIR
|
|
|
|
|
2019-04-15 16:16:47 +03:00
|
|
|
TARGET=i686-pc-serenity
|
|
|
|
PREFIX="$DIR/Local"
|
2019-04-29 16:09:57 +03:00
|
|
|
SYSROOT="$DIR/../Root"
|
2019-04-15 16:16:47 +03:00
|
|
|
|
2019-05-08 16:50:24 +03:00
|
|
|
echo PREFIX is $PREFIX
|
|
|
|
echo SYSROOT is $SYSROOT
|
|
|
|
|
2019-04-15 16:16:47 +03:00
|
|
|
mkdir -p "$DIR/Tarballs"
|
|
|
|
|
2019-04-25 20:28:10 +03:00
|
|
|
source "$DIR/UseIt.sh"
|
|
|
|
|
2019-04-15 16:16:47 +03:00
|
|
|
pushd "$DIR/Tarballs"
|
2019-05-08 16:50:24 +03:00
|
|
|
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"
|
2019-04-15 17:34:41 +03:00
|
|
|
else
|
|
|
|
echo "Skipped downloading binutils"
|
2019-04-15 16:16:47 +03:00
|
|
|
fi
|
|
|
|
|
2019-05-08 16:50:24 +03:00
|
|
|
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"
|
2019-04-15 17:34:41 +03:00
|
|
|
else
|
|
|
|
echo "Skipped downloading gcc"
|
2019-04-15 16:16:47 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "binutils-2.32" ]; then
|
2019-04-15 17:34:41 +03:00
|
|
|
echo "Extracting binutils..."
|
2019-04-15 16:16:47 +03:00
|
|
|
tar -xf "binutils-2.32.tar.gz"
|
|
|
|
|
|
|
|
pushd "binutils-2.32"
|
2019-04-15 17:34:41 +03:00
|
|
|
patch -p1 < $DIR/Patches/binutils.patch > /dev/null
|
2019-04-15 16:16:47 +03:00
|
|
|
popd
|
2019-04-15 17:34:41 +03:00
|
|
|
else
|
|
|
|
echo "Skipped extracting binutils"
|
2019-04-15 16:16:47 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "gcc-8.3.0" ]; then
|
2019-04-15 17:34:41 +03:00
|
|
|
echo "Extracting gcc..."
|
2019-04-15 16:16:47 +03:00
|
|
|
tar -xf "gcc-8.3.0.tar.gz"
|
|
|
|
|
|
|
|
pushd "gcc-8.3.0"
|
2019-04-15 17:34:41 +03:00
|
|
|
patch -p1 < $DIR/Patches/gcc.patch > /dev/null
|
2019-04-15 16:16:47 +03:00
|
|
|
popd
|
2019-04-15 17:34:41 +03:00
|
|
|
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
|
2019-04-15 17:34:41 +03:00
|
|
|
$DIR/Tarballs/binutils-2.32/configure --prefix=$PREFIX \
|
|
|
|
--target=$TARGET \
|
|
|
|
--with-sysroot=$SYSROOT \
|
|
|
|
--disable-nls || exit 1
|
2019-05-08 16:50:24 +03:00
|
|
|
make -j $(nproc) || exit 1
|
|
|
|
make install || exit 1
|
2019-04-15 16:16:47 +03:00
|
|
|
popd
|
|
|
|
|
|
|
|
pushd gcc
|
2019-04-15 17:34:41 +03:00
|
|
|
$DIR/Tarballs/gcc-8.3.0/configure --prefix=$PREFIX \
|
|
|
|
--target=$TARGET \
|
|
|
|
--with-sysroot=$SYSROOT \
|
2019-04-29 16:09:57 +03:00
|
|
|
--disable-nls \
|
|
|
|
--with-newlib \
|
2019-04-15 17:34:41 +03:00
|
|
|
--enable-languages=c,c++ || exit 1
|
|
|
|
|
2019-05-08 16:50:24 +03:00
|
|
|
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
|
2019-04-17 18:29:45 +03:00
|
|
|
|
2019-05-08 16:50:24 +03:00
|
|
|
echo "XXX serenity libc and libm"
|
2019-04-25 20:28:10 +03:00
|
|
|
make -C "$DIR/../LibC/" install
|
|
|
|
make -C "$DIR/../LibM/" install
|
2019-04-17 18:29:45 +03:00
|
|
|
|
2019-05-08 16:50:24 +03:00
|
|
|
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
|
2019-04-29 16:09:57 +03:00
|
|
|
popd
|
|
|
|
|