[TOOLCHAIN] Hosted toolchain with musl libc

This commit is contained in:
2016-11-29 09:19:44 +01:00
parent 4f76557b73
commit ba2ecd725f
8 changed files with 336 additions and 8 deletions

View File

@@ -4,33 +4,60 @@
bindir=${TOOLCHAIN}/bin
packages=(binutils gcc gdb)
packages=(automake autoconf musl_headers binutils gcc musl gdb)
if [[ `uname` == 'Darwin' ]]; then
packages=("${packages[@]}" objconv)
fi
packages=("${packages[@]}" grub)
musl_checkfile=${SYSROOT}/usr/lib/libc.a
musl_filename=musl
musl_url=git://git.musl-libc.org/musl
musl_config="--target=${TARGET} \
--prefix=${SYSROOT}/usr \
--disable-shared \
--enable-debug \
CFLAGS=-O0"
musl_headers_checkfile=${SYSROOT}/usr/include/complex.h
musl_headers_filename=${musl_filename}
musl_headers_url=${musl_url}
function musl_headers_install() {
local package=musl
pushd ${STASH}/${package} >/dev/null
echo "Configuring"
echo "ARCH=x86_64">config.mak
echo "prefix=${SYSROOT}/usr">>config.mak
echo "includedir=\$(prefix)/include">> config.mak
echo "Compiling"
make install-headers \
>/dev/null 2>>"${STASH}/error-${package}.log" || fail
popd >/dev/null
}
# Binutils 2.26
# Build with --with-sysroot for use in the future
binutils_checkfile=${bindir}/${TARGET}-ld
binutils_filename=binutils-2.26
binutils_url=ftp://ftp.gnu.org/gnu/binutils/${binutils_filename}.tar.gz
binutils_config="--target=${TARGET} \
--with-sysroot \
--with-sysroot=${SYSROOT} \
--disable-nls \
--disable-werror"
binutils_patchcmd="patch -p0 -N < ${BUILDROOT}/util/binutils.patch; cd ld; automake"
# GCC 6.1.0
# Build with --without-headers for now - this will be replaced later
gcc_checkfile=${bindir}/${TARGET}-gcc
gcc_filename=gcc-6.1.0
gcc_url=ftp://ftp.gnu.org/gnu/gcc/${gcc_filename}/${gcc_filename}.tar.gz
gcc_config="--target=${TARGET} \
--disable-nls \
--enable-languages=c,c++ \
--without-headers"
--with-sysroot=${SYSROOT}"
gcc_make="all-gcc all-target-libgcc"
gcc_install="install-gcc install-target-libgcc"
gcc_patchcmd="patch -p0 -N < ${BUILDROOT}/util/gcc.patch; cd libstdc++-v3; autoconf"
# GDB 7.12
gdb_checkfile=${bindir}/x86_64-elf-linux-gdb
@@ -73,6 +100,18 @@ grub_config="--target=x86_64-elf \
TARGET_RANLIB=${TARGET}-ranlib"
grub_patchcmd="autogen.sh"
# automake 1.11.1
# GCC requires exactly this version
automake_checkfile=${TOOLCHAIN}/bin/automake
automake_filename=automake-1.11.1
automake_url=ftp://ftp.gnu.org/gnu/automake/${automake_filename}.tar.gz
# autoconf 2.64
# GCC requires exactly this version
autoconf_checkfile=${TOOLCHAIN}/bin/autoconf
autoconf_filename=autoconf-2.64
autoconf_url=ftp://ftp.gnu.org/gnu/autoconf/${autoconf_filename}.tar.gz
function checkall() {
for package in "${packages[@]}"
do
@@ -96,6 +135,7 @@ function main() {
print_info "Preparing toolchain"
mkdir -p "${STASH}"
mkdir -p "${SYSROOT}/usr/include"
PATH=${TOOLCHAIN}/bin:${PATH}
for package in "${packages[@]}"