mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Make automagic automatically print command output in case an error occurs
--HG-- branch : minor
This commit is contained in:
+20
-18
@@ -26,42 +26,44 @@ AUTOMAKE=${AUTOMAKE:-$(which automake)}
|
|||||||
[[ -x ${ACLOCAL} ]] || die "Could not find aclocal. Install automake."
|
[[ -x ${ACLOCAL} ]] || die "Could not find aclocal. Install automake."
|
||||||
[[ -x ${AUTOMAKE} ]] || die "Could not find automake."
|
[[ -x ${AUTOMAKE} ]] || die "Could not find automake."
|
||||||
|
|
||||||
|
print_errors() {
|
||||||
|
local output
|
||||||
|
output="$("$@" 2>&1)" && return 0
|
||||||
|
printf "%s\n" "$output"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
automagic() {
|
automagic() {
|
||||||
log "Copying files..." >&2
|
log "Copying files..." >&2
|
||||||
cp platform/unix/configure.ac .
|
cp platform/unix/configure.ac .
|
||||||
cp platform/unix/Makefile.am .
|
cp platform/unix/Makefile.am .
|
||||||
|
|
||||||
log "Running genmodules..." >&2
|
log "Running genmodules..." >&2
|
||||||
if ! bash platform/unix/genmodules "$1"; then
|
if ! print_errors bash platform/unix/genmodules "$1"; then
|
||||||
echo "You should be doing this from the root directory of the project."
|
echo "You should be doing this from the root directory of the project."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Running autoheader..." >&2
|
log "Running autoheader..."
|
||||||
${AUTOHEADER} 2>&1 || return 1 # Gimmie config.h.in
|
print_errors ${AUTOHEADER} || return 1 # Gimmie config.h.in
|
||||||
|
|
||||||
log "Running libtoolize..." >&2
|
log "Running libtoolize..."
|
||||||
${LIBTOOLIZE} --force 2>&1 || return 1
|
print_errors ${LIBTOOLIZE} --force || return 1
|
||||||
|
|
||||||
log "Running aclocal..." >&2
|
log "Running aclocal..."
|
||||||
${ACLOCAL} 2>&1 || return 1
|
print_errors ${ACLOCAL} || return 1
|
||||||
|
|
||||||
log "Running autoconf..." >&2
|
log "Running autoconf..."
|
||||||
${AUTOCONF} 2>&1 || return 1
|
print_errors ${AUTOCONF} || return 1
|
||||||
|
|
||||||
log "Running automake..." >&2
|
log "Running automake..."
|
||||||
${AUTOMAKE} -a 2>&1 || return 1
|
print_errors ${AUTOMAKE} -a || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == "-d" ]]; then
|
automagic "$@"
|
||||||
shift 1
|
|
||||||
automagic "$@" 2>&1
|
|
||||||
else
|
|
||||||
(automagic "$@" > /dev/null) 2>&1
|
|
||||||
fi
|
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
log "Failed, sadface."
|
log "Failed, sadface."
|
||||||
log "You can make this script more verbose running it in debug mode (-d)"
|
|
||||||
log "This is generally a configuration error (I'm looking at you aclocal)"
|
log "This is generally a configuration error (I'm looking at you aclocal)"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user