diff --git a/.travis/linux..install.sh b/.travis/linux..install.sh index 7b591feb9..2c8bebcd2 100644 --- a/.travis/linux..install.sh +++ b/.travis/linux..install.sh @@ -8,10 +8,11 @@ PACKAGES="cmake libsndfile-dev fftw3-dev libvorbis-dev libogg-dev # Help with unmet dependencies PACKAGES="$PACKAGES libjack0" -if [ $QT5 ]; then +if [ "$QT5" ]; then PACKAGES="$PACKAGES qtbase5-dev qttools5-dev-tools qttools5-dev" else PACKAGES="$PACKAGES libqt4-dev" fi +# shellcheck disable=SC2086 sudo apt-get install -y $PACKAGES diff --git a/.travis/linux..script.sh b/.travis/linux..script.sh index 895f5875a..e370475c0 100644 --- a/.travis/linux..script.sh +++ b/.travis/linux..script.sh @@ -1,3 +1,4 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 cmake -DUSE_WERROR=ON $CMAKE_FLAGS .. diff --git a/.travis/linux.win.download.sh b/.travis/linux.win.download.sh index 76d7928b4..b429e1098 100644 --- a/.travis/linux.win.download.sh +++ b/.travis/linux.win.download.sh @@ -2,10 +2,11 @@ set -e CACHE_DIR=$TRAVIS_BUILD_DIR/apt_mingw_cache/$1 -mkdir -p $CACHE_DIR +mkdir -p "$CACHE_DIR" -pushd $CACHE_DIR +pushd "$CACHE_DIR" +# shellcheck disable=SC2086 apt-get --print-uris --yes install $MINGW_PACKAGES | grep ^\' | cut -d\' -f2 > downloads.list wget -N --input-file downloads.list diff --git a/.travis/linux.win32.install.sh b/.travis/linux.win32.install.sh index 88d17a4f2..34fc226d8 100644 --- a/.travis/linux.win32.install.sh +++ b/.travis/linux.win32.install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [ $QT5 ]; then +if [ "$QT5" ]; then MINGW_PACKAGES="mingw32-x-qt5base" else MINGW_PACKAGES="mingw32-x-qt" @@ -16,10 +16,13 @@ MINGW_PACKAGES="mingw32-x-sdl mingw32-x-libvorbis mingw32-x-fluidsynth mingw32-x export MINGW_PACKAGES DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -. $DIR/linux.win.download.sh win32 + +# shellcheck disable=SC1090 +. "$DIR/linux.win.download.sh" win32 PACKAGES="nsis cloog-isl libmpc3 qt4-linguist-tools mingw32 $MINGW_PACKAGES" +# shellcheck disable=SC2086 sudo apt-get install -y $PACKAGES # ccache 3.2 is needed because mingw32-x-gcc is version 4.9, which causes cmake diff --git a/.travis/linux.win64.install.sh b/.travis/linux.win64.install.sh index 538fda18c..43d9bf66a 100644 --- a/.travis/linux.win64.install.sh +++ b/.travis/linux.win64.install.sh @@ -3,10 +3,11 @@ set -e # First, install 32-bit deps DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -. $DIR/linux.win32.install.sh +# shellcheck disable=SC1090 +. "$DIR/linux.win32.install.sh" -if [ $QT5 ]; then +if [ "$QT5" ]; then MINGW_PACKAGES="mingw64-x-qt5base" else MINGW_PACKAGES="mingw64-x-qt" @@ -21,6 +22,8 @@ MINGW_PACKAGES="mingw64-x-sdl mingw64-x-libvorbis mingw64-x-fluidsynth mingw64-x export MINGW_PACKAGES DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -. $DIR/linux.win.download.sh win64 +# shellcheck disable=SC1090 +. "$DIR/linux.win.download.sh" win64 +# shellcheck disable=SC2086 sudo apt-get install -y $MINGW_PACKAGES diff --git a/.travis/osx..install.sh b/.travis/osx..install.sh index 0fb8560eb..f2bf4a246 100644 --- a/.travis/osx..install.sh +++ b/.travis/osx..install.sh @@ -2,18 +2,19 @@ PACKAGES="cmake pkgconfig fftw libogg libvorbis libsndfile libsamplerate jack sdl stk portaudio node fltk" -if [ $QT5 ]; then +if [ "$QT5" ]; then PACKAGES="$PACKAGES homebrew/versions/qt55" else PACKAGES="$PACKAGES cartr/qt4/qt" fi +# shellcheck disable=SC2086 brew install $PACKAGES ccache # Recompile fluid-synth without CoreAudio per issues #649 # Changes to fluid-synth.rb must be pushed to URL prior to use url=$(git remote get-url origin) branch=$(git symbolic-ref --short HEAD) -brew install --build-from-source $url/raw/$branch/cmake/apple/fluid-synth.rb +brew install --build-from-source "$url/raw/$branch/cmake/apple/fluid-synth.rb" sudo npm install -g appdmg diff --git a/.travis/osx..script.sh b/.travis/osx..script.sh index 30c938748..0e3502692 100644 --- a/.travis/osx..script.sh +++ b/.travis/osx..script.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash -if [ $QT5 ]; then +if [ "$QT5" ]; then # Workaround; No FindQt5.cmake module exists - export CMAKE_PREFIX_PATH="$(brew --prefix qt55)" + CMAKE_PREFIX_PATH="$(brew --prefix qt55)" + export CMAKE_PREFIX_PATH fi +# shellcheck disable=SC2086 cmake $CMAKE_FLAGS -DUSE_WERROR=OFF .. diff --git a/cmake/build_mingw32.sh b/cmake/build_mingw32.sh index 3ee88930d..b5501dc88 100755 --- a/cmake/build_mingw32.sh +++ b/cmake/build_mingw32.sh @@ -21,4 +21,6 @@ if [ $QT5 ]; then fi DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cmake $DIR/.. -DCMAKE_TOOLCHAIN_FILE=$DIR/../cmake/modules/Win32Toolchain.cmake -DCMAKE_MODULE_PATH=$DIR/../cmake/modules/ $CMAKE_OPTS + +# shellcheck disable=SC2086 +cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$DIR/../cmake/modules/Win32Toolchain.cmake" -DCMAKE_MODULE_PATH="$DIR/../cmake/modules/" $CMAKE_OPTS diff --git a/cmake/build_mingw64.sh b/cmake/build_mingw64.sh index da66299c5..42a662bf1 100755 --- a/cmake/build_mingw64.sh +++ b/cmake/build_mingw64.sh @@ -19,4 +19,6 @@ if [ $QT5 ]; then fi DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cmake $DIR/.. -DCMAKE_TOOLCHAIN_FILE=$DIR/../cmake/modules/Win64Toolchain.cmake -DCMAKE_MODULE_PATH=$DIR/../cmake/modules/ $CMAKE_OPTS + +# shellcheck disable=SC2086 +cmake "$DIR/.." -DCMAKE_TOOLCHAIN_FILE="$DIR/../cmake/modules/Win64Toolchain.cmake" -DCMAKE_MODULE_PATH="$DIR/../cmake/modules/" $CMAKE_OPTS diff --git a/cmake/msys/extract_debs.sh b/cmake/msys/extract_debs.sh index 46c88c892..508ac215a 100644 --- a/cmake/msys/extract_debs.sh +++ b/cmake/msys/extract_debs.sh @@ -5,7 +5,7 @@ pushd $ppa_dir for f in *.deb; do echo "Extracting $f..." - ar xv $f + ar xv "$f" rm debian-binary rm control.tar.* tar xf data.tar.* diff --git a/cmake/msys/fetch_ppa.sh b/cmake/msys/fetch_ppa.sh index 17372f770..0a99305b0 100644 --- a/cmake/msys/fetch_ppa.sh +++ b/cmake/msys/fetch_ppa.sh @@ -9,7 +9,7 @@ PPA_ARCH=amd64 # These shouldn't change PPA_HOST=http://ppa.launchpad.net PPA_USER=tobydox -PPA_PROJECT=mingw-x-trusty +PPA_PROJECT=mingw-x-trusty PPA_ROOT=$PPA_HOST/$PPA_USER/$PPA_PROJECT/ubuntu PPA_URL=$PPA_ROOT/dists/$PPA_DISTRO/main/binary-$PPA_ARCH/Packages @@ -20,18 +20,18 @@ temp_file=/tmp/ppa_listing_$$ temp_temp_file=/tmp/ppa_listing_temp_$$ skip_files="binutils openssl flac libgig libogg libvorbis x-bootstrap zlib" -skip_files="$skip_files x-runtime gcc qt_4 qt5 x-stk pkgconfig" +skip_files="$skip_files x-runtime gcc qt_4 qt5 x-stk pkgconfig" skip_files="$skip_files glib2 libpng" echo "Connecting to $PPA_HOST to get list of packages..." wget -qO- $PPA_URL |grep "Filename:" > $temp_file for j in $skip_files ; do - grep -v $j $temp_file > $temp_temp_file + grep -v "$j" $temp_file > $temp_temp_file mv $temp_temp_file $temp_file done -line_count=`wc -l $temp_file |awk '{print $1}'` +line_count=$(wc -l $temp_file |awk '{print $1}') echo "Found $line_count packages for download..." @@ -39,20 +39,17 @@ echo "Downloading packages. They will be saved to $ppa_dir" mkdir $ppa_dir -for j in `cat $temp_file` ; do - if [ "$j" = "Filename:" ] ; then - continue +while read -r j +do + if [ "$j" = "Filename:" ] ; then + continue fi echo "Downloading $j..." - wget -O $ppa_dir$(basename $j) $PPA_ROOT/$j -done + wget -O "$ppa_dir$(basename "$j")" "$PPA_ROOT/$j" +done < $temp_file echo "Cleaning up temporary files..." rm -rf $temp_file echo "Packages have been saved to $ppa_dir. Please run extract_debs.sh" - - - - diff --git a/cmake/msys/msys_helper.sh b/cmake/msys/msys_helper.sh index 041036237..92b868255 100644 --- a/cmake/msys/msys_helper.sh +++ b/cmake/msys/msys_helper.sh @@ -21,27 +21,27 @@ if [ $? -ne 0 ]; then fi info "Preparing the git directory..." -mkdir $HOME/.git; touch $HOME/.git/config > /dev/null &2>1 +mkdir "$HOME/.git"; touch "$HOME/.git/config" > /dev/null &2>1 git config --global http.sslverify false info "Cloning the repository..." -if [ -d ./lmms ]; then +if [ -d ./lmms ]; then warn " - Skipping, ./lmms already exists" -else +else git clone -b $branch https://github.com/$fork/lmms.git fi info "Fetching ppa using cmake/msys/fetch_ppas.sh..." -if [ -d $HOME/ppa ]; then +if [ -d "$HOME/ppa" ]; then warn " - Skipping, $HOME/ppa already exists" else - ./lmms/cmake/msys/fetch_ppa.sh + ./lmms/cmake/msys/fetch_ppa.sh fi info "Extracting debs to $HOME/ppa/opt/, etc..." -if [ -d $HOME/ppa/opt ]; then +if [ -d "$HOME/ppa/opt" ]; then warn " - Skipping, $HOME/ppa/opt already exists" else ./lmms/cmake/msys/extract_debs.sh @@ -49,15 +49,15 @@ fi info "Preparing library merge, making all qt headers writable..." chmod u+w /mingw64/include/qt4 -R -chmod u+w /mingw32/include/qt4 -R +chmod u+w /mingw32/include/qt4 -R info "Merging mingw headers and libraries from ppa over existing system libraries..." find /mingw64 |grep sndfile.h -if [ $? -ne 0 ]; then - \cp -r $HOME/ppa/opt/mingw* / -else - warn " - Skipping, sndfile.h has already been merged" +if [ $? -ne 0 ]; then + command cp -r "$HOME/ppa/opt/mingw"* / +else + warn " - Skipping, sndfile.h has already been merged" fi fltkver="1.3.3" @@ -69,18 +69,18 @@ stkver="4.5.1" info "Downloading and building fltk $fltkver" -mingw_root="/$(echo $MSYSTEM|tr '[:upper:]' '[:lower:]')" +mingw_root="/$(echo "$MSYSTEM"|tr '[:upper:]' '[:lower:]')" which fluid -if [ $? -ne 0 ]; then - wget http://fltk.org/pub/fltk/$fltkver/fltk-$fltkver-source.tar.gz -O $HOME/fltk-source.tar.gz +if [ $? -ne 0 ]; then + wget http://fltk.org/pub/fltk/$fltkver/fltk-$fltkver-source.tar.gz -O "$HOME/fltk-source.tar.gz" if [ $? -ne 0 ]; then - err "ERROR: Could not download fltk. Exiting." + err "ERROR: Could not download fltk. Exiting." fi - tar zxf $HOME/fltk-source.tar.gz -C $HOME/ - pushd $HOME/fltk-$fltkver + tar zxf "$HOME/fltk-source.tar.gz" -C "$HOME/" + pushd "$HOME/fltk-$fltkver" info " - Compiling fltk $fltkver..." - ./configure --prefix=$mingw_root --enable-shared + ./configure --prefix="$mingw_root" --enable-shared make @@ -90,25 +90,25 @@ if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then err "ERROR: Could not build/install fltk -- Zyn needs this. Exiting." fi - -# ln -s $mingw_root/usr/local/bin/fluid.exe $mingw_root/bin/fluid.exe + +# ln -s $mingw_root/usr/local/bin/fluid.exe $mingw_root/bin/fluid.exe popd else - warn " - Skipping, fluid binary already exists" + warn " - Skipping, fluid binary already exists" fi info "Downloading and building libogg $oggver" -if [ ! -e $mingw_root/lib/libogg.dll.a ]; then - wget http://downloads.xiph.org/releases/ogg/libogg-$oggver.tar.xz -O $HOME/libogg-source.tar.xz +if [ ! -e "$mingw_root/lib/libogg.dll.a" ]; then + wget http://downloads.xiph.org/releases/ogg/libogg-$oggver.tar.xz -O "$HOME/libogg-source.tar.xz" if [ $? -ne 0 ]; then - err "ERROR: Could not download libogg. Exiting." + err "ERROR: Could not download libogg. Exiting." fi - tar xf $HOME/libogg-source.tar.xz -C $HOME/ - pushd $HOME/libogg-$oggver + tar xf "$HOME/libogg-source.tar.xz" -C "$HOME/" + pushd "$HOME/libogg-$oggver" info " - Compiling libogg $oggver..." - ./configure --prefix=$mingw_root + ./configure --prefix="$mingw_root" make @@ -116,7 +116,7 @@ if [ ! -e $mingw_root/lib/libogg.dll.a ]; then make install # for some reason libgig needs this - ./configure --prefix=/opt$mingw_root + ./configure --prefix="/opt$mingw_root" make @@ -126,25 +126,25 @@ if [ ! -e $mingw_root/lib/libogg.dll.a ]; then if [ $? -ne 0 ]; then err "ERROR: Could not build/install fltk -- lmms needs this. Exiting." fi - + popd else - warn " - Skipping, libogg binary already exists" + warn " - Skipping, libogg binary already exists" fi info "Downloading and building libvorbis $vorbisver" -if [ ! -e $mingw_root/lib/libvorbis.dll.a ]; then - wget http://downloads.xiph.org/releases/vorbis/libvorbis-$vorbisver.tar.xz -O $HOME/libvorbis-source.tar.xz +if [ ! -e "$mingw_root/lib/libvorbis.dll.a" ]; then + wget http://downloads.xiph.org/releases/vorbis/libvorbis-$vorbisver.tar.xz -O "$HOME/libvorbis-source.tar.xz" if [ $? -ne 0 ]; then - err "ERROR: Could not download libogg. Exiting." + err "ERROR: Could not download libogg. Exiting." fi - tar xf $HOME/libvorbis-source.tar.xz -C $HOME/ - pushd $HOME/libvorbis-$vorbisver + tar xf "$HOME/libvorbis-source.tar.xz" -C "$HOME/" + pushd "$HOME/libvorbis-$vorbisver" info " - Compiling libvorbis $vorbisver..." - ./configure --prefix=$mingw_root + ./configure --prefix="$mingw_root" make @@ -152,7 +152,7 @@ if [ ! -e $mingw_root/lib/libvorbis.dll.a ]; then make install # for some reason libgig needs this - ./configure --prefix=/opt$mingw_root + ./configure --prefix="/opt$mingw_root" make @@ -162,24 +162,24 @@ if [ ! -e $mingw_root/lib/libvorbis.dll.a ]; then if [ $? -ne 0 ]; then err "ERROR: Could not build/install libvorbis -- lmms needs this. Exiting." fi - + popd else - warn " - Skipping, libvorbis binary already exists" + warn " - Skipping, libvorbis binary already exists" fi info "Downloading and building flac $flacver" -if [ ! -e $mingw_root/lib/libFLAC.dll.a ]; then - wget http://downloads.xiph.org/releases/flac/flac-$flacver.tar.xz -O $HOME/flac-source.tar.xz +if [ ! -e "$mingw_root/lib/libFLAC.dll.a" ]; then + wget http://downloads.xiph.org/releases/flac/flac-$flacver.tar.xz -O "$HOME/flac-source.tar.xz" if [ $? -ne 0 ]; then - err "ERROR: Could not download flac. Exiting." + err "ERROR: Could not download flac. Exiting." fi - tar xf $HOME/flac-source.tar.xz -C $HOME/ - pushd $HOME/flac-$flacver + tar xf "$HOME/flac-source.tar.xz" -C "$HOME/" + pushd "$HOME/flac-$flacver" info " - Compiling flac $flacver..." - ./configure --prefix=$mingw_root + ./configure --prefix="$mingw_root" make @@ -187,7 +187,7 @@ if [ ! -e $mingw_root/lib/libFLAC.dll.a ]; then make install # for some reason libgig needs this - ./configure --prefix=/opt$mingw_root + ./configure --prefix="/opt$mingw_root" make @@ -197,54 +197,54 @@ if [ ! -e $mingw_root/lib/libFLAC.dll.a ]; then if [ $? -ne 0 ]; then err "ERROR: Could not build/install flac -- lmms needs this. Exiting." fi - + popd else - warn " - Skipping, libvorbis flac already exists" + warn " - Skipping, libvorbis flac already exists" fi info "Downloading and building libgig $gigver" -if [ ! -e $mingw_root/lib/libgig/libgig.dll.a ]; then - wget http://download.linuxsampler.org/packages/libgig-$gigver.tar.bz2 -O $HOME/gig-source.tar.xz +if [ ! -e "$mingw_root/lib/libgig/libgig.dll.a" ]; then + wget http://download.linuxsampler.org/packages/libgig-$gigver.tar.bz2 -O "$HOME/gig-source.tar.xz" if [ $? -ne 0 ]; then - err "ERROR: Could not download libgig. Exiting." + err "ERROR: Could not download libgig. Exiting." fi - tar xf $HOME/gig-source.tar.xz -C $HOME/ - pushd $HOME/libgig-$gigver + tar xf "$HOME/gig-source.tar.xz" -C "$HOME/" + pushd "$HOME/libgig-$gigver" info " - Compiling libgig $gigver..." - ./configure --prefix=$mingw_root + ./configure --prefix="$mingw_root" make info " - Installing libgig..." make install - mv $mingw_root/lib/bin/libakai-0.dll $mingw_root/bin - mv $mingw_root/lib/bin/libgig-7.dll $mingw_root/bin + mv "$mingw_root/lib/bin/libakai-0.dll" "$mingw_root/bin" + mv "$mingw_root/lib/bin/libgig-7.dll" "$mingw_root/bin" if [ $? -ne 0 ]; then err "ERROR: Could not build/install libgig -- gigplayer needs this. Exiting." fi - + popd else - warn " - Skipping, libgig binary already exists" + warn " - Skipping, libgig binary already exists" fi info "Downloading and building stk $stkver" -if [ ! -e $mingw_root/lib/libstk.dll ]; then - wget http://ccrma.stanford.edu/software/stk/release/stk-$stkver.tar.gz -O $HOME/stk-source.tar.xz +if [ ! -e "$mingw_root/lib/libstk.dll" ]; then + wget http://ccrma.stanford.edu/software/stk/release/stk-$stkver.tar.gz -O "$HOME/stk-source.tar.xz" if [ $? -ne 0 ]; then err "ERROR: Could not download stk. Exiting." fi - tar xf $HOME/stk-source.tar.xz -C $HOME/ - pushd $HOME/stk-$stkver + tar xf "$HOME/stk-source.tar.xz" -C "$HOME/" + pushd "$HOME/stk-$stkver" info " - Compiling stk $stkver..." - ./configure --prefix=$mingw_root + ./configure --prefix="$mingw_root" make @@ -255,32 +255,32 @@ if [ ! -e $mingw_root/lib/libstk.dll ]; then err "ERROR: Could not build/install stk -- mallotstk needs this. Exiting." fi - mv $mingw_root/lib/libstk.so $mingw_root/lib/libstk.dll - mv $mingw_root/lib/libstk-$stkver.so $mingw_root/lib/libstk-$stkver.dll + mv "$mingw_root/lib/libstk.so" "$mingw_root/lib/libstk.dll" + mv "$mingw_root/lib/libstk-$stkver.so" "$mingw_root/lib/libstk-$stkver.dll" popd else - warn " - Skipping, stk binary already exists" + warn " - Skipping, stk binary already exists" fi # make a symlink to make cmake happy -if [ $mingw_root = "/mingw64" ]; then - if [ ! -e /opt/mingw64/bin/x86_64-w64-mingw32-pkg-config ]; then +if [ "$mingw_root" = "/mingw64" ]; then + if [ ! -e /opt/mingw64/bin/x86_64-w64-mingw32-pkg-config ]; then ln -s /usr/bin/pkg-config /opt/mingw64/bin/x86_64-w64-mingw32-pkg-config fi fi -if [ $mingw_root = "/mingw32" ]; then +if [ "$mingw_root" = "/mingw32" ]; then - if [ ! -e /opt/mingw32/bin/i686-w64-mingw32-pkg-config ]; then + if [ ! -e /opt/mingw32/bin/i686-w64-mingw32-pkg-config ]; then ln -s /usr/bin/pkg-config /opt/mingw32/bin/i686-w64-mingw32-pkg-config fi fi info "Cleaning up..." -rm -rf $HOME/fltk-$fltkver -rm -rf $HOME/libogg-$oggver -rm -rf $HOME/libvorbis-$vorbisver -rm -rf $HOME/flac-$flacver -rm -rf $HOME/libgig-$gigver -rm -rf $HOME/stk-$stkver +rm -rf "$HOME/fltk-$fltkver" +rm -rf "$HOME/libogg-$oggver" +rm -rf "$HOME/libvorbis-$vorbisver" +rm -rf "$HOME/flac-$flacver" +rm -rf "$HOME/libgig-$gigver" +rm -rf "$HOME/stk-$stkver" info "Done."