Skip to content

Commit 5124435

Browse files
committed
unified build for all toolchains
1 parent f1d8ff0 commit 5124435

16 files changed

Lines changed: 263 additions & 601 deletions

build-binutils.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
#---------------------------------------------------------------------------------
3+
4+
#---------------------------------------------------------------------------------
5+
# build and install binutils
6+
#---------------------------------------------------------------------------------
7+
8+
mkdir -p $target/binutils
9+
pushd $target/binutils
10+
11+
if [ ! -f configured-binutils ]
12+
then
13+
CPPFLAGS="$cppflags $CPPFLAGS" LDFLAGS="$ldflags $LDFLAGS" ../../binutils-$BINUTILS_VER/configure \
14+
--prefix=$prefix --target=$target \
15+
--disable-nls --disable-werror \
16+
--disable-shared --disable-debug \
17+
--enable-lto --enable-plugins \
18+
--enable-poison-system-directories \
19+
$CROSS_PARAMS \
20+
|| { echo "Error configuring binutils"; exit 1; }
21+
touch configured-binutils
22+
fi
23+
24+
if [ ! -f built-binutils ]
25+
then
26+
$MAKE || { echo "Error building binutils"; exit 1; }
27+
touch built-binutils
28+
fi
29+
30+
if [ ! -f installed-binutils ]
31+
then
32+
$MAKE install || { echo "Error installing binutils"; exit 1; }
33+
touch installed-binutils
34+
fi
35+
popd

build-crtls.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
#---------------------------------------------------------------------------------
4+
# set env variables
5+
#---------------------------------------------------------------------------------
6+
export DEVKITPRO=$TOOLPATH
7+
export DEVKITPPC=$DEVKITPRO/devkitPPC
8+
export DEVKITARM=$DEVKITPRO/devkitARM
9+
10+
#---------------------------------------------------------------------------------
11+
# Install the rules files
12+
#---------------------------------------------------------------------------------
13+
cd $BUILDDIR
14+
15+
if [ ! -f extracted-${_prefix}-rules ]; then
16+
tar -xvf $SRCDIR/${_prefix}-rules-${_rules_ver}.tar.gz || touch extracted-${_prefix}-rules
17+
fi
18+
19+
cd ${_prefix}-rules-${_rules_ver}
20+
21+
if [ ! -f installed-${_prefix}-rules ]; then
22+
$MAKE install || touch installed-${_prefix}-rules
23+
fi
24+
25+
#---------------------------------------------------------------------------------
26+
# Install the linkscripts
27+
#---------------------------------------------------------------------------------
28+
if [ $VERSION -ne 3 ]; then
29+
cd $BUILDDIR
30+
31+
if [ ! -f extracted-${_prefix}-crtls ]; then
32+
tar -xvf $SRCDIR/${_prefix}-crtls-${_crtls_ver}.tar.gz || touch extracted-${_prefix}-crtls
33+
fi
34+
35+
cd ${_prefix}-crtls-${_crtls_ver}
36+
37+
if [ ! -f installed-${_prefix}-crtls ]; then
38+
$MAKE install || touch installed-${_prefix}-crtls
39+
fi
40+
fi

build-devkit.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ if [ ! -z $CROSSBUILD ]; then
132132
CROSS_GCC_PARAMS="--with-gmp=$CROSSPATH --with-mpfr=$CROSSPATH --with-mpc=$CROSSPATH --with-isl=$CROSSPATH --with-zstd=$CROSSPATH"
133133
else
134134
prefix=$INSTALLDIR/$package
135+
CROSS_PARAMS="$CROSS_PARAMS --host=`./config.guess`"
135136
fi
136137

