1
0
forked from 0ad/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:
Ralph Sennhauser 2024-08-25 11:55:44 +02:00
parent c763c010b8
commit abdda50892
16 changed files with 788 additions and 816 deletions

View File

@ -61,7 +61,6 @@ fi
popd
if [ "$build_toolchain" = "true" ]; then
rm -r $TOOLCHAIN || true
@ -88,7 +87,7 @@ if [ "$build_boost" = "true" ]; then
rm -rf temp/MysticTreeGames-Boost-for-Android-70838fc
tar xvf files/MysticTreeGames-Boost-for-Android-70838fc.tar.gz -C temp/
cp files/boost_1_45_0.tar.bz2 temp/MysticTreeGames-Boost-for-Android-70838fc/
patch temp/MysticTreeGames-Boost-for-Android-70838fc/build-android.sh < boost-android-build.patch
patch temp/MysticTreeGames-Boost-for-Android-70838fc/build-android.sh <boost-android-build.patch
pushd temp/MysticTreeGames-Boost-for-Android-70838fc
./build-android.sh $TOOLCHAIN
cp -rv build/{include,lib} $SYSROOT/usr/local/
@ -128,7 +127,7 @@ fi
if [ "$build_libxml2" = "true" ]; then
rm -rf temp/libxml2-2.7.8
tar xvf files/libxml2-2.7.8.tar.gz -C temp/
patch temp/libxml2-2.7.8/Makefile.in < libxml2-android-build.patch
patch temp/libxml2-2.7.8/Makefile.in <libxml2-android-build.patch
pushd temp/libxml2-2.7.8
./configure --host=arm-linux-eabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS"
make $JOBS
@ -149,7 +148,7 @@ fi
if [ "$build_js185" = "true" ]; then
rm -rf temp/js-1.8.5
tar xvf files/js185-1.0.0.tar.gz -C temp/
patch temp/js-1.8.5/js/src/assembler/wtf/Platform.h < js185-android-build.patch
patch temp/js-1.8.5/js/src/assembler/wtf/Platform.h <js185-android-build.patch
pushd temp/js-1.8.5/js/src
CXXFLAGS="-I $TOOLCHAIN/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi" \
HOST_CXXFLAGS="-DFORCE_LITTLE_ENDIAN" \

View File

