forked from mirrors/0ad
Format shell scripts using shfmt
This updates shell scripts to use a consistent style that can be enforced via pre-commit hook. As for choosing tabs over spaces, some arguments are: - tabs can help people with visual impairment - tabs allow for indenting heredocs in bash - tabs are the default for the tool shfmt Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
echo "Running as root will mess up file permissions. Aborting ..." 1>&2
|
||||
exit 1
|
||||
echo "Running as root will mess up file permissions. Aborting ..." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
die()
|
||||
{
|
||||
echo ERROR: $*
|
||||
exit 1
|
||||
echo ERROR: $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
OS=${OS:="$(uname -s)"}
|
||||
@@ -16,12 +16,12 @@ OS=${OS:="$(uname -s)"}
|
||||
# Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
|
||||
# is not set.
|
||||
case "$OS" in
|
||||
"FreeBSD" | "OpenBSD" )
|
||||
MAKE=${MAKE:="gmake"}
|
||||
;;
|
||||
* )
|
||||
MAKE=${MAKE:="make"}
|
||||
;;
|
||||
"FreeBSD" | "OpenBSD")
|
||||
MAKE=${MAKE:="gmake"}
|
||||
;;
|
||||
*)
|
||||
MAKE=${MAKE:="make"}
|
||||
;;
|
||||
esac
|
||||
|
||||
cd "$(dirname $0)"
|
||||
@@ -35,37 +35,35 @@ enable_atlas=true
|
||||
|
||||
JOBS=${JOBS:="-j2"}
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--with-system-premake5 ) with_system_premake5=true ;;
|
||||
--enable-atlas ) enable_atlas=true ;;
|
||||
--disable-atlas ) enable_atlas=false ;;
|
||||
-j* ) JOBS=$i ;;
|
||||
# Assume any other --options are for Premake
|
||||
--* ) premake_args="${premake_args} $i" ;;
|
||||
esac
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
--with-system-premake5) with_system_premake5=true ;;
|
||||
--enable-atlas) enable_atlas=true ;;
|
||||
--disable-atlas) enable_atlas=false ;;
|
||||
-j*) JOBS=$i ;;
|
||||
# Assume any other --options are for Premake
|
||||
--*) premake_args="${premake_args} $i" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$enable_atlas" = "true" ]; then
|
||||
premake_args="${premake_args} --atlas"
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
# Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig)
|
||||
export WX_CONFIG="${WX_CONFIG:="$(pwd)/../../libraries/macos/wxwidgets/bin/wx-config"}"
|
||||
else
|
||||
export WX_CONFIG="${WX_CONFIG:="wx-config"}"
|
||||
fi
|
||||
premake_args="${premake_args} --atlas"
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
# Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig)
|
||||
export WX_CONFIG="${WX_CONFIG:="$(pwd)/../../libraries/macos/wxwidgets/bin/wx-config"}"
|
||||
else
|
||||
export WX_CONFIG="${WX_CONFIG:="wx-config"}"
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v $WX_CONFIG)" ]
|
||||
then
|
||||
echo 'WX_CONFIG must be set and valid or wx-config must be present when --atlas is passed as argument.'
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x "$(command -v $WX_CONFIG)" ]; then
|
||||
echo 'WX_CONFIG must be set and valid or wx-config must be present when --atlas is passed as argument.'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
# Set minimal SDK version
|
||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"}
|
||||
# Set minimal SDK version
|
||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"}
|
||||
fi
|
||||
|
||||
# Now build Premake or use system's.
|
||||
@@ -74,10 +72,10 @@ cd ../premake
|
||||
premake_command="premake5"
|
||||
|
||||
if [ "$with_system_premake5" = "false" ]; then
|
||||
# Build bundled premake
|
||||
MAKE=${MAKE} JOBS=${JOBS} ./build.sh || die "Premake 5 build failed"
|
||||
# Build bundled premake
|
||||
MAKE=${MAKE} JOBS=${JOBS} ./build.sh || die "Premake 5 build failed"
|
||||
|
||||
premake_command="premake5/bin/release/premake5"
|
||||
premake_command="premake5/bin/release/premake5"
|
||||
fi
|
||||
|
||||
echo
|
||||
@@ -87,11 +85,11 @@ export HOSTTYPE="$HOSTTYPE"
|
||||
# Now run Premake to create the makefiles
|
||||
echo "Premake args: ${premake_args}"
|
||||
if [ "$OS" != "Darwin" ]; then
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
|
||||
else
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} gmake || die "Premake failed"
|
||||
# Also generate xcode workspaces if on OS X
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/xcode4" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} xcode4 || die "Premake failed"
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} gmake || die "Premake failed"
|
||||
# Also generate xcode workspaces if on OS X
|
||||
${premake_command} --file="premake5.lua" --outpath="../workspaces/xcode4" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} xcode4 || die "Premake failed"
|
||||
fi
|
||||
|
||||
# test_root.cpp gets generated by cxxtestgen and passing different arguments to premake could require a regeneration of this file.
|
||||
|
||||
Reference in New Issue
Block a user