diff --git a/iglu.sh b/iglu.sh index 354ca79..c83d38e 100755 --- a/iglu.sh +++ b/iglu.sh @@ -41,6 +41,8 @@ remove() { while shift 2> /dev/null; do if [ -d "/$1" ]; then rmdir "/$1" 2> /dev/null + elif [ -f "/$1" ]; then + rm -f "/$1" 2> /dev/null fi done set -e diff --git a/iglupkg.sh b/iglupkg.sh index d99d536..bca0770 100755 --- a/iglupkg.sh +++ b/iglupkg.sh @@ -4,8 +4,21 @@ set -e export HOST_ARCH=$(uname -m) export HOST_TRIPLE="$HOST_ARCH-unknown-linux-musl" -to_run= +usage() { + echo "usage: $(basename $0) [fbp]" + exit 1 +} +fatal() { + echo "ERROR: $@" + exit 1 +} + +warn() { + echo "WARNING: $@" +} + +to_run= while [ ! -z "$1" ]; do case "$1" in --with-cross=*) @@ -17,10 +30,25 @@ while [ ! -z "$1" ]; do --with-cross) fatal '--with-cross= requires an argument' ;; + --with-cross-dir=*) + WITH_CROSS_DIR=$(echo "$1" | cut -d'=' -f2) + [ -z "$WITH_CROSS_DIR" ] && fatal '--with-cross-dir= requires an argument' + [ -d "$WITH_CROSS_DIR" ] 2>/dev/null || warn "$WITH_CROSS_DIR does not exist" + ;; + --with-cross-dir) + fatal '--with-cross-dir= requires an argument' + ;; --for-cross) echo 'INFO: for cross' FOR_CROSS=1 ;; + --for-cross-dir=*) + FOR_CROSS_DIR=$(echo "$1" | cut -d'=' -f2) + [ -z "$FOR_CROSS_DIR" ] && fatal '--for-cross-dir= requires an argument' + ;; + --for-cross-dir) + fatal '--for-cross-dir= requires an argument' + ;; fbp) to_run="f b p" ;; @@ -46,6 +74,9 @@ while [ ! -z "$1" ]; do shift done +[ -z "$WITH_CROSS_DIR" ] && WITH_CROSS_DIR=/usr/$ARCH-linux-musl +[ -z "$FOR_CROSS_DIR" ] && FOR_CROSS_DIR=/usr/$ARCH-linux-musl + if [ -z "$ARCH" ]; then export ARCH=$HOST_ARCH fi @@ -63,20 +94,6 @@ export CXXFLAGS=$CFLAGS export JOBS=$(nproc) -usage() { - echo "usage: $(basename $0) [fbp]" - exit 1 -} - -fatal() { - echo "ERROR: $@" - exit 1 -} - -warn() { - echo "WARNING: $@" -} - [ -f build.sh ] || fatal 'build.sh not found' . ./build.sh