From 1c4cd56b7e5968281713daecac4adce6d82b7173 Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Thu, 3 Sep 2015 16:35:04 -0400 Subject: [PATCH] checkpoint commit --- config.sh | 16 +++++- scripts/build-chroot.sh | 62 +++++++++++++++++++++ scripts/build-toolchain.sh | 34 +++++++++++ musl-cross-config.sh => toolchain-config.sh | 2 +- 4 files changed, 112 insertions(+), 2 deletions(-) create mode 100755 scripts/build-chroot.sh create mode 100755 scripts/build-toolchain.sh rename musl-cross-config.sh => toolchain-config.sh (96%) diff --git a/config.sh b/config.sh index c683129..73ee723 100644 --- a/config.sh +++ b/config.sh @@ -22,10 +22,24 @@ export AL_TARBALLS=$AL/tarballs # Variable pointing to the sources directory export AL_SOURCES=$AL/sources +export AL_TGT=$(uname -m)-linux-musl + ############################################################################### # Build Environment Settings ############################################################################### # Setup the path to use the cross-tools when they're available -export PATH=$AL_ROOT/tools/$(uname -m)-linux-musl/bin:$PATH +export PATH=$AL_ROOT/tools/$AL_TGT/bin:$PATH + +export CC=$AL_TGT-gcc +export CXX=$AL_TGT-g++ +export AR=$AL_TGT-ar +export AS=$AL_TGT-as +export LD=$AL_TGT-ld +export RANLIB=$AL_TGT-ranlib +export READELF=$AL_TGT-readelf +export STRIP=$AL_TGT-strip + +export CFLAGS="-static" +export LDFLAGS="-static" diff --git a/scripts/build-chroot.sh b/scripts/build-chroot.sh new file mode 100755 index 0000000..2078601 --- /dev/null +++ b/scripts/build-chroot.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +############################################################################### +# Configuration Settings +############################################################################### + +# Turn off command hashing and make the script exit when a command errors. +set -e + +# Load the config settings +. ./config.sh + +# Make sure CFLAGS isnt set +unset CFLAGS + +############################################################################### +# Helper Functions +############################################################################### +fetch(){ + if [ ! -d "$3" ]; then + mkdir -p "$AL_TARBALLS" + if [ ! -f "$AL_TARBALLS/$1" ]; then + echo curl -L --retry 5 "$2/$1" > "$AL_TARBALLS/$1" + curl -L --retry 5 "$2/$1" > "$AL_TARBALLS/$1" + fi + mkdir -p "$3" + tar -xvf "$AL_TARBALLS/$1" -C "$3" --strip-components 1 + fi +} + +gitclone(){ + if [ ! -d "$2" ]; then + git clone --depth 1 $1 $2 + fi +} + +############################################################################### +# Fetch Dependencies +############################################################################### +gitclone http://git.suckless.org/sbase "$AL_SOURCES/sbase" +gitclone http://git.suckless.org/ubase "$AL_SOURCES/ubase" +fetch dash-0.5.8.tar.gz http://gondor.apana.org.au/~herbert/dash/files/ "$AL_SOURCES/dash" + +############################################################################### +# Install Base Software +############################################################################### +cd "$AL_SOURCES/sbase" +make CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS -j8 +make PREFIX=$AL_ROOT install +cd "$AL" + +#cd "$AL_SOURCES/ubase" +#make CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS -j8 +#make PREFIX=$AL_ROOT install +#cd "$AL" + +cd "$AL_SOURCES/dash" +./configure --prefix=$AL_ROOT +make -j8 +make install +cd $AL + diff --git a/scripts/build-toolchain.sh b/scripts/build-toolchain.sh new file mode 100755 index 0000000..a5a5068 --- /dev/null +++ b/scripts/build-toolchain.sh @@ -0,0 +1,34 @@ + +#!/bin/sh + +############################################################################### +# Configuration Settings +############################################################################### + +# Turn off command hashing and make the script exit when a command errors. +set -e + +# Load the config settings +. ./config.sh + +# Make sure CFLAGS isnt set +unset CFLAGS + +############################################################################### +# Helper Functions +############################################################################### +gitclone(){ + if [ ! -d "$2" ]; then + git clone --depth 1 $1 $2 + fi +} + +############################################################################### +# Build the Cross-Compiler +############################################################################### +gitclone https://github.com/sabotage-linux/musl-cross.git "$AL_SOURCES/musl-cross" +cp toolchain-config.sh "$AL_SOURCES/musl-cross/config.sh" +cd "$AL_SOURCES/musl-cross" +./build.sh +cd "$AL" + diff --git a/musl-cross-config.sh b/toolchain-config.sh similarity index 96% rename from musl-cross-config.sh rename to toolchain-config.sh index 6e492f6..9063fda 100644 --- a/musl-cross-config.sh +++ b/toolchain-config.sh @@ -6,7 +6,7 @@ MAKEFLAGS=-j8 # Tell the build scripts where the cross compiler should go -CC_BASE_PREFIX="../../root/tools/" +CC_BASE_PREFIX="$PWD/../../root/tools/" # If you use arm, you may need more fine-tuning: # arm hardfloat v7 -- 2.55.0