1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-14 18:14:47 +00:00
ympd/mkrelease.sh
2018-11-19 19:30:59 +00:00

66 lines
3.0 KiB
Bash
Executable File

#/bin/sh
java=$(which java 2> /dev/null)
if [ -f dist/buildtools/closure-compiler.jar ] && [ "$java" != "" ]
then
echo "Minifying javascript"
[ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar htdocs/js/player.js > dist/htdocs/js/player.min.js
[ htdocs/js/mympd.js -nt dist/htdocs/js/mympd.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar htdocs/js/mympd.js > dist/htdocs/js/mympd.min.js
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar htdocs/sw.js > dist/htdocs/sw.min.js
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar htdocs/js/keymap.js > dist/htdocs/js/keymap.min.js
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar htdocs/js/keymap.js > dist/htdocs/js/keymap.min.js
[ dist/htdocs/js/bootstrap-native-v4.js -nt dist/htdocs/js/bootstrap-native-v4.min.js ] && \
java -jar dist/buildtools/closure-compiler.jar dist/htdocs/js/bootstrap-native-v4.js > dist/htdocs/js/bootstrap-native-v4.min.js
else
echo "dist/buildtools/closure-compiler.jar not found, using non-minified files"
[ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \
cp htdocs/js/player.js dist/htdocs/js/player.min.js
[ htdocs/js/mympd.js -nt dist/htdocs/js/mympd.min.js ] && \
cp htdocs/js/mympd.js dist/htdocs/js/mympd.min.js
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
cp htdocs/sw.js dist/htdocs/sw.min.js
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
cp htdocs/js/keymap.js dist/htdocs/js/keymap.min.js
[ dist/htdocs/js/bootstrap-native-v4.js -nt dist/htdocs/js/bootstrap-native-v4.min.js ] && \
cp dist/htdocs/js/bootstrap-native-v4.js dist/htdocs/js/bootstrap-native-v4.min.js
fi
if [ -f dist/buildtools/closure-stylesheets.jar ] && [ "$java" != "" ]
then
echo "Minifying stylesheets"
[ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \
java -jar dist/buildtools/closure-stylesheets.jar --allow-unrecognized-properties htdocs/css/mympd.css > dist/htdocs/css/mympd.min.css
else
echo "dist/buildtools/closure-stylesheets.jar not found, using non-minified files"
[ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \
cp htdocs/css/mympd.css dist/htdocs/css/mympd.min.css
fi
echo "Minifying html"
[ htdocs/index.html -nt dist/htdocs/index.html ] && \
perl -pe 's/^\s*//gm; s/\s*$//gm' htdocs/index.html > dist/htdocs/index.html
[ htdocs/player.html -nt dist/htdocs/player.html ] && \
perl -pe 's/^\s*//gm; s/\s*$//gm' htdocs/player.html > dist/htdocs/player.html
echo "Compiling and installing mympd"
[ -d release ] || mkdir release
cd release
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
cd ..
sudo debian/postinst
if [ -x /usr/bin/cppcheck ]
then
echo "Running cppcheck"
cppcheck --enable=warning --inconclusive --force --inline-suppr src/*.c src/*.h
fi