Skip to content

Commit

Permalink
Merge pull request LMMS#3476 from zapashcanon/shellcheck
Browse files Browse the repository at this point in the history
Add shellcheck to the build
  • Loading branch information
tresf authored Apr 17, 2017
2 parents 5e58d3c + 7844b3e commit cea7d7d
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 57 deletions.
25 changes: 4 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cache:
- $HOME/.ccache
matrix:
include:
- env: TYPE=style
- env: TARGET_OS=win32
- env: TARGET_OS=win64
- os: osx
Expand All @@ -17,20 +18,9 @@ matrix:
- env: QT5=True TARGET_OS=win64
- os: osx
env: QT5=True
before_install:
- . ${TRAVIS_BUILD_DIR}/.travis/${TRAVIS_OS_NAME}.${TARGET_OS}.before_install.sh
install:
- . ${TRAVIS_BUILD_DIR}/.travis/${TRAVIS_OS_NAME}.${TARGET_OS}.install.sh
before_script:
- mkdir build && cd build
- export CMAKE_FLAGS="-DWANT_QT5=$QT5 -DUSE_WERROR=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"
- if [ -z "$TRAVIS_TAG" ]; then export CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_CCACHE=ON"; fi
script:
- . ${TRAVIS_BUILD_DIR}/.travis/${TRAVIS_OS_NAME}.${TARGET_OS}.script.sh
- make -j4
- if [[ $TARGET_OS != win* ]]; then make tests && ./tests/tests; fi;
after_script:
- ccache -s
install: ${TRAVIS_BUILD_DIR}/.travis/install.sh
script: ${TRAVIS_BUILD_DIR}/.travis/script.sh
after_script: ${TRAVIS_BUILD_DIR}/.travis/after_script.sh
before_deploy: make package
deploy:
provider: releases
Expand All @@ -43,10 +33,3 @@ deploy:
all_branches: true
condition: '("$TARGET_OS" = win??) && "$QT5"'
repo: LMMS/lmms
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/1ac7fc698195981a9227
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
7 changes: 7 additions & 0 deletions .travis/after_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

if [ "$TYPE" != 'style' ]; then
ccache -s
fi
11 changes: 11 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

if [ "$TYPE" = 'style' ]; then
sudo apt-get -yqq update
sudo apt-get install shellcheck
else
"$TRAVIS_BUILD_DIR/.travis/$TRAVIS_OS_NAME.$TARGET_OS.before_install.sh"
"$TRAVIS_BUILD_DIR/.travis/$TRAVIS_OS_NAME.$TARGET_OS.install.sh"
fi
2 changes: 2 additions & 0 deletions .travis/linux..before_install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

sudo add-apt-repository ppa:andrewrk/libgroove -y
sudo sed -e "s/trusty/precise/" -i \
/etc/apt/sources.list.d/andrewrk-libgroove-trusty.list
Expand Down
2 changes: 2 additions & 0 deletions .travis/linux..install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

PACKAGES="cmake libsndfile-dev fftw3-dev libvorbis-dev libogg-dev
libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev
libfluidsynth-dev portaudio19-dev wine-dev g++-multilib libfltk1.3-dev
Expand Down
2 changes: 2 additions & 0 deletions .travis/linux..script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

set -e

# shellcheck disable=SC2086
cmake -DUSE_WERROR=ON $CMAKE_FLAGS ..
1 change: 1 addition & 0 deletions .travis/linux.win.download.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

set -e

CACHE_DIR=$TRAVIS_BUILD_DIR/apt_mingw_cache/$1
Expand Down
2 changes: 2 additions & 0 deletions .travis/linux.win32.before_install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

set -e

sudo add-apt-repository ppa:tobydox/mingw-x-trusty -y
sudo apt-get update -qq
8 changes: 3 additions & 5 deletions .travis/linux.win32.install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

set -e

if [ "$QT5" ]; then
Expand All @@ -15,10 +16,7 @@ MINGW_PACKAGES="mingw32-x-sdl mingw32-x-libvorbis mingw32-x-fluidsynth mingw32-x

export MINGW_PACKAGES

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# shellcheck disable=SC1090
. "$DIR/linux.win.download.sh" win32
"$TRAVIS_BUILD_DIR/.travis/linux.win.download.sh" win32

PACKAGES="nsis cloog-isl libmpc3 qt4-linguist-tools mingw32 $MINGW_PACKAGES"

