1
0
forked from 0ad/0ad

build-archives.sh: move to posix shell

Convert various no posix constructs and change the shebang to /bin/sh.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-08-28 19:04:16 +02:00
parent 8ed1a0cb5a
commit 1c4a32baa4

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
set -e set -e
die() die()
@ -17,15 +17,16 @@ echo "Filtering languages"
# CJK languages are excluded, as they are in mods. # CJK languages are excluded, as they are in mods.
# Note: Needs to be edited manually at each release. # Note: Needs to be edited manually at each release.
# Keep in sync with the installer languages in 0ad.nsi. # Keep in sync with the installer languages in 0ad.nsi.
LANGS=("ast" "ca" "cs" "de" "el" "en_GB" "es" "eu" "fi" "fr" "gd" "hu" "id" "it" "nl" "pl" "pt_BR" "ru" "sk" "sv" "tr" "uk") LANGS="ast ca cs de el en_GB es eu fi fr gd hu id it nl pl pt_BR ru sk sv tr uk"
REGEX=$(printf "\|%s" "${LANGS[@]}") # shellcheck disable=SC2086
REGEX=".*/\(${REGEX:2}\)\.[-A-Za-z0-9_.]\+\.po" REGEX=$(printf "\|%s" ${LANGS} | cut -c 2-)
REGEX=".*/\(${REGEX}\)\.[-A-Za-z0-9_.]\+\.po"
find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -v || die "Error filtering languages." find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -v || die "Error filtering languages."
# Build archive(s) - don't archive the _test.* mods # Build archive(s) - don't archive the _test.* mods
pushd binaries/data/mods >/dev/null cd binaries/data/mods || die
archives="" archives=""
ONLY_MOD="${ONLY_MOD:=false}" ONLY_MOD="${ONLY_MOD:=false}"
if [ "${ONLY_MOD}" = true ]; then if [ "${ONLY_MOD}" = true ]; then
@ -35,7 +36,7 @@ else
archives="${archives} ${modname}" archives="${archives} ${modname}"
done done
fi fi
popd >/dev/null cd - || die
BUILD_SHADERS="${BUILD_SHADERS:=true}" BUILD_SHADERS="${BUILD_SHADERS:=true}"
if [ "${BUILD_SHADERS}" = true ]; then if [ "${BUILD_SHADERS}" = true ]; then
@ -47,7 +48,7 @@ if [ "${BUILD_SHADERS}" = true ]; then
[ -n "${GLSLC}" ] || die "Error: glslc is not available. Install it with the Vulkan SDK before proceeding." [ -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." [ -n "${SPIRV_REFLECT}" ] || die "Error: spirv-reflect is not available. Install it with the Vulkan SDK before proceeding."
pushd "source/tools/spirv" >/dev/null cd source/tools/spirv || die
ENGINE_VERSION=${ENGINE_VERSION:="0.0.xx"} ENGINE_VERSION=${ENGINE_VERSION:="0.0.xx"}
rulesFile="rules.${ENGINE_VERSION}.json" rulesFile="rules.${ENGINE_VERSION}.json"
@ -68,7 +69,7 @@ if [ "${BUILD_SHADERS}" = true ]; then
echo "Building shader for '${modname}'..." echo "Building shader for '${modname}'..."
$PYTHON compile.py "$modLocation" "$rulesFile" "$modLocation" --dependency "../../../binaries/data/mods/mod/" $PYTHON compile.py "$modLocation" "$rulesFile" "$modLocation" --dependency "../../../binaries/data/mods/mod/"
done done
popd >/dev/null cd - || die
fi fi
for modname in $archives; do for modname in $archives; do
@ -79,5 +80,5 @@ for modname in $archives; do
mkdir -p "${ARCHIVEBUILD_OUTPUT}" mkdir -p "${ARCHIVEBUILD_OUTPUT}"
(./binaries/system/pyrogenesis -mod=mod -archivebuild="${ARCHIVEBUILD_INPUT}" -archivebuild-output="${ARCHIVEBUILD_OUTPUT}/${modname}.zip") || die "Archive build for '${modname}' failed!" (./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 2>&1 || true
done done