Add variable for doing out-of-tree builds.

Normally we run ./configure from within the build tree, but autotools
now allows doing out-of-tree builds by running configure while cd'ed
to a different directory. Add a config variable `AUTOTOOLS_BUILD_PATH`
to allow this on a per-package basis, and set this for the SDL2
package; SDL2 hg complains when doing in-tree builds because certain
files get clobbered.
This commit is contained in:
Simon Howard 2016-07-17 22:50:53 -04:00
parent 24650af7d9
commit e68dca04e0
2 changed files with 14 additions and 1 deletions

View File

@ -34,7 +34,13 @@ do_build() {
autoreconf -fi
fi
./configure --prefix="$PACKAGE_INSTALL_DIR" $host_opt \
local configure_path="$PWD/configure"
if [ ! -z "${AUTOTOOLS_BUILD_PATH:-}" ]; then
mkdir -p "$AUTOTOOLS_BUILD_PATH"
cd "$AUTOTOOLS_BUILD_PATH"
fi
"$configure_path" --prefix="$PACKAGE_INSTALL_DIR" $host_opt \
$PACKAGE_CONFIGURE_OPTS || (
error_exit "Failed to configure package $PACKAGE_NAME for build."
)
@ -47,6 +53,10 @@ do_build() {
# Function encapsulating the "make install" step which should work for
# most autotools-based packages, but can be overridden by packages.
do_install() {
if [ ! -z "${AUTOTOOLS_BUILD_PATH:-}" ]; then
cd "$AUTOTOOLS_BUILD_PATH"
fi
make install || (
error_exit "Failed to install package $PACKAGE_NAME."
)

View File

@ -20,4 +20,7 @@ if [ $(uname) = "Cygwin" ] || [[ "$BUILD_HOST" = *mingw* ]]; then
config_options+=" --disable-directx"
fi
# For SDL, we do an out-of-tree build in a subdirectory, since the configure
# script can complain otherwise.
AUTOTOOLS_BUILD_PATH=build-artifacts
build_autotools $config_options