Expand All @@ -29,6 +27,6 @@ sudo apt-get install -y $PACKAGES
# to use @file command line passing, which in turn ccache 3.1.9 doesn't support
pushd /tmp
wget http://archive.ubuntu.com/ubuntu/pool/main/c/ccache/ccache_3.2.4-1_amd64.deb
sha256sum -c $TRAVIS_BUILD_DIR/.travis/ccache.sha256
sha256sum -c "$TRAVIS_BUILD_DIR/.travis/ccache.sha256"
sudo dpkg -i ccache_3.2.4-1_amd64.deb
popd
2 changes: 2 additions & 0 deletions .travis/linux.win32.script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

set -e

export CMAKE_OPTS="$CMAKE_FLAGS -DUSE_WERROR=ON"
../cmake/build_mingw32.sh
4 changes: 3 additions & 1 deletion .travis/linux.win64.before_install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

. .travis/linux.win32.before_install.sh
set -e

"$TRAVIS_BUILD_DIR/.travis/linux.win32.before_install.sh"
10 changes: 3 additions & 7 deletions .travis/linux.win64.install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env bash

set -e

# First, install 32-bit deps
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck disable=SC1090
. "$DIR/linux.win32.install.sh"

"$TRAVIS_BUILD_DIR/.travis/linux.win32.install.sh"

if [ "$QT5" ]; then
MINGW_PACKAGES="mingw64-x-qt5base"
Expand All @@ -21,9 +19,7 @@ MINGW_PACKAGES="mingw64-x-sdl mingw64-x-libvorbis mingw64-x-fluidsynth mingw64-x

export MINGW_PACKAGES

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck disable=SC1090
. "$DIR/linux.win.download.sh" win64
"$TRAVIS_BUILD_DIR/.travis/linux.win.download.sh" win64

# shellcheck disable=SC2086
sudo apt-get install -y $MINGW_PACKAGES
2 changes: 2 additions & 0 deletions .travis/linux.win64.script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash

set -e

export CMAKE_OPTS="$CMAKE_FLAGS -DUSE_WERROR=ON"
../cmake/build_mingw64.sh
2 changes: 2 additions & 0 deletions .travis/osx..before_install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

set -e

brew update
34 changes: 27 additions & 7 deletions .travis/osx..install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
#!/usr/bin/env bash

PACKAGES="cmake pkgconfig fftw libogg libvorbis libsndfile libsamplerate jack sdl stk portaudio node fltk"
set -e

PACKAGES="cmake pkg-config fftw libogg libvorbis libsndfile libsamplerate jack sdl stk portaudio node fltk"

if [ "$QT5" ]; then
PACKAGES="$PACKAGES homebrew/versions/qt55"
PACKAGES="$PACKAGES [email protected]"
else
PACKAGES="$PACKAGES cartr/qt4/qt"
PACKAGES="$PACKAGES cartr/qt4/qt@4"
fi

if "${TRAVIS}"; then
PACKAGES="$PACKAGES ccache"
fi