@ -17,7 +17,10 @@ for APPDIR in ../workspaces/gcc/obj/*; do
fi
done
(cd ../../binaries/system/; ./test_dbg)
(
cd ../../binaries/system/
./test_dbg
)
for APPDIR in ../workspaces/gcc/obj/*; do
lcov -d "$APPDIR" -b ../workspaces/gcc --capture -o temp.info &&
@ -30,4 +33,7 @@ lcov -r app.info '*/third_party/*' -o app.info
rm -rf output
mkdir output
(cd output; genhtml ../app.info)
(
cd output
genhtml ../app.info
)

View File

@ -0,0 +1 @@
premake-5-alpha-14+wildfiregames.1

View File

@ -3,8 +3,7 @@ set -e
LIB_VERSION="premake-5-alpha-14+wildfiregames.1"
if [ -e .already-built ] && [ "$(cat .already-built)" = "${LIB_VERSION}" ]
then
if [ -e .already-built ] && [ "$(cat .already-built)" = "${LIB_VERSION}" ]; then
echo "Premake 5 is already up to date."
exit
fi
@ -20,16 +19,16 @@ echo
PREMAKE_BUILD_DIR=premake5/build/gmake2.unix
# BSD and OS X need different Makefiles
case "$OS" in
"GNU/kFreeBSD" )
"GNU/kFreeBSD")
# use default gmake2.unix (needs -ldl as we have a GNU userland and libc)
;;
*"BSD" )
*"BSD")
PREMAKE_BUILD_DIR=premake5/build/gmake2.bsd
;;
"Darwin" )
"Darwin")
PREMAKE_BUILD_DIR=premake5/build/gmake2.macosx
;;
esac
${MAKE} -C "${PREMAKE_BUILD_DIR}" "${JOBS}" CFLAGS="$CFLAGS" config=release
echo "${LIB_VERSION}" > .already-built
echo "${LIB_VERSION}" >.already-built

View File

@ -1,7 +1,7 @@
#!/bin/sh
pyrogenesis=$(which pyrogenesis 2> /dev/null)
if [ -x "$pyrogenesis" ] ; then
pyrogenesis=$(which pyrogenesis 2>/dev/null)
if [ -x "$pyrogenesis" ]; then
"$pyrogenesis" "$@"
else
echo "Error: pyrogenesis not found in ($PATH)"

View File

@ -16,10 +16,10 @@ 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" )
"FreeBSD" | "OpenBSD")
MAKE=${MAKE:="gmake"}
;;
* )
*)
MAKE=${MAKE:="make"}
;;
esac
@ -35,15 +35,14 @@ enable_atlas=true
JOBS=${JOBS:="-j2"}
for i in "$@"
do
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 ;;
--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" ;;
--*) premake_args="${premake_args} $i" ;;
esac
done
@ -56,8 +55,7 @@ if [ "$enable_atlas" = "true" ]; then
export WX_CONFIG="${WX_CONFIG:="wx-config"}"
fi
if [ ! -x "$(command -v $WX_CONFIG)" ]
then
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

View File

@ -100,7 +100,7 @@ ARCHLESS_LDFLAGS="$LDFLAGS -stdlib=libc++"
# If ARCH isn't set, select either x86_64 or arm64
if [ -z "${ARCH}" ]; then
ARCH=`uname -m`
ARCH=$(uname -m)
fi
if [ $ARCH == "arm64" ]; then
# Some libs want this passed to configure for cross compilation.
@ -146,18 +146,17 @@ already_built()
}
# Check that we're actually on macOS
if [ "`uname -s`" != "Darwin" ]; then
if [ "$(uname -s)" != "Darwin" ]; then
die "This script is intended for macOS only"
fi
# Parse command-line options:
force_rebuild=false
for i in "$@"
do
for i in "$@"; do
case $i in
--force-rebuild ) force_rebuild=true;;
-j* ) JOBS=$i ;;
--force-rebuild) force_rebuild=true ;;
-j*) JOBS=$i ;;
esac
done
@ -165,10 +164,9 @@ cd "$(dirname $0)" # Now in libraries/ (where we assume this script resides)
mkdir -p macos
cd macos
# Create a location to create copies of dependencies' *.pc files, so they can be found by pkg-config
PC_PATH="$(pwd)/pkgconfig/"
if [[ "$force_rebuild" = "true" ]]; then
if [[ $force_rebuild == "true" ]]; then
rm -rf $PC_PATH
fi
mkdir -p $PC_PATH
@ -182,12 +180,11 @@ LIB_DIRECTORY=$LIB_VERSION
LIB_URL="https://zlib.net/fossils/"
mkdir -p zlib
pushd zlib > /dev/null
pushd zlib >/dev/null
ZLIB_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
rm -f .already-built
download_lib $LIB_URL $LIB_ARCHIVE
@ -196,19 +193,19 @@ then
pushd $LIB_DIRECTORY
# patch zlib's configure script to use our CFLAGS and LDFLAGS
(patch -Np0 -i ../../../macos-patches/zlib_flags.diff \
&& CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
(patch -Np0 -i ../../../macos-patches/zlib_flags.diff &&
CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
./configure --prefix="$ZLIB_DIR" \
--static \
&& make ${JOBS} && make install) || die "zlib build failed"
--static &&
make ${JOBS} && make install) || die "zlib build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libcurl..."
@ -219,10 +216,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://curl.haxx.se/download/"
mkdir -p libcurl
pushd libcurl > /dev/null
pushd libcurl >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -258,16 +254,16 @@ then
--disable-ldaps \
--without-libidn2 \
--with-zlib="${ZLIB_DIR}" \
--enable-shared=no \
&& make ${JOBS} && make install) || die "libcurl build failed"
--enable-shared=no &&
make ${JOBS} && make install) || die "libcurl build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libiconv..."
@ -278,12 +274,11 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://ftp.gnu.org/pub/gnu/libiconv/"
mkdir -p iconv
pushd iconv > /dev/null
pushd iconv >/dev/null
ICONV_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
rm -f .already-built
download_lib $LIB_URL $LIB_ARCHIVE
@ -297,14 +292,14 @@ then
--without-libiconv-prefix \
--without-libintl-prefix \
--disable-nls \
--enable-shared=no \
&& make ${JOBS} && make install) || die "libiconv build failed"
--enable-shared=no &&
make ${JOBS} && make install) || die "libiconv build failed"
popd
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libxml2..."
@ -315,10 +310,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="ftp://xmlsoft.org/libxml2/"
mkdir -p libxml2
pushd libxml2 > /dev/null
pushd libxml2 >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -335,16 +329,16 @@ then
--without-python \
--with-iconv="${ICONV_DIR}" \
--with-zlib="${ZLIB_DIR}" \
--enable-shared=no \
&& make ${JOBS} && make install) || die "libxml2 build failed"
--enable-shared=no &&
make ${JOBS} && make install) || die "libxml2 build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
@ -356,10 +350,9 @@ LIB_DIRECTORY=$LIB_VERSION
LIB_URL="https://libsdl.org/release/"
mkdir -p sdl2
pushd sdl2 > /dev/null
pushd sdl2 >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -379,16 +372,16 @@ then
--disable-video-x11 \
--without-x \
--enable-video-cocoa \
--enable-shared=no \
&& make $JOBS && make install) || die "SDL2 build failed"
--enable-shared=no &&
make $JOBS && make install) || die "SDL2 build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building Boost..."
@ -399,10 +392,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/"
mkdir -p boost
pushd boost > /dev/null
pushd boost >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -413,9 +405,10 @@ then
pushd $LIB_DIRECTORY
# Can't use macosx-version, see above comment.
(./bootstrap.sh --with-libraries=filesystem,system \
--prefix=$INSTALL_DIR \
&& ./b2 cflags="$CFLAGS" \
(
./bootstrap.sh --with-libraries=filesystem,system \
--prefix=$INSTALL_DIR &&
./b2 cflags="$CFLAGS" \
toolset=clang \
cxxflags="$CXXFLAGS" \
linkflags="$LDFLAGS" ${JOBS} \
@ -424,15 +417,15 @@ then
--debug-configuration \
link=static \
threading=multi \
variant=release install \
variant=release install
) || die "Boost build failed"
popd
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
# TODO: This build takes ages, anything we can exclude?
@ -444,10 +437,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/"
mkdir -p wxwidgets
pushd wxwidgets > /dev/null
pushd wxwidgets >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -486,15 +478,15 @@ then
(../configure CFLAGS="$ARCHLESS_CFLAGS" \
CXXFLAGS="$ARCHLESS_CXXFLAGS" \
CPPFLAGS="-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" \
LDFLAGS="$ARCHLESS_LDFLAGS" $CONF_OPTS \
&& make ${JOBS} && make install) || die "wxWidgets build failed"
LDFLAGS="$ARCHLESS_LDFLAGS" $CONF_OPTS &&
make ${JOBS} && make install) || die "wxWidgets build failed"
popd
popd
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libpng..."
@ -505,10 +497,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://download.sourceforge.net/libpng/"
mkdir -p libpng
pushd libpng > /dev/null
pushd libpng >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -519,19 +510,19 @@ then
pushd $LIB_DIRECTORY
# libpng has no flags for zlib but the 10.12 version is too old, so link our own.
(./configure CFLAGS="$CFLAGS" CPPFLAGS=" -I $ZLIB_DIR/include "\
(./configure CFLAGS="$CFLAGS" CPPFLAGS=" -I $ZLIB_DIR/include " \
LDFLAGS="$LDFLAGS -L$ZLIB_DIR/lib" \
--prefix=$INSTALL_DIR \
--enable-shared=no \
&& make ${JOBS} && make install) || die "libpng build failed"
--enable-shared=no &&
make ${JOBS} && make install) || die "libpng build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building freetype..."
@ -542,10 +533,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://download.savannah.gnu.org/releases/freetype/"
mkdir -p freetype
pushd freetype > /dev/null
pushd freetype >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -561,15 +551,15 @@ then
--enable-shared=no \
--with-harfbuzz=no \
--with-bzip2=no \
--with-brotli=no \
&& make ${JOBS} && make install) || die "freetype build failed"
--with-brotli=no &&
make ${JOBS} && make install) || die "freetype build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
# Dependency of vorbis
@ -581,11 +571,10 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://downloads.xiph.org/releases/ogg/"
mkdir -p libogg
pushd libogg > /dev/null
pushd libogg >/dev/null
OGG_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
rm -f .already-built
download_lib $LIB_URL $LIB_ARCHIVE
@ -596,16 +585,16 @@ then
(./configure CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
--prefix=$OGG_DIR \
--enable-shared=no \
&& make ${JOBS} && make install) || die "libogg build failed"
--enable-shared=no &&
make ${JOBS} && make install) || die "libogg build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libvorbis..."
@ -616,10 +605,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://downloads.xiph.org/releases/vorbis/"
mkdir -p vorbis
pushd vorbis > /dev/null
pushd vorbis >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -633,16 +621,16 @@ then
LDFLAGS="$LDFLAGS" \
--prefix="$INSTALL_DIR" \
--enable-shared=no \
--with-ogg="$OGG_DIR" \
&& make ${JOBS} && make install) || die "libvorbis build failed"
--with-ogg="$OGG_DIR" &&
make ${JOBS} && make install) || die "libvorbis build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building GMP..."
@ -653,12 +641,11 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://gmplib.org/download/gmp/"
mkdir -p gmp
pushd gmp > /dev/null
pushd gmp >/dev/null
GMP_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -677,16 +664,16 @@ then
--prefix="$INSTALL_DIR" \
--enable-fat \
--disable-shared \
--with-pic \
&& make ${JOBS} && make install) || die "GMP build failed"
--with-pic &&
make ${JOBS} && make install) || die "GMP build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building Nettle..."
@ -698,12 +685,11 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://ftp.gnu.org/gnu/nettle/"
mkdir -p nettle
pushd nettle > /dev/null
pushd nettle >/dev/null
NETTLE_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -725,16 +711,16 @@ then
--disable-shared \
--disable-documentation \
--disable-openssl \
--disable-assembler \
&& make ${JOBS} && make install) || die "Nettle build failed"
--disable-assembler &&
make ${JOBS} && make install) || die "Nettle build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building GnuTLS..."
@ -745,12 +731,11 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/"
mkdir -p gnutls
pushd gnutls > /dev/null
pushd gnutls >/dev/null
GNUTLS_DIR="$(pwd)"
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -762,8 +747,8 @@ then
# Patch GNUTLS for a linking issue with isdigit
# Patch by Ross Nicholson: https://gitlab.com/gnutls/gnutls/-/issues/1033#note_379529145
(patch -Np1 -i ../../../macos-patches/03-undo-libtasn1-cisdigit.patch \
&& ./configure CFLAGS="$CFLAGS" \
(patch -Np1 -i ../../../macos-patches/03-undo-libtasn1-cisdigit.patch &&
./configure CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \
LDFLAGS="$LDFLAGS" \
LIBS="-L${GMP_DIR}/lib -lgmp" \
@ -784,16 +769,16 @@ then
--disable-guile \
--disable-doc \
--disable-tools \
--disable-nls \
&& make ${JOBS} LDFLAGS= install) || die "GnuTLS build failed"
--disable-nls &&
make ${JOBS} LDFLAGS= install) || die "GnuTLS build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building gloox..."
@ -804,10 +789,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://camaya.net/download/"
mkdir -p gloox
pushd gloox > /dev/null
pushd gloox >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -832,16 +816,16 @@ then
--without-openssl \
--without-tests \
--without-examples \
--disable-getaddrinfo \
&& make ${JOBS} && make install) || die "gloox build failed"
--disable-getaddrinfo &&
make ${JOBS} && make install) || die "gloox build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building ICU..."
@ -852,10 +836,9 @@ LIB_DIRECTORY="icu"
LIB_URL="https://github.com/unicode-org/icu/releases/download/release-69-1/"
mkdir -p icu
pushd icu > /dev/null
pushd icu >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -877,17 +860,17 @@ then
--disable-samples \
--enable-extras \
--enable-icuio \
--enable-tools \
&& make ${JOBS} && make install) || die "ICU build failed"
--enable-tools &&
make ${JOBS} && make install) || die "ICU build failed"
popd
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building ENet..."
@ -898,10 +881,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://enet.bespin.org/download/"
mkdir -p enet
pushd enet > /dev/null
pushd enet >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -914,16 +896,16 @@ then
(./configure CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
--prefix=${INSTALL_DIR} \
--enable-shared=no \
&& make clean && make ${JOBS} && make install) || die "ENet build failed"
--enable-shared=no &&
make clean && make ${JOBS} && make install) || die "ENet build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building MiniUPnPc..."
@ -934,10 +916,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://miniupnp.tuxfamily.org/files/download.php?file="
mkdir -p miniupnpc
pushd miniupnpc > /dev/null
pushd miniupnpc >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -947,20 +928,21 @@ then
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY
(make clean \
&& CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} \
&& INSTALLPREFIX="$INSTALL_DIR" make install \
(
make clean &&
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} &&
INSTALLPREFIX="$INSTALL_DIR" make install
) || die "MiniUPnPc build failed"
popd
# TODO: how can we not build the dylibs?
rm -f lib/*.dylib
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building libsodium..."
@ -971,10 +953,9 @@ LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="https://download.libsodium.org/libsodium/releases/"
mkdir -p libsodium
pushd libsodium > /dev/null
pushd libsodium >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -984,23 +965,24 @@ then
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY
(./configure CFLAGS="$CFLAGS" \
(
./configure CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
--prefix=${INSTALL_DIR} \
--enable-shared=no \
&& make clean \
&& CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} \
&& make check \
&& INSTALLPREFIX="$INSTALL_DIR" make install \
--enable-shared=no &&
make clean &&
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} &&
make check &&
INSTALLPREFIX="$INSTALL_DIR" make install
) || die "libsodium build failed"
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$LIB_VERSION" > .already-built
echo "$LIB_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building fmt..."
@ -1010,10 +992,9 @@ LIB_ARCHIVE="$FMT_VERSION.tar.gz"
LIB_URL="https://github.com/fmtlib/fmt/archive/"
mkdir -p fmt
pushd fmt > /dev/null
pushd fmt >/dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$FMT_VERSION" ]]
then
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$FMT_VERSION" ]]; then
INSTALL_DIR="$(pwd)"
rm -f .already-built
@ -1033,17 +1014,17 @@ then
-DFMT_TEST=False \
-DFMT_DOC=False \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
$CMAKE_FLAGS \
&& make fmt ${JOBS} && make install) || die "fmt build failed"
$CMAKE_FLAGS &&
make fmt ${JOBS} && make install) || die "fmt build failed"
popd
popd
cp -f lib/pkgconfig/* $PC_PATH
echo "$FMT_VERSION" > .already-built
echo "$FMT_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
echo -e "Building Molten VK..."
@ -1052,9 +1033,8 @@ LIB_ARCHIVE="MoltenVK-$MOLTENVK_VERSION.tar.gz"
LIB_URL="https://releases.wildfiregames.com/libs/"
mkdir -p "molten-vk"
pushd "molten-vk" > /dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$MOLTENVK_VERSION" ]] || [[ ! -e ../../../binaries/system/libMoltenVK.dylib ]]
then
pushd "molten-vk" >/dev/null
if [[ $force_rebuild == "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$MOLTENVK_VERSION" ]] || [[ ! -e ../../../binaries/system/libMoltenVK.dylib ]]; then
INSTALL_DIR="../../../../binaries/system/"
rm -f .already-built
download_lib $LIB_URL $LIB_ARCHIVE
@ -1065,12 +1045,12 @@ then
# Use mv instead of copy to preserve binary signature integrity. See:
# https://developer.apple.com/forums/thread/130313?answerId=410541022#410541022
mv dylib/libMoltenVK.dylib $INSTALL_DIR
popd > /dev/null
echo "$MOLTENVK_VERSION" > .already-built
popd >/dev/null
echo "$MOLTENVK_VERSION" >.already-built
else
already_built
fi
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------------
# The following libraries are shared on different OSes and may
@ -1079,18 +1059,17 @@ popd > /dev/null
# --------------------------------------------------------------------
if [ -e ../source/.svn ]; then
pushd ../source > /dev/null
pushd ../source >/dev/null
svn cleanup && svn up -r $source_svnrev
popd > /dev/null
popd >/dev/null
else
svn co -r $source_svnrev https://svn.wildfiregames.com/public/source-libs/trunk ../source
fi
# SpiderMonkey - bundled, no download
pushd ../source/spidermonkey/ > /dev/null
pushd ../source/spidermonkey/ >/dev/null
if [[ "$force_rebuild" = "true" ]]
then
if [[ $force_rebuild == "true" ]]; then
rm -f .already-built
fi
@ -1098,32 +1077,30 @@ fi
JOBS="$JOBS" ZLIB_DIR="$ZLIB_DIR" ARCH="$ARCH" ./build.sh || die "Error building spidermonkey"
cp bin/* ../../../binaries/system/
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
# NVTT - bundled, no download
pushd ../source/nvtt > /dev/null
pushd ../source/nvtt >/dev/null
if [[ "$force_rebuild" = "true" ]]
then
if [[ $force_rebuild == "true" ]]; then
rm -f .already-built
fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CMAKE_FLAGS=$CMAKE_FLAGS JOBS="$JOBS" ./build.sh || die "Error building NVTT"
cp bin/* ../../../binaries/system/
popd > /dev/null
popd >/dev/null
# --------------------------------------------------------------
# FCollada - bundled, no download
pushd ../source/fcollada/ > /dev/null
pushd ../source/fcollada/ >/dev/null
if [[ "$force_rebuild" = "true" ]]
then
if [[ $force_rebuild == "true" ]]; then
rm -f .already-built
fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada"
cp bin/* ../../../binaries/system/
popd > /dev/null
popd >/dev/null

View File

@ -10,7 +10,7 @@ die()
# Update this line when you commit an update to source-libs
source_svnrev="28207"
if [ "`uname -s`" = "Darwin" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
echo 'This script should not be used on macOS: use build-macos-libs.sh instead.'
exit 1
fi
@ -21,13 +21,13 @@ cd "$(dirname $0)"
# Check for whitespace in absolute path; this will cause problems in the
# SpiderMonkey build and maybe elsewhere, so we just forbid it
# Use perl as an alternative to readlink -f, which isn't available on BSD
SCRIPTPATH=`perl -MCwd -e 'print Cwd::abs_path shift' "$0"`
SCRIPTPATH=$(perl -MCwd -e 'print Cwd::abs_path shift' "$0")
case "$SCRIPTPATH" in
*\ * )
die "Absolute path contains whitespace, which will break the build - move the game to a path without spaces" ;;
*\ *)
die "Absolute path contains whitespace, which will break the build - move the game to a path without spaces"
;;
esac
# Parse command-line options (download options and build options):
source_libs_dir="source"
@ -37,15 +37,14 @@ with_system_mozjs=false
JOBS=${JOBS:="-j2"}
for i in "$@"
do
for i in "$@"; do
case $i in
--source-libs-dir=* ) source_libs_dir=${1#*=} ;;
--source-libs-dir ) die "correct syntax is --source-libs-dir=/path/to/dir" ;;
--without-nvtt ) without_nvtt=true ;;
--with-system-nvtt ) with_system_nvtt=true ;;
--with-system-mozjs ) with_system_mozjs=true ;;
-j* ) JOBS=$i ;;
--source-libs-dir=*) source_libs_dir=${1#*=} ;;
--source-libs-dir) die "correct syntax is --source-libs-dir=/path/to/dir" ;;
--without-nvtt) without_nvtt=true ;;
--with-system-nvtt) with_system_nvtt=true ;;
--with-system-mozjs) with_system_mozjs=true ;;
-j*) JOBS=$i ;;
esac
done
@ -64,11 +63,11 @@ echo
# Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
# is not set.
case "`uname -s`" in
"FreeBSD" | "OpenBSD" )
case "$(uname -s)" in
"FreeBSD" | "OpenBSD")
MAKE=${MAKE:="gmake"}
;;
* )
*)
MAKE=${MAKE:="make"}
;;
esac

View File

@ -25,18 +25,17 @@ REGEX=".*/\("${REGEX:2}"\)\.[-A-Za-z0-9_.]\+\.po"
find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -v || die "Error filtering languages."
# Build archive(s) - don't archive the _test.* mods
pushd binaries/data/mods > /dev/null
pushd binaries/data/mods >/dev/null
archives=""
ONLY_MOD="${ONLY_MOD:=false}"
if [ "${ONLY_MOD}" = true ]; then
archives="mod"
else
for modname in [a-zA-Z0-9]*
do
for modname in [a-zA-Z0-9]*; do
archives="${archives} ${modname}"
done
fi
popd > /dev/null
popd >/dev/null
BUILD_SHADERS="${BUILD_SHADERS:=true}"
if [ "${BUILD_SHADERS}" = true ]; then
@ -48,35 +47,31 @@ if [ "${BUILD_SHADERS}" = true ]; then
[ -n "${GLSLC}" ] || die "Error: glslc is not available. Install it with the Vulkan SDK before proceeding."
[ -n "${SPIRV_REFLECT}" ] || die "Error: spirv-reflect is not available. Install it with the Vulkan SDK before proceeding."
pushd "source/tools/spirv" > /dev/null
pushd "source/tools/spirv" >/dev/null
ENGINE_VERSION=${ENGINE_VERSION:="0.0.xx"}
rulesFile="rules.${ENGINE_VERSION}.json"
if [ ! -e "$rulesFile" ]
then
if [ ! -e "$rulesFile" ]; then
# The rules.json file should be present in release tarballs, for
# some Linux CIs don't have access to the internet.
download="$(command -v wget || echo "curl -sLo ""${rulesFile}""")"
$download "https://releases.wildfiregames.com/spir-v/$rulesFile"
fi
for modname in $archives
do
for modname in $archives; do
modLocation="../../../binaries/data/mods/${modname}"
if [ -e "${modLocation}/shaders/spirv/" ]
then
if [ -e "${modLocation}/shaders/spirv/" ]; then
echo "Removing existing spirv shaders for '${modname}'..."
rm -rf "${modLocation}/shaders/spirv"
fi
echo "Building shader for '${modname}'..."
$PYTHON compile.py "$modLocation" "$rulesFile" "$modLocation" --dependency "../../../binaries/data/mods/mod/"
done
popd > /dev/null
popd >/dev/null
fi
for modname in $archives
do
for modname in $archives; do
echo "Building archive for '${modname}'..."
ARCHIVEBUILD_INPUT="binaries/data/mods/${modname}"
ARCHIVEBUILD_OUTPUT="archives/${modname}"
@ -84,5 +79,5 @@ do
mkdir -p "${ARCHIVEBUILD_OUTPUT}"
(./binaries/system/pyrogenesis -mod=mod -archivebuild="${ARCHIVEBUILD_INPUT}" -archivebuild-output="${ARCHIVEBUILD_OUTPUT}/${modname}.zip") || die "Archive build for '${modname}' failed!"
cp "${ARCHIVEBUILD_INPUT}/mod.json" "${ARCHIVEBUILD_OUTPUT}" &> /dev/null || true
cp "${ARCHIVEBUILD_INPUT}/mod.json" "${ARCHIVEBUILD_OUTPUT}" &>/dev/null || true
done

View File

@ -18,7 +18,7 @@ die()
}
# Check that we're actually on OS X
if [ "`uname -s`" != "Darwin" ]; then
if [ "$(uname -s)" != "Darwin" ]; then
die "This script is intended for OS X only"
fi
@ -46,10 +46,10 @@ fi
# Build libraries against SDK
echo "\nBuilding libraries\n"
pushd ../../libraries/osx > /dev/null
pushd ../../libraries/osx >/dev/null
SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
./build-osx-libs.sh $JOBS "${BUILD_LIBS_ARGS}" || die "Libraries build script failed"
popd > /dev/null
popd >/dev/null
# Update workspaces
echo "\nGenerating workspaces\n"
@ -58,13 +58,13 @@ echo "\nGenerating workspaces\n"
(SYSROOT="${SYSROOT}" MIN_OSX_VERSION="${MIN_OSX_VERSION}" \
./update-workspaces.sh --sysroot="${SYSROOT}" --macosx-version-min="${MIN_OSX_VERSION}") || die "update-workspaces.sh failed!"
pushd gcc > /dev/null
pushd gcc >/dev/null
echo "\nBuilding game\n"
(make clean && CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" make ${JOBS}) || die "Game build failed!"
popd > /dev/null
popd >/dev/null
# Run test to confirm all is OK
pushd ../../binaries/system > /dev/null
pushd ../../binaries/system >/dev/null
echo "\nRunning tests\n"
./test || die "Post-build testing failed!"
popd > /dev/null
popd >/dev/null

View File

@ -8,4 +8,3 @@ fi
input_directory=$1
# perform work
find $input_directory -name \*.xml -exec xsltproc -o {} templatessorter.xsl {} \;

View File

@ -13,8 +13,7 @@ export TLDIR="$(dirname $(realpath $0))"
# Use semicolons to separate values on Windows.
# If that produces bogus output, you can try with commas instead.
if [ "${OS}" = "Windows_NT" ]
then
if [ "${OS}" = "Windows_NT" ]; then
export TLLOG="Default;IonCompiler"
export TLOPTIONS="EnableMainThread;EnableOffThread;EnableGraph"
else