Toolchain: Build full toolchain with one call to toolchain/build.sh
This commit is contained in:
parent
9e44e8be75
commit
8630f71f0c
|
@ -39,8 +39,6 @@ build_toolchain () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$BANAN_TOOLCHAIN_DIR/build.sh
|
$BANAN_TOOLCHAIN_DIR/build.sh
|
||||||
build_target libc-install
|
|
||||||
$BANAN_TOOLCHAIN_DIR/build.sh libstdc++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_image () {
|
create_image () {
|
||||||
|
|
|
@ -26,6 +26,11 @@ if [[ -z $BANAN_BUILD_DIR ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z $BANAN_SCRIPT_DIR ]]; then
|
||||||
|
echo "You must set the BANAN_SCRIPT_DIR environment variable" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $BANAN_TOOLCHAIN_DIR ]]; then
|
if [[ -z $BANAN_TOOLCHAIN_DIR ]]; then
|
||||||
echo "You must set the BANAN_TOOLCHAIN_DIR environment variable" >&2
|
echo "You must set the BANAN_TOOLCHAIN_DIR environment variable" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -46,6 +51,10 @@ if [[ -z $BANAN_ARCH ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${MAKE_JOBS:x} ]]; then
|
||||||
|
MAKE_JOBS="-j$(nproc)"
|
||||||
|
fi
|
||||||
|
|
||||||
enter_clean_build () {
|
enter_clean_build () {
|
||||||
rm -rf build
|
rm -rf build
|
||||||
mkdir build
|
mkdir build
|
||||||
|
@ -74,7 +83,7 @@ build_binutils () {
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--disable-werror
|
--disable-werror
|
||||||
|
|
||||||
make
|
make $MAKE_JOBS
|
||||||
make install
|
make install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +109,10 @@ build_gcc () {
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--enable-languages=c,c++
|
--enable-languages=c,c++
|
||||||
|
|
||||||
make all-gcc
|
make $MAKE_JOBS all-gcc
|
||||||
make all-target-libgcc CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone'
|
make $MAKE_JOBS all-target-libgcc CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone'
|
||||||
make install-gcc install-target-libgcc
|
make install-gcc
|
||||||
|
make install-target-libgcc
|
||||||
}
|
}
|
||||||
|
|
||||||
build_grub () {
|
build_grub () {
|
||||||
|
@ -127,7 +137,7 @@ build_grub () {
|
||||||
--with-platform="efi" \
|
--with-platform="efi" \
|
||||||
--disable-werror
|
--disable-werror
|
||||||
|
|
||||||
make
|
make $MAKE_JOBS
|
||||||
make install
|
make install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,38 +148,29 @@ build_libstdcpp () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $BANAN_BUILD_DIR/toolchain/$GCC_VERSION/build
|
cd $BANAN_BUILD_DIR/toolchain/$GCC_VERSION/build
|
||||||
make all-target-libstdc++-v3
|
make $MAKE_JOBS all-target-libstdc++-v3 CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone'
|
||||||
make install-target-libstdc++-v3
|
make install-target-libstdc++-v3
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $# -ge 1 ]]; then
|
# delete everything but toolchain
|
||||||
if [[ "$1" == "libstdc++" ]]; then
|
find $BANAN_BUILD_DIR -mindepth 1 -maxdepth 1 ! -name toolchain -exec rm -r {} +
|
||||||
build_libstdcpp
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "unrecognized arguments $@"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# NOTE: we have to manually create initial sysroot with libc headers
|
# NOTE: we have to manually create initial sysroot with libc headers
|
||||||
# since cmake cannot be invoked yet
|
# since cmake cannot be invoked yet
|
||||||
echo "Creating dummy sysroot"
|
echo "Creating dummy sysroot"
|
||||||
rm -rf $BANAN_SYSROOT
|
|
||||||
mkdir -p $BANAN_SYSROOT/usr
|
mkdir -p $BANAN_SYSROOT/usr
|
||||||
cp -r $BANAN_ROOT_DIR/libc/include $BANAN_SYSROOT/usr/include
|
cp -r $BANAN_ROOT_DIR/libc/include $BANAN_SYSROOT/usr/include
|
||||||
|
|
||||||
|
|
||||||
# Cleanup all old files from toolchain prefix
|
# Cleanup all old files from toolchain prefix
|
||||||
rm -rf $BANAN_TOOLCHAIN_PREFIX
|
rm -rf $BANAN_TOOLCHAIN_PREFIX
|
||||||
|
|
||||||
if [[ -z ${MAKEFLAGS:x} ]]; then
|
|
||||||
export MAKEFLAGS="-j$(nproc)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $BANAN_BUILD_DIR/toolchain
|
mkdir -p $BANAN_BUILD_DIR/toolchain
|
||||||
build_binutils
|
build_binutils
|
||||||
build_gcc
|
build_gcc
|
||||||
build_grub
|
build_grub
|
||||||
|
|
||||||
rm -rf $BANAN_SYSROOT
|
# delete sysroot and install libc
|
||||||
|
rm -r $BANAN_SYSROOT
|
||||||
|
$BANAN_SCRIPT_DIR/build.sh libc-install
|
||||||
|
|
||||||
|
build_libstdcpp
|
||||||
|
|
Loading…
Reference in New Issue