2
0

Check the presence of tools needed to build the C targets.

This commit is contained in:
Maarten Billemont 2014-10-18 15:38:51 -04:00
parent 6f741f6f2f
commit 039547b735
2 changed files with 270 additions and 564 deletions

File diff suppressed because it is too large Load Diff

View File

@ -36,32 +36,33 @@ fetch() {
} }
fetchSource() ( fetchSource() (
echo echo
echo "Fetching dependency ${PWD##*/}..." echo "Fetching dependency: ${PWD##*/}..."
source .source source .source
if [[ $git ]] && hash git 2>/dev/null; then if [[ $git ]] && hash git 2>/dev/null; then
echo echo
echo "Fetching ${PWD##*/} using git..." echo "Fetching: ${PWD##*/}, using git..."
git-svn clone --prefix=origin/ --stdlayout "$svn" . git-svn clone --prefix=origin/ --stdlayout "$svn" .
printf '%s' "$(git describe --always)" > "${PWD##*/}-version" printf '%s' "$(git describe --always)" > "${PWD##*/}-version"
return return
elif [[ $svn ]] && hash git-svn 2>/dev/null; then elif [[ $svn ]] && hash git-svn 2>/dev/null; then
echo echo
echo "Fetching ${PWD##*/} using git-svn..." echo "Fetching: ${PWD##*/}, using git-svn..."
git-svn clone --prefix=origin/ --stdlayout "$svn" . git-svn clone --prefix=origin/ --stdlayout "$svn" .
printf '%s' "$(git describe --always)" > "${PWD##*/}-version" printf '%s' "$(git describe --always)" > "${PWD##*/}-version"
return return
elif [[ $svn ]] && hash svn 2>/dev/null; then elif [[ $svn ]] && hash svn 2>/dev/null; then
echo echo
echo "Fetching ${PWD##*/} using svn..." echo "Fetching: ${PWD##*/}, using svn..."
svn checkout "$svn/trunk" . svn checkout "$svn/trunk" .
printf 'r%s' "$(svn info | awk '/^Revision:/{ print $2 }')" > "${PWD##*/}-version" printf 'r%s' "$(svn info | awk '/^Revision:/{ print $2 }')" > "${PWD##*/}-version"
return return
elif [[ $pkg ]]; then elif [[ $pkg ]]; then
set -x echo
echo "Fetching: ${PWD##*/}, using package..."
fetch "$pkg" fetch "$pkg"
if [[ $pkg = *.tar.gz || $pkg = *.tgz ]]; then if [[ $pkg = *.tar.gz || $pkg = *.tgz ]]; then
tar -xvzf "${pkg##*/}" tar -xvzf "${pkg##*/}"
@ -72,7 +73,6 @@ fetchSource() (
fi fi
fi fi
return return
fi fi
echo >&2 "error: Missing git-svn or svn." echo >&2 "error: Missing git-svn or svn."
@ -84,7 +84,7 @@ fetchSource() (
depend() { depend() {
echo echo
echo "Checking dependency $1..." echo "Checking dependency: $1..."
[[ -e "lib/$1/.built" ]] && return [[ -e "lib/$1/.built" ]] && return
pushd "lib/$1" pushd "lib/$1"
@ -92,10 +92,15 @@ depend() {
[[ -e $files ]] || fetchSource [[ -e $files ]] || fetchSource
echo echo
echo "Configuring dependency $1..." echo "Configuring dependency: $1..."
if [[ -e configure.ac ]]; then if [[ -e configure.ac ]]; then
if [[ ! -e configure ]]; then if [[ ! -e configure ]]; then
# create configure using autotools. # create configure using autotools.
if ! hash aclocal || ! hash automake; then
echo >&2 "Need autotools to build $1. Please install automake and autoconf."
exit 1
fi
aclocal aclocal
autoheader autoheader
autoconf autoconf
@ -109,8 +114,13 @@ depend() {
fi fi
echo echo
echo "Building dependency $1..." echo "Building dependency: $1..."
if [[ -e Makefile ]]; then if [[ -e Makefile ]]; then
if ! hash make; then
echo >&2 "Need make to build $1. Please install GNU make."
exit 1
fi
make make
date > .built date > .built
else else
@ -194,11 +204,15 @@ mpw-bench() {
cc() { cc() {
if hash llvm-gcc 2>/dev/null; then if hash llvm-gcc 2>/dev/null; then
llvm-gcc "$@" llvm-gcc "$@"
else elif hash gcc 2>/dev/null; then
gcc -std=gnu99 "$@" gcc -std=gnu99 "$@"
else
echo >&2 "Need a compiler. Please install GCC or LLVM."
exit 1
fi fi
} }
echo "Will build targets: ${targets[*]}${options:+, using options: ${options[*]}}..."
for target in "${targets[@]}"; do for target in "${targets[@]}"; do
"$target" "$@" "$target" "$@"
done done