xwords/xwords4/android/scripts/mkimages.sh

46 lines
838 B
Bash
Raw Normal View History

#!/bin/bash
set -e -u
2017-01-18 16:15:08 +01:00
if [ ! -d img_src ]; then
echo "no img_src; please run from root of source tree"
exit 1
fi
CLEAN=""
2013-12-05 04:42:18 +01:00
usage() {
echo "usage: $0 [--clean]"
exit 1
}
while [ $# -ge 1 ]; do
case $1 in
--clean)
CLEAN=1
;;
*)
usage
;;
esac
shift
done
# There needs to be target in the makefile for each of these (giving
# the output .png size)
TARGET_DIRS="drawable-hdpi drawable-mdpi drawable-xhdpi"
for SVG in img_src/*.svg; do
for DIR in $TARGET_DIRS; do
SVG=$(basename $SVG)
2017-01-18 16:15:08 +01:00
OUT=app/src/main/res/$DIR/${SVG/.svg/__gen.png}
mkdir -p $(dirname $OUT)
if [ -z "$CLEAN" ]; then
2017-01-20 04:05:10 +01:00
make -f $(dirname $0)/images.mk $OUT >/dev/null 2>&1
else
rm -f $OUT
fi
done
done