137138
#---------------------------------------------------------------------------------
@@ -239,11 +240,16 @@ if [ $VERSION -eq 2 ]; then extract_and_patch binutils $MN_BINUTILS_VER bz2; fi
239240
#---------------------------------------------------------------------------------
240241
# Build and install devkit components
241242
#---------------------------------------------------------------------------------
242-
if [ -f $scriptdir/build-gcc.sh ]; then . $scriptdir/build-gcc.sh || { echo "Error building toolchain"; exit 1; }; cd $BUILDSCRIPTDIR; fi
243+
. ${BUILDSCRIPTDIR}/build-binutils.sh || { echo "Error building binutils"; exit 1; };
244+
if [ $VERSION -eq 2 ]; then . ${BUILDSCRIPTDIR}/build-mn10200-binutils.sh || { echo "Error building mn10200 binutils"; exit 1; }; fi
243245

246+
. ${BUILDSCRIPTDIR}/build-gcc-stage1.sh || { echo "Error building gcc stage1"; exit 1; };
247+
. ${BUILDSCRIPTDIR}/build-newlib.sh || { echo "Error building newlib"; exit 1; };
248+
. ${BUILDSCRIPTDIR}/build-gcc-stage2.sh || { echo "Error building gcc stage2"; exit 1; };
244249

245-
if [ "$BUILD_DKPRO_SKIP_CRTLS" != "1" ] && [ -f $scriptdir/build-crtls.sh ]; then
246-
. $scriptdir/build-crtls.sh || { echo "Error building crtls & rules"; exit 1; }; cd $BUILDSCRIPTDIR;
250+
251+
if [ "$BUILD_DKPRO_SKIP_CRTLS" != "1" ]; then
252+
. ${BUILDSCRIPTDIR}/build-crtls.sh || { echo "Error building crtls & rules"; exit 1; };
247253
fi
248254

249255
cd $BUILDSCRIPTDIR

build-gcc-stage1.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
#---------------------------------------------------------------------------------
3+
4+
#---------------------------------------------------------------------------------
5+
# build and install the full compiler
6+
#---------------------------------------------------------------------------------
7+
mkdir -p ${BUILDDIR}/$target/gcc
8+
cd ${BUILDDIR}/$target/gcc
9+
10+
11+
if [ ! -f configured-gcc ]
12+
then
13+
CPPFLAGS="$cppflags $CPPFLAGS" \
14+
LDFLAGS="$ldflags $LDFLAGS" \
15+
CFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \
16+
CXXFLAGS_FOR_TARGET="-O2 -ffunction-sections -fdata-sections" \
17+
LDFLAGS_FOR_TARGET="" \
18+
../../gcc-$GCC_VER/configure \
19+
--target=$target \
20+
--prefix=$prefix \
21+
--enable-languages=c,c++,objc,lto \
22+
--with-gnu-as --with-gnu-ld --with-gcc \
23+
--enable-cxx-flags='-ffunction-sections' \
24+
--disable-libstdcxx-verbose \
25+
--enable-poison-system-directories \
26+
--enable-threads=posix --disable-win32-registry --disable-nls --disable-debug \
27+
--disable-libmudflap --disable-libssp --disable-libgomp \
28+
--disable-libstdcxx-pch \
29+
--enable-libstdcxx-time=yes \
30+
--enable-libstdcxx-filesystem-ts \
31+
--with-newlib=yes \
32+
--with-native-system-header-dir=/include \
33+
--with-sysroot=${prefix}/${target} \
34+
--enable-lto \
35+
--disable-tm-clone-registry \
36+
--disable-__cxa_atexit \
37+
--with-bugurl="https://devkitpro.org" \
38+
${_toolchain_options} \
39+
$CROSS_PARAMS \
40+
$CROSS_GCC_PARAMS \
41+
$EXTRA_GCC_PARAMS \
42+
|| { echo "Error configuring gcc"; exit 1; }
43+
touch configured-gcc
44+
fi
45+
46+
if [ ! -f built-gcc ]
47+
then
48+
$MAKE all-gcc || { echo "Error building gcc stage1"; exit 1; }
49+
touch built-gcc
50+
fi
51+
52+
if [ ! -f installed-gcc ]
53+
then
54+
$MAKE install-gcc || { echo "Error installing gcc stage 1"; exit 1; }
55+
touch installed-gcc
56+
fi