# removing already installed packages from the list
for p in $(brew list); do
PACKAGES=${PACKAGES//$p/}
done;

# shellcheck disable=SC2086
brew install $PACKAGES ccache
brew install $PACKAGES

# 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"
if [ "$TRAVIS_EVENT_TYPE" == "pull_request" ]; then
slug=$TRAVIS_PULL_REQUEST_SLUG
branch=$TRAVIS_PULL_REQUEST_BRANCH
elif "${TRAVIS}"; then
slug=$TRAVIS_REPO_SLUG
branch=$TRAVIS_BRANCH
else
slug="LMMS/lmms"
branch=$(git symbolic-ref --short HEAD)
fi

brew install --build-from-source "https://raw.githubusercontent.com/${slug}/${branch}/cmake/apple/fluid-synth.rb"

sudo npm install -g appdmg
2 changes: 2 additions & 0 deletions .travis/osx..script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

if [ "$QT5" ]; then
# Workaround; No FindQt5.cmake module exists
CMAKE_PREFIX_PATH="$(brew --prefix qt55)"
Expand Down
31 changes: 31 additions & 0 deletions .travis/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -e

if [ "$TYPE" = 'style' ]; then

# shellcheck disable=SC2046
shellcheck $(find -O3 "$TRAVIS_BUILD_DIR/.travis/" "$TRAVIS_BUILD_DIR/cmake/" -type f -name '*.sh' -o -name "*.sh.in")

else

mkdir build
cd build

export CMAKE_FLAGS="-DWANT_QT5=$QT5 -DUSE_WERROR=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"

if [ -z "$TRAVIS_TAG" ]; then
export CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_CCACHE=ON"
fi

"$TRAVIS_BUILD_DIR/.travis/$TRAVIS_OS_NAME.$TARGET_OS.script.sh"

make -j4

if [[ $TARGET_OS != win* ]]; then

make tests
tests/tests

fi
fi
37 changes: 21 additions & 16 deletions cmake/apple/install_apple.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
# Examine linkings using `otool -L somelib.so`
# Debug the loading of dynamic libraries using `export DYLD_PRINT_LIBRARIES=1`

set -e

# STK rawwaves directory
STK_RAWWAVE=$HOME/stk-*/rawwaves
STK_RAWWAVE_LIST=( $HOME/stk-*/rawwaves )
STK_RAWWAVE=${STK_RAWWAVE_LIST[0]}

if [ ! -d "$STK_RAWWAVE" ]; then
STK_RAWWAVE=$(brew --prefix stk)/share/stk/rawwaves
fi

# Place to create ".app" bundle
APP="@CMAKE_BINARY_DIR@/@[email protected]"

Expand All @@ -24,29 +27,30 @@ if [ $? -ne 0 ]; then
brew --prefix qt55 > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Prefer Qt 5.5 (QTBUG-53533)
export PATH=$PATH:$(brew --prefix qt55)/bin
PATH=$PATH:$(brew --prefix qt55)/bin
else
# Fallback Qt 5.6+
export PATH=$PATH:$(brew --prefix qt5)/bin
PATH=$PATH:$(brew --prefix qt5)/bin
fi
export PATH
fi

# Remove any old .app bundles
rm -Rf "$APP"

# Copy/overwrite Info.plist
\cp "@CMAKE_BINARY_DIR@/Info.plist" "@CMAKE_INSTALL_PREFIX@/"
command cp "@CMAKE_BINARY_DIR@/Info.plist" "@CMAKE_INSTALL_PREFIX@/"

# Create .app bundle containing contents from CMAKE_INSTALL_PREFIX
mkdir -p "$APP/Contents/MacOS"
mkdir -p "$APP/Contents/Frameworks"
mkdir -p "$APP/Contents/Resources"
mkdir -p "$APP/Contents/share/stk/rawwaves"
cd "@CMAKE_INSTALL_PREFIX@"
cp -R * "$APP/Contents"
cp -R ./* "$APP/Contents"
cp "@CMAKE_SOURCE_DIR@/cmake/apple/"*.icns "$APP/Contents/Resources/"
cp $STK_RAWWAVE/*.raw "$APP/Contents/share/stk/rawwaves" > /dev/null 2>&1
cp "$STK_RAWWAVE"/*.raw "$APP/Contents/share/stk/rawwaves" > /dev/null 2>&1

# Make all libraries writable for macdeployqt
cd "$APP"
find . -type f -print0 | xargs -0 chmod u+w
Expand All @@ -55,11 +59,11 @@ lmmsbin="MacOS/@CMAKE_PROJECT_NAME@"
zynlib="lib/lmms/libzynaddsubfx.so"
zynfmk="Frameworks/libZynAddSubFxCore.dylib"
zynbin="MacOS/RemoteZynAddSubFx"

# Move lmms binary
mv "$APP/Contents/bin/@CMAKE_PROJECT_NAME@" "$APP/Contents/$lmmsbin"
# Fix zyn linking

# Fix zyn linking
mv "$APP/Contents/lib/lmms/RemoteZynAddSubFx" "$APP/Contents/$zynbin"
mv "$APP/Contents/lib/lmms/libZynAddSubFxCore.dylib" "$APP/Contents/$zynfmk"

Expand All @@ -70,24 +74,25 @@ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \
install_name_tool -change @rpath/libZynAddSubFxCore.dylib \
@loader_path/../../$zynfmk \
"$APP/Contents/$zynlib"

# Link lmms binary
_executables="${_executables} -executable=$APP/Contents/$zynbin"
_executables="${_executables} -executable=$APP/Contents/$zynfmk"

# Build a list of shared objects in target/lib/lmms
for file in "$APP/Contents/lib/lmms/"*.so; do
_thisfile="$APP/Contents/lib/lmms/${file##*/}"
_executables="${_executables} -executable=$_thisfile"
done

# Build a list of shared objects in target/lib/lmms/ladspa
for file in "$APP/Contents/lib/lmms/ladspa/"*.so; do
_thisfile="$APP/Contents/lib/lmms/ladspa/${file##*/}"
_executables="${_executables} -executable=$_thisfile"
done

# Finalize .app
# shellcheck disable=SC2086
macdeployqt "$APP" $_executables

# Cleanup
Expand Down

0 comments on commit cea7d7d

Please sign in to comment.