Mercurial > hg > aboriginal
changeset 1763:b6e4e49cec5e draft
Teach build to do an elf compiler, no libc or root filesystem if no KARCH in target.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 26 May 2015 00:10:07 -0500 |
parents | fd7e3b9ede04 |
children | 12490c08f585 |
files | native-compiler.sh simple-cross-compiler.sh sources/targets/sh2eb sources/targets/sh2elf |
diffstat | 4 files changed, 54 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/native-compiler.sh Mon May 25 21:47:52 2015 -0500 +++ b/native-compiler.sh Tue May 26 00:10:07 2015 -0500 @@ -21,17 +21,21 @@ # Build C Library -build_section linux-headers -if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] -then - build_section musl -else - build_section uClibc +if [ ! -z "$KARCH" ] +then + build_section linux-headers + if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] + then + build_section musl + else + build_section uClibc + fi fi # Build binutils, gcc, and ccwrap build_section binutils +[ ! -z "$ELF2FLT" ] && build_section elf2flt build_section gcc build_section ccwrap @@ -40,20 +44,23 @@ export "$(echo $ARCH | sed 's/-/_/g')"_CCWRAP_TOPDIR="$STAGE_DIR" -# Add C++ standard library +if [ ! -z "$KARCH" ] +then + # Add C++ standard library -[ -z "$NO_CPLUSPLUS" ] && build_section uClibc++ + [ -z "$NO_CPLUSPLUS" ] && build_section uClibc++ -# For a native compiler, build make, bash, and distcc. (Yes, this is an old -# version of Bash. It's intentional.) + # For a native compiler, build make, bash, and distcc. (Yes, this is an old + # version of Bash. It's intentional.) -if [ -z "$TOOLCHAIN_PREFIX" ] -then - build_section make - build_section bash - build_section distcc - cp "$SOURCES/toys/hdainit.sh" "$STAGE_DIR/../init" && - mv "$STAGE_DIR"/{man,share/man} || dienow + if [ -z "$TOOLCHAIN_PREFIX" ] + then + build_section make + build_section bash + build_section distcc + cp "$SOURCES/toys/hdainit.sh" "$STAGE_DIR/../init" && + mv "$STAGE_DIR"/{man,share/man} || dienow + fi fi # Delete some unneeded files and strip everything else
--- a/simple-cross-compiler.sh Mon May 25 21:47:52 2015 -0500 +++ b/simple-cross-compiler.sh Tue May 26 00:10:07 2015 -0500 @@ -31,18 +31,22 @@ build_section gcc build_section ccwrap -# Build C Library +if [ ! -z "$KARCH" ] +then -build_section linux-headers + # Build C Library + + build_section linux-headers -if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] -then - build_section musl -else - build_section uClibc + if [ -z "$UCLIBC_CONFIG" ] || [ ! -z "$MUSL" ] + then + build_section musl + else + build_section uClibc + fi fi -cat > "${STAGE_DIR}"/README << EOF && +[ ! -z "$KARCH" ] && cat > "${STAGE_DIR}"/README << EOF Cross compiler for $ARCH from http://landley.net/aboriginal To use: Add the "bin" subdirectory to your \$PATH, and use "$ARCH-cc" as @@ -65,20 +69,23 @@ done fi -# A quick hello world program to test the cross compiler out. -# Build hello.c dynamic, then static, to verify header/library paths. +if [ ! -z "$KARCH" ] +then + # A quick hello world program to test the cross compiler out. + # Build hello.c dynamic, then static, to verify header/library paths. -echo "Sanity test: building Hello World." + echo "Sanity test: building Hello World." -"${ARCH}-gcc" -Os "${SOURCES}/root-filesystem/src/hello.c" -o "$WORK"/hello && -"${ARCH}-gcc" -Os -static "${SOURCES}/root-filesystem/src/hello.c" \ - -o "$WORK"/hello || dienow + "${ARCH}-gcc" -Os "${SOURCES}/root-filesystem/src/hello.c" -o "$WORK"/hello && + "${ARCH}-gcc" -Os -static "${SOURCES}/root-filesystem/src/hello.c" \ + -o "$WORK"/hello || dienow -# Does the hello world we just built actually run? + # Does the hello world we just built actually run? -if [ ! -z "$CROSS_SMOKE_TEST" ] -then - more/cross-smoke-test.sh "$ARCH" || exit 1 + if [ ! -z "$CROSS_SMOKE_TEST" ] + then + more/cross-smoke-test.sh "$ARCH" || exit 1 + fi fi # Tar it up