Files
love/platform/unix/automagic
T
Bart van Strien 3d82eecc08 Apply the love-experiment moduleselect branch
You can now:
	- Enable and disable love's modules, implementations and libraries using configure switches
	- Use pkg-config for a couple of love's requirements
	- Build on OSX
	- Use newer versions of FreeType2
	- Get a slightly better error message using automagic
2013-12-08 19:32:32 +01:00

70 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
log() {
echo "[automagic] " $@
}
die() {
log "Fatal: "$@
exit 1
}
if [[ ! -d platform/unix ]]; then
log "Can't find the 'plaform/unix' folder, make sure you run this from the root of the repository."
exit 1
fi
AUTOHEADER=$(which autoheader)
AUTOCONF=$(which autoconf)
LIBTOOLIZE=$(which libtoolize)
ACLOCAL=$(which aclocal)
AUTOMAKE=$(which automake)
[[ -x ${AUTOHEADER} ]] || die "Could not find autoheader. Install autoconf."
[[ -x ${AUTOCONF} ]] || die "Could not find autoconf."
[[ -x ${LIBTOOLIZE} ]] || die "Could not find libtoolize. Install libtool."
[[ -x ${ACLOCAL} ]] || die "Could not find aclocal. Install automake."
[[ -x ${AUTOMAKE} ]] || die "Could not find automake."
automagic() {
log "Copying files..." >&2
cp platform/unix/configure.ac .
cp platform/unix/Makefile.am .
log "Running genmodules..." >&2
if ! bash platform/unix/genmodules "$1"; then
echo "You should be doing this from the root directory of the project."
exit 1
fi
log "Running autoheader..." >&2
${AUTOHEADER} 2>&1 || return 1 # Gimmie config.h.in
log "Running libtoolize..." >&2
${LIBTOOLIZE} --force 2>&1 || return 1
log "Running aclocal..." >&2
${ACLOCAL} 2>&1 || return 1
log "Running autoconf..." >&2
${AUTOCONF} 2>&1 || return 1
log "Running automake..." >&2
${AUTOMAKE} -a 2>&1 || return 1
}
if [[ $1 == "-d" ]]; then
shift 1
automagic "$@" 2>&1
else
(automagic "$@" > /dev/null) 2>&1
fi
if [[ $? -eq 1 ]]; then
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)"
exit 1
else
log "Success, carry on configuring."
fi