diff --git a/config.sh b/config.sh index 01976e491cf74537f33b284754acb0cae0e240de..b023610618dfcdc5b73737ab61b4dcc486197454 100755 --- a/config.sh +++ b/config.sh @@ -9,3 +9,22 @@ ROOT="$(cd `dirname "$0"` && pwd)" REPO="$ROOT/repo/$TARGET" export CC="x86_64-elf-redox-gcc" export XARGO_HOME="$ROOT/xargo" + +if [[ "$OSTYPE" == "darwin"* ]]; then + # GNU find + FIND="gfind"; + + # GNU stat from Homebrew or MacPorts + if [ ! -z "$(which brew)" ]; then + STAT="$(brew --prefix)/opt/coreutils/libexec/gnubin/stat"; + elif [ ! -z "$(which port)" ]; then + # TODO: find a programatic way of asking MacPorts for it's root dir. + STAT="/opt/local/opt/coreutils/libexec/gnubin/stat"; + else + echo "Please install either Homebrew or MacPorts and run the boostrap script." + exit 1 + fi +else + FIND="find" + STAT="stat"; +fi diff --git a/repo.sh b/repo.sh index 0e8b18cfb63bc75f9a86d3d1ccd6d6e3d0be8d1d..ecde2d38ba336902f697bbdc5e6d56b9a242c5c1 100755 --- a/repo.sh +++ b/repo.sh @@ -24,8 +24,8 @@ do echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2 ./cook.sh "$recipe" prepare else - TIME_SOURCE="$(find recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_SOURCE="$($FIND recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_BUILD="$($FIND recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ] then echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2 @@ -38,9 +38,9 @@ do echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2 ./cook.sh "$recipe" update build stage tar else - TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar.gz)" - TIME_RECIPE="$(find recipes/$recipe/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)" + TIME_BUILD="$($FIND recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_STAGE="$($STAT -c "%Y" recipes/$recipe/stage.tar.gz)" + TIME_RECIPE="$($FIND recipes/$recipe/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)" if [ "$TIME_BUILD" -gt "$TIME_STAGE" -o "$TIME_RECIPE" -gt "$TIME_STAGE" ] then echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2