From 42ca7fd0d4ded453d65cb6b7a3c401eeaebacf52 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 16 Jun 2015 22:28:08 -0400 Subject: [PATCH] Changed name to aardvark linux --- .gitignore | 2 ++ build.sh | 57 +++++++++++++++++++++++++++++++++--------------------- config | 13 ++++++++++--- 3 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6c7eca --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tarballs/ +tools/ diff --git a/build.sh b/build.sh index 32cff52..afc67a3 100755 --- a/build.sh +++ b/build.sh @@ -7,12 +7,12 @@ set -e . ./config # Setup the path to use new tools as they become available -export PATH=$LFS_TOOLS/bin:$PATH +export PATH=$AL_TOOLS/bin:$PATH download(){ - mkdir -p "$LFS_TARBALLS" - if [ ! -f "$LFS_TARBALLS/$1" ]; then - curl "$2/$1" > "$LFS_TARBALLS/$1" + mkdir -p "$AL_TARBALLS" + if [ ! -f "$AL_TARBALLS/$1" ]; then + curl "$2/$1" > "$AL_TARBALLS/$1" fi } @@ -27,42 +27,55 @@ extract(){ download binutils-2.25.tar.bz2 http://ftp.gnu.org/gnu/binutils/ download cfe-3.6.1.src.tar.xz http://llvm.org/releases/3.6.1/ download llvm-3.6.1.src.tar.xz http://llvm.org/releases/3.6.1/ +#download musl-1.1.10.tar.gz http://www.musl-libc.org/releases/ # Extract the tarballs -extract "$LFS_TARBALLS/binutils-2.25.tar.bz2" "$LFS_TARBALLS/binutils" -extract "$LFS_TARBALLS/llvm-3.6.1.src.tar.xz" "$LFS_TARBALLS/llvm" -extract "$LFS_TARBALLS/cfe-3.6.1.src.tar.xz" "$LFS_TARBALLS/llvm/tools/clang" +extract "$AL_TARBALLS/binutils-2.25.tar.bz2" "$AL_TARBALLS/binutils" +extract "$AL_TARBALLS/llvm-3.6.1.src.tar.xz" "$AL_TARBALLS/llvm" +extract "$AL_TARBALLS/cfe-3.6.1.src.tar.xz" "$AL_TARBALLS/llvm/tools/clang" # Build binutils and install it in the tools prefix -mkdir -p "$LFS_TARBALLS/binutils/build" -cd "$LFS_TARBALLS/binutils/build" +mkdir -p "$AL_TARBALLS/binutils/build" +cd "$AL_TARBALLS/binutils/build" if [ ! -f Makefile ]; then - ../configure --disable-shared --with-sysroot --prefix="$LFS_TOOLS" + ../configure \ + --prefix="$AL_TOOLS" \ + --with-sysroot="$AL" \ + --with-lib-path="$AL_TOOLS" \ + --target="$AL_TGT" \ + --disable-shared \ + --disable-nls \ + --disable-werror fi -if [ ! -f "$LFS_TOOLS/bin/ar" ]; then +if [ ! -f "$AL_TOOLS/bin/ar" ]; then make make install fi -cd $LFS +cd $AL # Test that the new linker works echo 'int main(int argc, char** argv) { return 0; }' > test.c -cc -o test test.c +gcc -o test test.c rm test test.c +which ld # Build clang and install it in the -mkdir -p "$LFS_TARBALLS/llvm/build" -cd "$LFS_TARBALLS/llvm/build" +mkdir -p "$AL_TARBALLS/llvm/build" +cd "$AL_TARBALLS/llvm/build" if [ ! -f Makefile ]; then - cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LFS_TOOLS" ../ + cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$AL_TOOLS" -DBUILD_SHARED_LIBS=OFF ../ fi -if [ ! -f "$LFS_TOOLS/bin/clang" ]; then +if [ ! -f "$AL_TOOLS/bin/clang" ]; then make clang make install fi -# Test that the new clang binary works -echo 'int main(int argc, char** argv) { return 0; }' > test.c -clang -o test test.c -rm test test.c - +## Test that the new clang binary works +#echo 'int main(int argc, char** argv) { return 0; }' > test.c +#clang -o test test.c +#if [ "0" -ne "`readelf -d test | grep -c '0x'`" ]; then +# echo "Expected toolchain to compile statically but target was dynamically linked." +# exit 1 +#else +# rm test test.c +#fi diff --git a/config b/config index 642d78b..7dba491 100644 --- a/config +++ b/config @@ -1,4 +1,11 @@ +# Define the target triplet to distinguish it from the host toolchain +export AL_TGT=$(uname -m)-aardvark-linux-gnu -export LFS=$PWD -export LFS_TOOLS=$LFS/tools -export LFS_TARBALLS=$LFS/tarballs +# Define a variable to point to the root of the project +export AL=$PWD + +# Variable point to the toolchain directory +export AL_TOOLS=$AL/tools + +# Variable pointing to the tarballs directory +export AL_TARBALLS=$AL/tarballs -- 2.54.0