Skip to content

Commit

Permalink
makefile: enable db compression for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
shagu committed May 15, 2018
1 parent f68a463 commit db53382
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
VERSION = $(shell git describe --abbrev=0 --tags)

all: clean enUS koKR frFR deDE zhCN esES ruRU noLoc
all: clean stripdb enUS koKR frFR deDE zhCN esES ruRU noLoc

clean:
rm -rfv release

stripdb:
toolbox/compressdb.sh

enUS koKR frFR deDE zhCN esES ruRU:
@echo "===== building $@ ====="
mkdir -p release/$@/pfQuest/db
Expand Down
36 changes: 36 additions & 0 deletions toolbox/compressdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
function compress() {
if ! [ -f $1 ]; then return; fi

if ! [ "$2" = "nc" ]; then
sed 's/ --.*//g' -i $1
fi

sed 's/ //g' -i $1

if [ "$2" = "ws" ]; then
# even remove single whitespaces
sed 's/ //g' -i $1
fi

sed 's/ = /=/g' -i $1
tr -d '\n' < $1 > /tmp/$(basename $1)
mv /tmp/$(basename $1) $1
}

echo "===== compressing DB ====="
echo "-> database"
compress db/items.lua ws
compress db/objects.lua ws
compress db/units.lua ws
compress db/quests.lua ws

echo "-> locales"
for loc in db/*/; do
compress $loc/items.lua
compress $loc/objects.lua
compress $loc/professions.lua
compress $loc/quests.lua nc
compress $loc/units.lua
compress $loc/zones.lua
done

0 comments on commit db53382

Please sign in to comment.