Skip to content
Snippets Groups Projects
Commit 53653625 authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub
Browse files

Merge pull request #47 from goyox86/goyox86/macos-fixes

Detecting find and stat from Homebrew/MacPorts on macOS
parents 387c6622 bd0d732a
No related branches found
No related tags found
No related merge requests found
...@@ -9,3 +9,22 @@ ROOT="$(cd `dirname "$0"` && pwd)" ...@@ -9,3 +9,22 @@ ROOT="$(cd `dirname "$0"` && pwd)"
REPO="$ROOT/repo/$TARGET" REPO="$ROOT/repo/$TARGET"
export CC="x86_64-elf-redox-gcc" export CC="x86_64-elf-redox-gcc"
export XARGO_HOME="$ROOT/xargo" 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
...@@ -24,8 +24,8 @@ do ...@@ -24,8 +24,8 @@ do
echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2 echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2
./cook.sh "$recipe" prepare ./cook.sh "$recipe" prepare
else else
TIME_SOURCE="$(find recipes/$recipe/source -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)" 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" ] if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ]
then then
echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2 echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2
...@@ -38,9 +38,9 @@ do ...@@ -38,9 +38,9 @@ do
echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2 echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2
./cook.sh "$recipe" update build stage tar ./cook.sh "$recipe" update build stage tar
else else
TIME_BUILD="$(find recipes/$recipe/build -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_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar.gz)" 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_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" ] if [ "$TIME_BUILD" -gt "$TIME_STAGE" -o "$TIME_RECIPE" -gt "$TIME_STAGE" ]
then then
echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2 echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment