mirror of
https://github.com/devkitPro/buildscripts.git
synced 2026-03-21 17:44:41 -05:00
179 lines
4.7 KiB
Bash
Executable File
179 lines
4.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#---------------------------------------------------------------------------------
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# build and install binutils
|
|
#---------------------------------------------------------------------------------
|
|
|
|
mkdir -p $target/binutils
|
|
cd $target/binutils
|
|
|
|
if [ ! -f configured-binutils ]
|
|
then
|
|
CFLAGS=$cflags LDFLAGS=$ldflags ../../binutils-$BINUTILS_VER/configure \
|
|
--prefix=$prefix --target=$target --disable-nls --disable-werror \
|
|
--enable-lto --enable-plugins --enable-poison-system-directories \
|
|
$CROSS_PARAMS \
|
|
|| { echo "Error configuring binutils"; exit 1; }
|
|
touch configured-binutils
|
|
fi
|
|
|
|
if [ ! -f built-binutils ]
|
|
then
|
|
$MAKE || { echo "Error building binutils"; exit 1; }
|
|
touch built-binutils
|
|
fi
|
|
|
|
if [ ! -f installed-binutils ]
|
|
then
|
|
$MAKE install || { echo "Error installing binutils"; exit 1; }
|
|
touch installed-binutils
|
|
fi
|
|
cd $BUILDDIR
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# build and install just the c compiler
|
|
#---------------------------------------------------------------------------------
|
|
mkdir -p $target/gcc
|
|
cd $target/gcc
|
|
|
|
if [ ! -f configured-gcc ]
|
|
then
|
|
CFLAGS="$cflags" \
|
|
CXXFLAGS="$cflags" \
|
|
LDFLAGS="$ldflags" \
|
|
CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \
|
|
CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \
|
|
LDFLAGS_FOR_TARGET="" \
|
|
../../gcc-$GCC_VER/configure \
|
|
--enable-languages=c,c++ \
|
|
--with-gnu-as --with-gnu-ld --with-gcc \
|
|
--with-march=armv8\
|
|
--enable-cxx-flags='-ffunction-sections' \
|
|
--disable-libstdcxx-verbose \
|
|
--enable-poison-system-directories \
|
|
--enable-interwork --enable-multilib \
|
|
--enable-threads --disable-win32-registry --disable-nls --disable-debug\
|
|
--disable-libmudflap --disable-libssp --disable-libgomp \
|
|
--disable-libstdcxx-pch \
|
|
--target=$target \
|
|
--with-newlib \
|
|
--with-headers=../../newlib-$NEWLIB_VER/newlib/libc/include \
|
|
--prefix=$prefix \
|
|
--enable-lto $plugin_ld\
|
|
--with-system-zlib \
|
|
--with-bugurl="https://github.com/devkitPro/buildscripts/issues" --with-pkgversion="devkitA64 alpha 7" \
|
|
$CROSS_PARAMS \
|
|
|| { echo "Error configuring gcc"; exit 1; }
|
|
touch configured-gcc
|
|
fi
|
|
|
|
if [ ! -f built-gcc ]
|
|
then
|
|
$MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; }
|
|
touch built-gcc
|
|
fi
|
|
|
|
if [ ! -f installed-gcc ]
|
|
then
|
|
$MAKE install-gcc || { echo "Error installing gcc"; exit 1; }
|
|
touch installed-gcc
|
|
fi
|
|
|
|
|
|
unset CFLAGS
|
|
cd $BUILDDIR
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# build and install newlib
|
|
#---------------------------------------------------------------------------------
|
|
mkdir -p $target/newlib
|
|
cd $target/newlib
|
|
|
|
if [ ! -f configured-newlib ]
|
|
then
|
|
CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \
|
|
../../newlib-$NEWLIB_VER/configure \
|
|
--disable-newlib-supplied-syscalls \
|
|
--enable-newlib-mb \
|
|
--disable-newlib-wide-orient \
|
|
--target=$target \
|
|
--prefix=$prefix \
|
|
|| { echo "Error configuring newlib"; exit 1; }
|
|
touch configured-newlib
|
|
fi
|
|
|
|
if [ ! -f built-newlib ]
|
|
then
|
|
$MAKE || { echo "Error building newlib"; exit 1; }
|
|
touch built-newlib
|
|
fi
|
|
|
|
|
|
if [ ! -f installed-newlib ]
|
|
then
|
|
$MAKE install -j1 || { echo "Error installing newlib"; exit 1; }
|
|
touch installed-newlib
|
|
fi
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# build and install the final compiler
|
|
#---------------------------------------------------------------------------------
|
|
|
|
cd $BUILDDIR
|
|
|
|
cd $target/gcc
|
|
|
|
if [ ! -f built-stage2 ]
|
|
then
|
|
$MAKE all || { echo "Error building gcc stage2"; exit 1; }
|
|
touch built-stage2
|
|
fi
|
|
|
|
if [ ! -f installed-stage2 ]
|
|
then
|
|
$MAKE install || { echo "Error installing gcc stage2"; exit 1; }
|
|
touch installed-stage2
|
|
fi
|
|
|
|
rm -fr $prefix/$target/sys-include
|
|
|
|
cd $BUILDDIR
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# build and install the debugger
|
|
#---------------------------------------------------------------------------------
|
|
mkdir -p $target/gdb
|
|
cd $target/gdb
|
|
|
|
PLATFORM=`uname -s`
|
|
|
|
if [ ! -f configured-gdb ]
|
|
then
|
|
CFLAGS="$cflags" \
|
|
CXXFLAGS="$cflags" \
|
|
LDFLAGS="$ldflags" \
|
|
../../gdb-$GDB_VER/configure \
|
|
--disable-nls --prefix=$prefix --target=$target --disable-werror \
|
|
$CROSS_PARAMS \
|
|
|| { echo "Error configuring gdb"; exit 1; }
|
|
touch configured-gdb
|
|
fi
|
|
|
|
if [ ! -f built-gdb ]
|
|
then
|
|
$MAKE || { echo "Error building gdb"; exit 1; }
|
|
touch built-gdb
|
|
fi
|
|
|
|
if [ ! -f installed-gdb ]
|
|
then
|
|
$MAKE install || { echo "Error installing gdb"; exit 1; }
|
|
touch installed-gdb
|
|
fi
|
|
|
|
#---------------------------------------------------------------------------------
|
|
# copy base rulesets
|
|
#---------------------------------------------------------------------------------
|
|
cp -v $BUILDSCRIPTDIR/dka64/rules/* $prefix
|