MultiCraft/build/iOS/assets.sh
2022-02-27 11:33:15 +01:00

58 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -e
if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
echo "Run this in build/iOS"
exit 1
fi
FOLDER=$(pwd)
DEST=$(mktemp -d)
for dir in builtin textures client; do
cp -r ../../$dir $DEST/
done
cp -r deps/irrlicht/shaders $DEST/client/shaders/Irrlicht
mkdir -p $DEST/fonts
cp ../../fonts/MultiCraftFont.ttf $DEST/fonts/ # no PNG fonts because freetype
mkdir -p $DEST/games
cp -r ../../games/default $DEST/games/default
pushd ../../po
for lang in *; do
[ ${#lang} -ne 2 ] && continue
mopath=$DEST/locale/$lang/LC_MESSAGES
mkdir -p $mopath
pushd $lang
for fn in *.po; do
# brew install gettext
msgfmt -o $mopath/${fn/.po/.mo} $fn
done
popd
done
popd
find $DEST -type d -name ".git" -print0 | xargs -0 -- rm -rf
find $DEST -type f -name ".*" -delete
# remove broken languages
for broken_lang in ja ko he; do
find $DEST/locale -type d -name $broken_lang -print0 | xargs -0 -- rm -r
done
# remove inaccessible text files
for name in settingtypes license readme copying; do
find $DEST -type f -iname $name"*" -exec rm -f {} \;
done
echo "Creating assets.zip"
ZIPDEST=$FOLDER/assets.zip
rm -f $ZIPDEST
PASSWORD=$1
if [[ -z "$PASSWORD" ]]; then
PASSWORD="1"
fi
cd $DEST; zip -P $PASSWORD -1r $ZIPDEST -- *
cd $FOLDER; rm -rf $DEST