Improved scripts to build drules, symbols and styles

This commit is contained in:
Constantin Shalnev 2015-06-04 20:20:05 +03:00 committed by Alex Zolotarev
parent b829165bd2
commit 61b0af91c4
3 changed files with 140 additions and 52 deletions

View file

@ -1,5 +1,36 @@
echo "Build drawing rules light"
python ../kothic/libkomwm.py -s ../../data/styles/normal_light.mapcss -o ../../data/drules_proto
#!/bin/bash
set -e -u -x
echo "Build drawing rules dark"
python ../kothic/libkomwm.py -s ../../data/styles/normal_dark.mapcss -o ../../data/drules_proto_dark
function BuildDrawingRules() {
styleName=$1
suffix=$2
echo "Building drawing rules for style $styleName"
# Cleanup
rm ../../data/drules_proto$suffix.bin || true
rm ../../data/drules_proto$suffix.txt || true
# Run script to build style
python ../kothic/libkomwm.py -s ../../data/styles/style-$styleName/style.mapcss \
-o ../../data/drules_proto$suffix
res=$?
# Check result
if [ $res -ne 0 ]; then
echo "Error"
exit 1 # error
fi
}
# Cleanup
cleanup=(classificator.txt types.txt visibility.txt)
for item in ${cleanup[*]}
do
rm ../../data/$item || true
done
# Building drawing rules light
BuildDrawingRules light ""
# Building drawing rules dark
BuildDrawingRules dark "_dark"
echo "Done"
exit 0 # ok

19
tools/unix/generate_styles.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set -e -u -x
MY_PATH=`pwd`
sh ./generate_symbols.sh
if [ $? -ne 0 ]; then
echo "Error"
exit 1 # error
fi
sh ./generate_drules.sh
if [ $? -ne 0 ]; then
echo "Error"
exit 1 # error
fi
echo "Done"
exit 0 # ok

View file

@ -1,59 +1,97 @@
#!/bin/bash
set -e -u -x
MY_PATH=`pwd`
BINARY_PATH="$MY_PATH/../../../build-omim/out/debug/skin_generator"
BINARY_PATH="$MY_PATH/../../out/release/skin_generator"
DATA_PATH="$MY_PATH/../../data"
STYLES_PATH="$DATA_PATH/styles"
PNG_PATH="$DATA_PATH/styles/symbols/png"
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/yota" $PNG_PATH
# If skin_generator does not exist then build it
if [ ! -f $BINARY_PATH ];
then
projects=(freetype gflags)
for project in ${projects[*]}
do
cd $MY_PATH/../../3party/$project
qmake $project.pro -r -spec macx-clang CONFIG+=x86_64
make
done
projects=(base coding geometry skin_generator)
for project in ${projects[*]}
do
cd $MY_PATH/../../$project
qmake $project.pro -r -spec macx-clang CONFIG+=x86_64
make
done
cd $MY_PATH
fi
"$BINARY_PATH" --symbolWidth 19 --symbolHeight 19 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-yota/basic" --skinSuffix="" \
--colorCorrection true
# Helper function to build skin
# Parameter $1 - style name (dark, light, yota, ...)
# Parameter $2 - resource name (ldpi, mdpi, hdpi, ...)
# Parameter $3 - symbol size
# Parameter $4 - does color correction required
function BuildSkin() {
styleName=$1
resourceName=$2
symbolSize=$3
colorCorrection=$4
suffix=$5
echo "Building skin for $styleName/$resourceName"
# Set environment
PNG_PATH="$DATA_PATH/styles/style-$styleName/symbols/png"
rm -r $PNG_PATH || true
ln -s "$DATA_PATH/styles/style-$styleName/$resourceName" $PNG_PATH
# Run sking generator
if [ $colorCorrection = "true" ];
then
"$BINARY_PATH" --symbolWidth $symbolSize --symbolHeight $symbolSize \
--symbolsDir "$DATA_PATH/styles/style-$styleName/symbols" \
--skinName "$DATA_PATH/resources-$resourceName$suffix/basic" --skinSuffix="" \
--colorCorrection true
else
"$BINARY_PATH" --symbolWidth $symbolSize --symbolHeight $symbolSize \
--symbolsDir "$DATA_PATH/styles/style-$styleName/symbols" \
--skinName "$DATA_PATH/resources-$resourceName$suffix/basic" --skinSuffix=""
fi
res=$?
# Reset environment
rm -r $PNG_PATH || true
# Check result
if [ $res -ne 0 ];
then
echo "Error"
exit 1 # error
fi
}
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/ldpi" $PNG_PATH
# Cleanup
cleanup=(resources-yota resources-6plus resources-ldpi resources-mdpi resources-hdpi resources-xhdpi resources-xxhdpi \
resources-6plus_dark resources-ldpi_dark resources-mdpi_dark resources-hdpi_dark resources-xhdpi_dark resources-xxhdpi_dark)
for item in ${cleanup[*]}
do
rm -rf ../../data/$item || true
mkdir ../../data/$item
done
"$BINARY_PATH" --symbolWidth 16 --symbolHeight 16 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-ldpi/basic" --skinSuffix=""
# Build style yota
BuildSkin yota yota 19 true ""
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/mdpi" $PNG_PATH
# Build style light
BuildSkin light ldpi 16 false ""
BuildSkin light mdpi 16 false ""
BuildSkin light hdpi 24 false ""
BuildSkin light xhdpi 36 false ""
BuildSkin light xxhdpi 48 false ""
BuildSkin light 6plus 38 false ""
"$BINARY_PATH" --symbolWidth 16 --symbolHeight 16 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-mdpi/basic" --skinSuffix=""
# Build style dark
BuildSkin dark ldpi 16 false "_dark"
BuildSkin dark mdpi 16 false "_dark"
BuildSkin dark hdpi 24 false "_dark"
BuildSkin dark xhdpi 36 false "_dark"
BuildSkin dark xxhdpi 48 false "_dark"
BuildSkin dark 6plus 38 false "_dark"
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/hdpi" $PNG_PATH
"$BINARY_PATH" --symbolWidth 24 --symbolHeight 24 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-hdpi/basic" --skinSuffix=""
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/xhdpi" $PNG_PATH
"$BINARY_PATH" --symbolWidth 36 --symbolHeight 36 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-xhdpi/basic" --skinSuffix=""
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/xxhdpi" $PNG_PATH
"$BINARY_PATH" --symbolWidth 48 --symbolHeight 48 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-xxhdpi/basic" --skinSuffix=""
rm -r $PNG_PATH || true
ln -s "$STYLES_PATH/6plus" $PNG_PATH
"$BINARY_PATH" --symbolWidth 38 --symbolHeight 38 \
--symbolsDir "$DATA_PATH/styles/symbols" \
--skinName "$DATA_PATH/resources-6plus/basic" --skinSuffix=""
rm -r $PNG_PATH || true
# Success
echo "Done"
exit 0 # ok