2018-06-21 22:15:54 +00:00
|
|
|
#/bin/sh
|
2018-06-21 21:29:49 +00:00
|
|
|
|
2018-07-30 22:05:37 +00:00
|
|
|
java=$(which java 2> /dev/null)
|
|
|
|
|
|
|
|
if [ -f dist/buildtools/closure-compiler.jar ] && [ "$java" != "" ]
|
2018-06-21 21:29:49 +00:00
|
|
|
then
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Minifying javascript"
|
2018-07-30 22:05:37 +00:00
|
|
|
[ 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
|
2018-08-22 12:06:22 +00:00
|
|
|
[ 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
|
2018-07-30 22:05:37 +00:00
|
|
|
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
|
|
|
|
java -jar dist/buildtools/closure-compiler.jar htdocs/sw.js > dist/htdocs/sw.min.js
|
2018-11-05 23:13:22 +00:00
|
|
|
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
|
2018-11-19 19:30:59 +00:00
|
|
|
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
|
2018-06-21 21:56:39 +00:00
|
|
|
else
|
2018-08-01 09:01:34 +00:00
|
|
|
echo "dist/buildtools/closure-compiler.jar not found, using non-minified files"
|
2018-07-30 22:05:37 +00:00
|
|
|
[ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \
|
|
|
|
cp htdocs/js/player.js dist/htdocs/js/player.min.js
|
2018-11-19 19:30:59 +00:00
|
|
|
[ htdocs/js/mympd.js -nt dist/htdocs/js/mympd.min.js ] && \
|
|
|
|
cp htdocs/js/mympd.js dist/htdocs/js/mympd.min.js
|
2018-07-30 22:05:37 +00:00
|
|
|
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
|
2018-11-05 23:13:22 +00:00
|
|
|
cp htdocs/sw.js dist/htdocs/sw.min.js
|
2018-11-19 19:30:59 +00:00
|
|
|
[ 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
|
2018-06-21 21:29:49 +00:00
|
|
|
fi
|
2018-07-11 00:01:04 +00:00
|
|
|
|
2018-07-31 16:15:08 +00:00
|
|
|
if [ -f dist/buildtools/closure-stylesheets.jar ] && [ "$java" != "" ]
|
2018-07-11 00:01:04 +00:00
|
|
|
then
|
|
|
|
echo "Minifying stylesheets"
|
2018-08-22 12:06:22 +00:00
|
|
|
[ 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
|
2018-06-21 21:56:39 +00:00
|
|
|
else
|
2018-08-01 09:01:34 +00:00
|
|
|
echo "dist/buildtools/closure-stylesheets.jar not found, using non-minified files"
|
2018-08-22 12:06:22 +00:00
|
|
|
[ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \
|
|
|
|
cp htdocs/css/mympd.css dist/htdocs/css/mympd.min.css
|
2018-06-21 21:29:49 +00:00
|
|
|
fi
|
|
|
|
|
2018-07-30 22:05:37 +00:00
|
|
|
echo "Minifying html"
|
2018-09-20 22:04:35 +00:00
|
|
|
[ 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
|
2018-07-30 22:05:37 +00:00
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Compiling and installing mympd"
|
2018-06-21 21:29:49 +00:00
|
|
|
[ -d release ] || mkdir release
|
|
|
|
cd release
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE ..
|
|
|
|
make
|
2018-06-21 22:15:54 +00:00
|
|
|
sudo make install
|
|
|
|
cd ..
|
|
|
|
|
2018-09-25 23:28:26 +00:00
|
|
|
sudo debian/postinst
|
2018-09-20 22:22:44 +00:00
|
|
|
|
2018-09-25 23:27:17 +00:00
|
|
|
if [ -x /usr/bin/cppcheck ]
|
|
|
|
then
|
|
|
|
echo "Running cppcheck"
|
|
|
|
cppcheck --enable=warning --inconclusive --force --inline-suppr src/*.c src/*.h
|
|
|
|
fi
|