diff options
| author | 2017-10-09 17:27:46 -0600 | |
|---|---|---|
| committer | 2017-10-09 17:27:46 -0600 | |
| commit | d15e15bd058f93f1600c86ad8de7482740724f3f (patch) | |
| tree | 3280c1d616bfb161d89906c29f87dfa7e43a3b76 | |
| parent | Merge pull request #3002 from Dragios/nwm-cmdhdr-fix (diff) | |
| parent | travis: Split build scripts for different platforms (diff) | |
| download | yuzu-d15e15bd058f93f1600c86ad8de7482740724f3f.tar.gz yuzu-d15e15bd058f93f1600c86ad8de7482740724f3f.tar.xz yuzu-d15e15bd058f93f1600c86ad8de7482740724f3f.zip | |
Merge pull request #2996 from MerryMage/split-travis
travis: Split build scripts for different platforms
| -rwxr-xr-x | .travis-build.sh | 59 | ||||
| -rwxr-xr-x | .travis-deps.sh | 12 | ||||
| -rwxr-xr-x | .travis-upload.sh | 139 | ||||
| -rw-r--r-- | .travis.yml | 34 | ||||
| -rwxr-xr-x | .travis/clang-format/script.sh | 37 | ||||
| -rwxr-xr-x | .travis/common/post-upload.sh | 22 | ||||
| -rwxr-xr-x | .travis/common/pre-upload.sh | 6 | ||||
| -rwxr-xr-x | .travis/linux/build.sh | 3 | ||||
| -rwxr-xr-x | .travis/linux/deps.sh | 3 | ||||
| -rwxr-xr-x[-rw-r--r--] | .travis/linux/docker.sh (renamed from .travis-build-docker.sh) | 5 | ||||
| -rwxr-xr-x | .travis/linux/upload.sh | 14 | ||||
| -rwxr-xr-x | .travis/macos/build.sh | 12 | ||||
| -rwxr-xr-x | .travis/macos/deps.sh | 4 | ||||
| -rwxr-xr-x | .travis/macos/upload.sh | 110 |
14 files changed, 233 insertions, 227 deletions
diff --git a/.travis-build.sh b/.travis-build.sh deleted file mode 100755 index fc5a5f8b2..000000000 --- a/.travis-build.sh +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | set -x | ||
| 5 | |||
| 6 | if grep -nr '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis* dist/*.desktop \ | ||
| 7 | dist/*.svg dist/*.xml; then | ||
| 8 | echo Trailing whitespace found, aborting | ||
| 9 | exit 1 | ||
| 10 | fi | ||
| 11 | |||
| 12 | # Only run clang-format on Linux because we don't have 4.0 on OS X images | ||
| 13 | if [ "$TRAVIS_OS_NAME" = "linux" ]; then | ||
| 14 | # Default clang-format points to default 3.5 version one | ||
| 15 | CLANG_FORMAT=clang-format-3.9 | ||
| 16 | $CLANG_FORMAT --version | ||
| 17 | |||
| 18 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then | ||
| 19 | # Get list of every file modified in this pull request | ||
| 20 | files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" | ||
| 21 | else | ||
| 22 | # Check everything for branch pushes | ||
| 23 | files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" | ||
| 24 | fi | ||
| 25 | |||
| 26 | # Turn off tracing for this because it's too verbose | ||
| 27 | set +x | ||
| 28 | |||
| 29 | for f in $files_to_lint; do | ||
| 30 | d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true) | ||
| 31 | if ! [ -z "$d" ]; then | ||
| 32 | echo "!!! $f not compliant to coding style, here is the fix:" | ||
| 33 | echo "$d" | ||
| 34 | fail=1 | ||
| 35 | fi | ||
| 36 | done | ||
| 37 | |||
| 38 | set -x | ||
| 39 | |||
| 40 | if [ "$fail" = 1 ]; then | ||
| 41 | exit 1 | ||
| 42 | fi | ||
| 43 | fi | ||
| 44 | |||
| 45 | #if OS is linux or is not set | ||
| 46 | if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | ||
| 47 | docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash /citra/.travis-build-docker.sh | ||
| 48 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then | ||
| 49 | set -o pipefail | ||
| 50 | |||
| 51 | export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
| 52 | export Qt5_DIR=$(brew --prefix)/opt/qt5 | ||
| 53 | |||
| 54 | mkdir build && cd build | ||
| 55 | cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h" -DCMAKE_BUILD_TYPE=Release | ||
| 56 | make -j4 | ||
| 57 | |||
| 58 | ctest -VV -C Release | ||
| 59 | fi | ||
diff --git a/.travis-deps.sh b/.travis-deps.sh deleted file mode 100755 index 0cee68041..000000000 --- a/.travis-deps.sh +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -e | ||
| 4 | set -x | ||
| 5 | |||
| 6 | #if OS is linux or is not set | ||
| 7 | if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | ||
| 8 | docker pull ubuntu:16.04 | ||
| 9 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then | ||
| 10 | brew update | ||
| 11 | brew install qt5 sdl2 dylibbundler p7zip | ||
| 12 | fi | ||
diff --git a/.travis-upload.sh b/.travis-upload.sh deleted file mode 100755 index edf195f7d..000000000 --- a/.travis-upload.sh +++ /dev/null | |||
| @@ -1,139 +0,0 @@ | |||
| 1 | GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" | ||
| 2 | GITREV="`git show -s --format='%h'`" | ||
| 3 | mkdir -p artifacts | ||
| 4 | |||
| 5 | if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | ||
| 6 | REV_NAME="citra-linux-${GITDATE}-${GITREV}" | ||
| 7 | ARCHIVE_NAME="${REV_NAME}.tar.xz" | ||
| 8 | COMPRESSION_FLAGS="-cJvf" | ||
| 9 | mkdir "$REV_NAME" | ||
| 10 | |||
| 11 | cp build/src/citra/citra "$REV_NAME" | ||
| 12 | cp build/src/citra_qt/citra-qt "$REV_NAME" | ||
| 13 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then | ||
| 14 | REV_NAME="citra-osx-${GITDATE}-${GITREV}" | ||
| 15 | ARCHIVE_NAME="${REV_NAME}.tar.gz" | ||
| 16 | COMPRESSION_FLAGS="-czvf" | ||
| 17 | mkdir "$REV_NAME" | ||
| 18 | |||
| 19 | cp build/src/citra/citra "$REV_NAME" | ||
| 20 | cp -r build/src/citra_qt/citra-qt.app "$REV_NAME" | ||
| 21 | |||
| 22 | # move qt libs into app bundle for deployment | ||
| 23 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" | ||
| 24 | |||
| 25 | # move SDL2 libs into folder for deployment | ||
| 26 | dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" | ||
| 27 | |||
| 28 | # Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation). | ||
| 29 | # To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks | ||
| 30 | # (in the Contents/Frameworks folder). | ||
| 31 | # The "install_name_tool" is used to do so. | ||
| 32 | |||
| 33 | # Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e: | ||
| 34 | # ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1 | ||
| 35 | # grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1 | ||
| 36 | brew install coreutils | ||
| 37 | |||
| 38 | REV_NAME_ALT=$REV_NAME/ | ||
| 39 | # grealpath is located in coreutils, there is no "realpath" for OS X :( | ||
| 40 | QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)") | ||
| 41 | BREW_PATH=$(brew --prefix) | ||
| 42 | QT_VERSION_NUM=5 | ||
| 43 | |||
| 44 | $BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \ | ||
| 45 | -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt" | ||
| 46 | |||
| 47 | # These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them. | ||
| 48 | declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport") | ||
| 49 | |||
| 50 | for macos_lib in "${macos_libs[@]}" | ||
| 51 | do | ||
| 52 | SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib | ||
| 53 | # Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/) | ||
| 54 | cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 55 | |||
| 56 | # Replace references within the embedded Framework files with "internal" versions. | ||
| 57 | for macos_lib2 in "${macos_libs[@]}" | ||
| 58 | do | ||
| 59 | # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated. | ||
| 60 | # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files. | ||
| 61 | # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't. | ||
| 62 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | ||
| 63 | install_name_tool -change \ | ||
| 64 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | ||
| 65 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 66 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 67 | install_name_tool -change \ | ||
| 68 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 69 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 70 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 71 | done | ||
| 72 | done | ||
| 73 | |||
| 74 | # Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"` | ||
| 75 | # Which manifests itself as: | ||
| 76 | # "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY" | ||
| 77 | # There may be more dylibs needed to be fixed... | ||
| 78 | declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib") | ||
| 79 | |||
| 80 | for macos_lib in "${macos_plugins[@]}" | ||
| 81 | do | ||
| 82 | install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 83 | for macos_lib2 in "${macos_libs[@]}" | ||
| 84 | do | ||
| 85 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | ||
| 86 | install_name_tool -change \ | ||
| 87 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | ||
| 88 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 89 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 90 | install_name_tool -change \ | ||
| 91 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 92 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 93 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 94 | done | ||
| 95 | done | ||
| 96 | |||
| 97 | for macos_lib in "${macos_libs[@]}" | ||
| 98 | do | ||
| 99 | # Debugging info for Travis-CI | ||
| 100 | otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" | ||
| 101 | done | ||
| 102 | |||
| 103 | # Make the citra-qt.app application launch a debugging terminal. | ||
| 104 | # Store away the actual binary | ||
| 105 | mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin | ||
| 106 | |||
| 107 | cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL | ||
| 108 | #!/usr/bin/env bash | ||
| 109 | cd "\`dirname "\$0"\`" | ||
| 110 | chmod +x citra-qt-bin | ||
| 111 | open citra-qt-bin --args "\$@" | ||
| 112 | EOL | ||
| 113 | # Content that will serve as the launching script for citra (within the .app folder) | ||
| 114 | |||
| 115 | # Make the launching script executable | ||
| 116 | chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt | ||
| 117 | |||
| 118 | fi | ||
| 119 | |||
| 120 | # Copy documentation | ||
| 121 | cp license.txt "$REV_NAME" | ||
| 122 | cp README.md "$REV_NAME" | ||
| 123 | |||
| 124 | tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" | ||
| 125 | |||
| 126 | # Find out what release we are building | ||
| 127 | if [ -z $TRAVIS_TAG ]; then | ||
| 128 | RELEASE_NAME=head | ||
| 129 | else | ||
| 130 | RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1) | ||
| 131 | fi | ||
| 132 | |||
| 133 | mv "$REV_NAME" $RELEASE_NAME | ||
| 134 | |||
| 135 | 7z a "$REV_NAME.7z" $RELEASE_NAME | ||
| 136 | |||
| 137 | # move the compiled archive into the artifacts directory to be uploaded by travis releases | ||
| 138 | mv "$ARCHIVE_NAME" artifacts/ | ||
| 139 | mv "$REV_NAME.7z" artifacts/ | ||
diff --git a/.travis.yml b/.travis.yml index b92d7f236..8bad23208 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -2,24 +2,32 @@ language: cpp | |||
| 2 | matrix: | 2 | matrix: |
| 3 | include: | 3 | include: |
| 4 | - os: linux | 4 | - os: linux |
| 5 | env: NAME="linux build" | ||
| 5 | sudo: required | 6 | sudo: required |
| 6 | dist: trusty | 7 | dist: trusty |
| 8 | services: docker | ||
| 9 | addons: | ||
| 10 | apt: | ||
| 11 | packages: | ||
| 12 | - p7zip-full | ||
| 13 | install: "./.travis/linux/deps.sh" | ||
| 14 | script: "./.travis/linux/build.sh" | ||
| 15 | after_success: "./.travis/linux/upload.sh" | ||
| 7 | - os: osx | 16 | - os: osx |
| 17 | env: NAME="macos build" | ||
| 8 | sudo: false | 18 | sudo: false |
| 9 | osx_image: xcode7.3 | 19 | osx_image: xcode7.3 |
| 10 | 20 | install: "./.travis/macos/deps.sh" | |
| 11 | services: | 21 | script: "./.travis/macos/build.sh" |
| 12 | - docker | 22 | after_success: "./.travis/macos/upload.sh" |
| 13 | 23 | - os: linux | |
| 14 | addons: | 24 | env: NAME="clang-format" |
| 15 | apt: | 25 | dist: trusty |
| 16 | packages: | 26 | addons: |
| 17 | - clang-format-3.9 | 27 | apt: |
| 18 | - p7zip-full | 28 | packages: |
| 19 | 29 | - clang-format-3.9 | |
| 20 | install: "./.travis-deps.sh" | 30 | script: "./.travis/clang-format/script.sh" |
| 21 | script: "./.travis-build.sh" | ||
| 22 | after_success: "./.travis-upload.sh" | ||
| 23 | 31 | ||
| 24 | deploy: | 32 | deploy: |
| 25 | provider: releases | 33 | provider: releases |
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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | if grep -nr '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis* dist/*.desktop \ | ||
| 4 | dist/*.svg dist/*.xml; then | ||
| 5 | echo Trailing whitespace found, aborting | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 9 | # Default clang-format points to default 3.5 version one | ||
| 10 | CLANG_FORMAT=clang-format-3.9 | ||
| 11 | $CLANG_FORMAT --version | ||
| 12 | |||
| 13 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then | ||
| 14 | # Get list of every file modified in this pull request | ||
| 15 | files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" | ||
| 16 | else | ||
| 17 | # Check everything for branch pushes | ||
| 18 | files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" | ||
| 19 | fi | ||
| 20 | |||
| 21 | # Turn off tracing for this because it's too verbose | ||
| 22 | set +x | ||
| 23 | |||
| 24 | for f in $files_to_lint; do | ||
| 25 | d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true) | ||
| 26 | if ! [ -z "$d" ]; then | ||
| 27 | echo "!!! $f not compliant to coding style, here is the fix:" | ||
| 28 | echo "$d" | ||
| 29 | fail=1 | ||
| 30 | fi | ||
| 31 | done | ||
| 32 | |||
| 33 | set -x | ||
| 34 | |||
| 35 | if [ "$fail" = 1 ]; then | ||
| 36 | exit 1 | ||
| 37 | 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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | # Copy documentation | ||
| 4 | cp license.txt "$REV_NAME" | ||
| 5 | cp README.md "$REV_NAME" | ||
| 6 | |||
| 7 | tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" | ||
| 8 | |||
| 9 | # Find out what release we are building | ||
| 10 | if [ -z $TRAVIS_TAG ]; then | ||
| 11 | RELEASE_NAME=head | ||
| 12 | else | ||
| 13 | RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1) | ||
| 14 | fi | ||
| 15 | |||
| 16 | mv "$REV_NAME" $RELEASE_NAME | ||
| 17 | |||
| 18 | 7z a "$REV_NAME.7z" $RELEASE_NAME | ||
| 19 | |||
| 20 | # move the compiled archive into the artifacts directory to be uploaded by travis releases | ||
| 21 | mv "$ARCHIVE_NAME" artifacts/ | ||
| 22 | 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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" | ||
| 4 | GITREV="`git show -s --format='%h'`" | ||
| 5 | |||
| 6 | 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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | 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 @@ | |||
| 1 | #!/bin/sh -ex | ||
| 2 | |||
| 3 | docker pull ubuntu:16.04 | ||
diff --git a/.travis-build-docker.sh b/.travis/linux/docker.sh index 01249ace0..e27af5600 100644..100755 --- a/.travis-build-docker.sh +++ b/.travis/linux/docker.sh | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/bash -ex |
| 2 | |||
| 3 | set -e | ||
| 4 | set -x | ||
| 5 | 2 | ||
| 6 | cd /citra | 3 | cd /citra |
| 7 | 4 | ||
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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | . .travis/common/pre-upload.sh | ||
| 4 | |||
| 5 | REV_NAME="citra-linux-${GITDATE}-${GITREV}" | ||
| 6 | ARCHIVE_NAME="${REV_NAME}.tar.xz" | ||
| 7 | COMPRESSION_FLAGS="-cJvf" | ||
| 8 | |||
| 9 | mkdir "$REV_NAME" | ||
| 10 | |||
| 11 | cp build/src/citra/citra "$REV_NAME" | ||
| 12 | cp build/src/citra_qt/citra-qt "$REV_NAME" | ||
| 13 | |||
| 14 | . .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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | set -o pipefail | ||
| 4 | |||
| 5 | export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
| 6 | export Qt5_DIR=$(brew --prefix)/opt/qt5 | ||
| 7 | |||
| 8 | mkdir build && cd build | ||
| 9 | cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h" -DCMAKE_BUILD_TYPE=Release | ||
| 10 | make -j4 | ||
| 11 | |||
| 12 | 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 @@ | |||
| 1 | #!/bin/sh -ex | ||
| 2 | |||
| 3 | brew update | ||
| 4 | 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 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | . .travis/common/pre-upload.sh | ||
| 4 | |||
| 5 | REV_NAME="citra-osx-${GITDATE}-${GITREV}" | ||
| 6 | ARCHIVE_NAME="${REV_NAME}.tar.gz" | ||
| 7 | COMPRESSION_FLAGS="-czvf" | ||
| 8 | |||
| 9 | mkdir "$REV_NAME" | ||
| 10 | |||
| 11 | cp build/src/citra/citra "$REV_NAME" | ||
| 12 | cp -r build/src/citra_qt/citra-qt.app "$REV_NAME" | ||
| 13 | |||
| 14 | # move qt libs into app bundle for deployment | ||
| 15 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" | ||
| 16 | |||
| 17 | # move SDL2 libs into folder for deployment | ||
| 18 | dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" | ||
| 19 | |||
| 20 | # Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation). | ||
| 21 | # To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks | ||
| 22 | # (in the Contents/Frameworks folder). | ||
| 23 | # The "install_name_tool" is used to do so. | ||
| 24 | |||
| 25 | # Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e: | ||
| 26 | # ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1 | ||
| 27 | # grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1 | ||
| 28 | brew install coreutils || brew upgrade coreutils || true | ||
| 29 | |||
| 30 | REV_NAME_ALT=$REV_NAME/ | ||
| 31 | # grealpath is located in coreutils, there is no "realpath" for OS X :( | ||
| 32 | QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)") | ||
| 33 | BREW_PATH=$(brew --prefix) | ||
| 34 | QT_VERSION_NUM=5 | ||
| 35 | |||
| 36 | $BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \ | ||
| 37 | -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt" | ||
| 38 | |||
| 39 | # These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them. | ||
| 40 | declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport") | ||
| 41 | |||
| 42 | for macos_lib in "${macos_libs[@]}" | ||
| 43 | do | ||
| 44 | SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib | ||
| 45 | # Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/) | ||
| 46 | cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 47 | |||
| 48 | # Replace references within the embedded Framework files with "internal" versions. | ||
| 49 | for macos_lib2 in "${macos_libs[@]}" | ||
| 50 | do | ||
| 51 | # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated. | ||
| 52 | # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files. | ||
| 53 | # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't. | ||
| 54 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | ||
| 55 | install_name_tool -change \ | ||
| 56 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | ||
| 57 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 58 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 59 | install_name_tool -change \ | ||
| 60 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 61 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 62 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 63 | done | ||
| 64 | done | ||
| 65 | |||
| 66 | # Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"` | ||
| 67 | # Which manifests itself as: | ||
| 68 | # "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY" | ||
| 69 | # There may be more dylibs needed to be fixed... | ||
| 70 | declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib") | ||
| 71 | |||
| 72 | for macos_lib in "${macos_plugins[@]}" | ||
| 73 | do | ||
| 74 | install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 75 | for macos_lib2 in "${macos_libs[@]}" | ||
| 76 | do | ||
| 77 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | ||
| 78 | install_name_tool -change \ | ||
| 79 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | ||
| 80 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 81 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 82 | install_name_tool -change \ | ||
| 83 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 84 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 85 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 86 | done | ||
| 87 | done | ||
| 88 | |||
| 89 | for macos_lib in "${macos_libs[@]}" | ||
| 90 | do | ||
| 91 | # Debugging info for Travis-CI | ||
| 92 | otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" | ||
| 93 | done | ||
| 94 | |||
| 95 | # Make the citra-qt.app application launch a debugging terminal. | ||
| 96 | # Store away the actual binary | ||
| 97 | mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin | ||
| 98 | |||
| 99 | cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL | ||
| 100 | #!/usr/bin/env bash | ||
| 101 | cd "\`dirname "\$0"\`" | ||
| 102 | chmod +x citra-qt-bin | ||
| 103 | open citra-qt-bin --args "\$@" | ||
| 104 | EOL | ||
| 105 | # Content that will serve as the launching script for citra (within the .app folder) | ||
| 106 | |||
| 107 | # Make the launching script executable | ||
| 108 | chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt | ||
| 109 | |||
| 110 | . .travis/common/post-upload.sh | ||