build-gcc-stage2.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#---------------------------------------------------------------------------------
3+
4+
#---------------------------------------------------------------------------------
5+
# build and install the full compiler
6+
#---------------------------------------------------------------------------------
7+
mkdir -p ${BUILDDIR}/$target/gcc
8+
cd ${BUILDDIR}/$target/gcc
9+
10+
11+
if [ ! -f built-gcc-stage2 ]
12+
then
13+
$MAKE || { echo "Error building gcc stage2"; exit 1; }
14+
touch built-gcc-stage2
15+
fi
16+
17+
if [ ! -f installed-gcc-stage2 ]
18+
then
19+
$MAKE install-strip || { echo "Error installing gcc"; exit 1; }
20+
touch installed-gcc-stage2
21+
fi

build-mn10200-binutils.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#---------------------------------------------------------------------------------
2+
# build and install mn10200 binutils
3+
#---------------------------------------------------------------------------------
4+
5+
# Use modern config.sub for aarch64 host
6+
cp binutils-$BINUTILS_VER/config.sub binutils-$MN_BINUTILS_VER/config.sub
7+
8+
mkdir -p mn10200/binutils
9+
pushd mn10200/binutils
10+
11+
if [ ! -f configured-binutils ]
12+
then
13+
../../binutils-$MN_BINUTILS_VER/configure \
14+
--prefix=$prefix --target=mn10200 --disable-nls --disable-debug \
15+
--disable-multilib \
16+
--disable-werror $CROSS_PARAMS \
17+
|| { echo "Error configuing mn10200 binutils"; exit 1; }
18+
touch configured-binutils
19+
fi
20+
21+
if [ ! -f built-binutils ]
22+
then
23+
$MAKE || { echo "Error building mn10200 binutils"; exit 1; }
24+
touch built-binutils
25+
fi
26+
27+
if [ ! -f installed-binutils ]
28+
then
29+
$MAKE install || { echo "Error installing mn10200 binutils"; exit 1; }
30+
touch installed-binutils
31+
fi
32+
33+
popd

build-newlib.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
#---------------------------------------------------------------------------------
3+
4+
#---------------------------------------------------------------------------------
5+
# build and install newlib
6+
#---------------------------------------------------------------------------------
7+
8+
unset CFLAGS
9+
cd $BUILDDIR
10+
11+
OLD_CC=$CC
12+
OLDCXX=$CXX
13+
unset CC
14+
unset CXX
15+
16+
#---------------------------------------------------------------------------------
17+
# build and install newlib
18+
#---------------------------------------------------------------------------------
19+
mkdir -p ${BUILDDIR}/$target/newlib
20+
cd ${BUILDDIR}/$target/newlib
21+
22+
_target_cflags="-O2 -ffunction-sections -fdata-sections"
23+
24+
if [ $VERSION -eq 2 ]; then
25+
_target_cflags="${_target_cflags} -DCUSTOM_MALLOC_LOCK"
26+
fi
27+
28+
if [ ! -f configured-newlib ]
29+
then
30+
CFLAGS_FOR_TARGET="${_target_cflags}" \
31+
../../newlib-$NEWLIB_VER/configure \
32+
--disable-newlib-supplied-syscalls \
33+
--enable-newlib-mb \
34+
--disable-newlib-wide-orient \
35+
--enable-newlib-register-fini \
36+
--target=$target \
37+
--prefix=$prefix \
38+
|| { echo "Error configuring newlib"; exit 1; }
39+
touch configured-newlib
40+
fi
41+
42+
if [ ! -f built-newlib ]
43+
then
44+
$MAKE || { echo "Error building newlib"; exit 1; }
45+
touch built-newlib
46+
fi
47+
48+
49+
if [ ! -f installed-newlib ]
50+
then
51+
$MAKE install -j1 || { echo "Error installing newlib"; exit 1; }
52+
touch installed-newlib
53+
fi
54+
55+
export CC=$OLD_CC
56+
export CXX=$OLD_CXX

dka64/rules/base_rules

Lines changed: 0 additions & 40 deletions
This file was deleted.

dka64/rules/base_tools

Lines changed: 0 additions & 41 deletions
This file was deleted.

dka64/scripts/build-crtls.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)