summaryrefslogtreecommitdiffstats
path: root/.travis
diff options
context:
space:
mode:
Diffstat (limited to '.travis')
-rwxr-xr-x.travis/clang-format/script.sh37
-rwxr-xr-x.travis/common/post-upload.sh22
-rwxr-xr-x.travis/common/pre-upload.sh6
-rwxr-xr-x.travis/linux/build.sh3
-rwxr-xr-x.travis/linux/deps.sh3
-rwxr-xr-x.travis/linux/docker.sh17
-rwxr-xr-x.travis/linux/upload.sh14
-rwxr-xr-x.travis/macos/build.sh12
-rwxr-xr-x.travis/macos/deps.sh4
-rwxr-xr-x.travis/macos/upload.sh110
10 files changed, 228 insertions, 0 deletions
diff --git a/.travis/clang-format/script.sh b/.travis/clang-format/script.sh
new file mode 100755
index 000000000..80a0f47e5
--- /dev/null
+++ b/.travis/clang-format/script.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -ex
+
+if grep -nr '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis* dist/*.desktop \
+ dist/*.svg dist/*.xml; then
+ echo Trailing whitespace found, aborting
+ exit 1
+fi
+
+# Default clang-format points to default 3.5 version one
+CLANG_FORMAT=clang-format-3.9
+$CLANG_FORMAT --version
+
+if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
+ # Get list of every file modified in this pull request
+ files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)"
+else
+ # Check everything for branch pushes
+ files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
+fi
+
+# Turn off tracing for this because it's too verbose
+set +x
+
+for f in $files_to_lint; do
+ d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
+ if ! [ -z "$d" ]; then
+ echo "!!! $f not compliant to coding style, here is the fix:"
+ echo "$d"
+ fail=1
+ fi
+done
+
+set -x
+
+if [ "$fail" = 1 ]; then
+ exit 1
+fi
diff --git a/.travis/common/post-upload.sh b/.travis/common/post-upload.sh
new file mode 100755
index 000000000..90deaaec8
--- /dev/null
+++ b/.travis/common/post-upload.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -ex
+
+# Copy documentation
+cp license.txt "$REV_NAME"
+cp README.md "$REV_NAME"
+
+tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME"
+
+# Find out what release we are building
+if [ -z $TRAVIS_TAG ]; then
+ RELEASE_NAME=head
+else
+ RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1)
+fi
+
+mv "$REV_NAME" $RELEASE_NAME
+
+7z a "$REV_NAME.7z" $RELEASE_NAME
+
+# move the compiled archive into the artifacts directory to be uploaded by travis releases
+mv "$ARCHIVE_NAME" artifacts/
+mv "$REV_NAME.7z" artifacts/
diff --git a/.travis/common/pre-upload.sh b/.travis/common/pre-upload.sh
new file mode 100755
index 000000000..3c2fc79a2
--- /dev/null
+++ b/.travis/common/pre-upload.sh
@@ -0,0 +1,6 @@
+#!/bin/bash -ex
+
+GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`"
+GITREV="`git show -s --format='%h'`"
+
+mkdir -p artifacts
diff --git a/.travis/linux/build.sh b/.travis/linux/build.sh
new file mode 100755
index 000000000..98433d184
--- /dev/null
+++ b/.travis/linux/build.sh
@@ -0,0 +1,3 @@
+#!/bin/bash -ex
+
+docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash /citra/.travis/linux/docker.sh
diff --git a/.travis/linux/deps.sh b/.travis/linux/deps.sh
new file mode 100755
index 000000000..be3f6bece
--- /dev/null
+++ b/.travis/linux/deps.sh
@@ -0,0 +1,3 @@
+#!/bin/sh -ex
+
+docker pull ubuntu:16.04
diff --git a/.travis/linux/docker.sh b/.travis/linux/docker.sh
new file mode 100755
index 000000000..e27af5600
--- /dev/null
+++ b/.travis/linux/docker.sh
@@ -0,0 +1,17 @@
+#!/bin/bash -ex
+
+cd /citra
+
+apt-get update
+apt-get install -y build-essential libsdl2-dev qtbase5-dev libqt5opengl5-dev libcurl4-openssl-dev libssl-dev wget git
+
+# Get a recent version of CMake
+wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh
+echo y | sh cmake-3.9.0-Linux-x86_64.sh --prefix=cmake
+export PATH=/citra/cmake/cmake-3.9.0-Linux-x86_64/bin:$PATH
+
+mkdir build && cd build
+cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release
+make -j4
+
+ctest -VV -C Release
diff --git a/.travis/linux/upload.sh b/.travis/linux/upload.sh
new file mode 100755
index 000000000..dd265e0fd
--- /dev/null
+++ b/.travis/linux/upload.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -ex
+
+. .travis/common/pre-upload.sh
+
+REV_NAME="citra-linux-${GITDATE}-${GITREV}"
+ARCHIVE_NAME="${REV_NAME}.tar.xz"
+COMPRESSION_FLAGS="-cJvf"
+
+mkdir "$REV_NAME"
+
+cp build/src/citra/citra "$REV_NAME"
+cp build/src/citra_qt/citra-qt "$REV_NAME"
+
+. .travis/common/post-upload.sh
diff --git a/.travis/macos/build.sh b/.travis/macos/build.sh
new file mode 100755
index 000000000..c957cdf21
--- /dev/null
+++ b/.travis/macos/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -ex
+
+set -o pipefail
+
+export MACOSX_DEPLOYMENT_TARGET=10.9
+export Qt5_DIR=$(brew --prefix)/opt/qt5
+
+mkdir build && cd build
+cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h" -DCMAKE_BUILD_TYPE=Release
+make -j4
+
+ctest -VV -C Release
diff --git a/.travis/macos/deps.sh b/.travis/macos/deps.sh
new file mode 100755
index 000000000..30ec99b62
--- /dev/null
+++ b/.travis/macos/deps.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -ex
+
+brew update
+brew install qt5 sdl2 dylibbundler p7zip
diff --git a/.travis/macos/upload.sh b/.travis/macos/upload.sh
new file mode 100755
index 000000000..19c80fdf0
--- /dev/null
+++ b/.travis/macos/upload.sh
@@ -0,0 +1,110 @@
+#!/bin/bash -ex
+
+. .travis/common/pre-upload.sh
+
+REV_NAME="citra-osx-${GITDATE}-${GITREV}"
+ARCHIVE_NAME="${REV_NAME}.tar.gz"
+COMPRESSION_FLAGS="-czvf"
+
+mkdir "$REV_NAME"
+
+cp build/src/citra/citra "$REV_NAME"
+cp -r build/src/citra_qt/citra-qt.app "$REV_NAME"
+
+# move qt libs into app bundle for deployment
+$(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app"
+
+# move SDL2 libs into folder for deployment
+dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/"
+
+# Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation).
+# To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks
+# (in the Contents/Frameworks folder).
+# The "install_name_tool" is used to do so.
+
+# Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e:
+# ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1
+# grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1
+brew install coreutils || brew upgrade coreutils || true
+
+REV_NAME_ALT=$REV_NAME/
+# grealpath is located in coreutils, there is no "realpath" for OS X :(
+QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)")
+BREW_PATH=$(brew --prefix)
+QT_VERSION_NUM=5
+
+$BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \
+ -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt"
+
+# These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them.
+declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport")
+
+for macos_lib in "${macos_libs[@]}"
+do
+ SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib
+ # Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/)
+ cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
+
+ # Replace references within the embedded Framework files with "internal" versions.
+ for macos_lib2 in "${macos_libs[@]}"
+ do
+ # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated.
+ # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files.
+ # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't.
+ RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2
+ install_name_tool -change \
+ $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \
+ @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
+ "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
+ install_name_tool -change \
+ "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
+ @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
+ "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
+ done
+done
+
+# Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"`
+# Which manifests itself as:
+# "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY"
+# There may be more dylibs needed to be fixed...
+declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib")
+
+for macos_lib in "${macos_plugins[@]}"
+do
+ install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
+ for macos_lib2 in "${macos_libs[@]}"
+ do
+ RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2
+ install_name_tool -change \
+ $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \
+ @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
+ "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
+ install_name_tool -change \
+ "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
+ @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
+ "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
+ done
+done
+
+for macos_lib in "${macos_libs[@]}"
+do
+ # Debugging info for Travis-CI
+ otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib"
+done
+
+# Make the citra-qt.app application launch a debugging terminal.
+# Store away the actual binary
+mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin
+
+cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL
+#!/usr/bin/env bash
+cd "\`dirname "\$0"\`"
+chmod +x citra-qt-bin
+open citra-qt-bin --args "\$@"
+EOL
+# Content that will serve as the launching script for citra (within the .app folder)
+
+# Make the launching script executable
+chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt
+
+. .travis/common/post-upload.sh