From 15a2388a33b1306dcaf16b62432c7a13b40ca2a3 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Fri, 6 Oct 2017 20:58:48 +0100 Subject: [PATCH] travis: Split build scripts for different platforms This commit also separates clang-format from the linux build, closing #2702. --- .travis-build.sh | 59 -------- .travis-deps.sh | 12 -- .travis-upload.sh | 139 ------------------ .travis.yml | 34 +++-- .travis/clang-format/script.sh | 37 +++++ .travis/common/post-upload.sh | 22 +++ .travis/common/pre-upload.sh | 6 + .travis/linux/build.sh | 3 + .travis/linux/deps.sh | 3 + .../linux/docker.sh | 5 +- .travis/linux/upload.sh | 14 ++ .travis/macos/build.sh | 12 ++ .travis/macos/deps.sh | 4 + .travis/macos/upload.sh | 110 ++++++++++++++ 14 files changed, 233 insertions(+), 227 deletions(-) delete mode 100755 .travis-build.sh delete mode 100755 .travis-deps.sh delete mode 100755 .travis-upload.sh create mode 100755 .travis/clang-format/script.sh create mode 100755 .travis/common/post-upload.sh create mode 100755 .travis/common/pre-upload.sh create mode 100755 .travis/linux/build.sh create mode 100755 .travis/linux/deps.sh rename .travis-build-docker.sh => .travis/linux/docker.sh (94%) mode change 100644 => 100755 create mode 100755 .travis/linux/upload.sh create mode 100755 .travis/macos/build.sh create mode 100755 .travis/macos/deps.sh create mode 100755 .travis/macos/upload.sh diff --git a/.travis-build.sh b/.travis-build.sh deleted file mode 100755 index fc5a5f8b2a..0000000000 --- a/.travis-build.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -set -e -set -x - -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 - -# Only run clang-format on Linux because we don't have 4.0 on OS X images -if [ "$TRAVIS_OS_NAME" = "linux" ]; then - # 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 -fi - -#if OS is linux or is not set -if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then - docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash /citra/.travis-build-docker.sh -elif [ "$TRAVIS_OS_NAME" = "osx" ]; then - 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 -fi diff --git a/.travis-deps.sh b/.travis-deps.sh deleted file mode 100755 index 0cee68041b..0000000000 --- a/.travis-deps.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -set -e -set -x - -#if OS is linux or is not set -if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then - docker pull ubuntu:16.04 -elif [ "$TRAVIS_OS_NAME" = "osx" ]; then - brew update - brew install qt5 sdl2 dylibbundler p7zip -fi diff --git a/.travis-upload.sh b/.travis-upload.sh deleted file mode 100755 index edf195f7d5..0000000000 --- a/.travis-upload.sh +++ /dev/null @@ -1,139 +0,0 @@ -GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" -GITREV="`git show -s --format='%h'`" -mkdir -p artifacts - -if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then - 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" -elif [ "$TRAVIS_OS_NAME" = "osx" ]; then - 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 - - 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 < ../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 <