diff options
| author | 2019-04-01 14:59:44 -0400 | |
|---|---|---|
| committer | 2019-04-01 14:59:44 -0400 | |
| commit | ffc72c8f15009cfa9a296c2303b8d79d62b2ca19 (patch) | |
| tree | aa9723db428db57f09013a11e27c35d7807044c9 | |
| parent | Merge pull request #2312 from lioncash/locks (diff) | |
| parent | travis/macos: Use macpack to bundle dependencies (diff) | |
| download | yuzu-ffc72c8f15009cfa9a296c2303b8d79d62b2ca19.tar.gz yuzu-ffc72c8f15009cfa9a296c2303b8d79d62b2ca19.tar.xz yuzu-ffc72c8f15009cfa9a296c2303b8d79d62b2ca19.zip | |
Merge pull request #2283 from FearlessTobi/port-4517
Port citra-emu/citra#4517 & citra-emu/citra#4686: Changes to macOS buildscripts
Diffstat (limited to '')
| -rwxr-xr-x | .travis/macos/deps.sh | 3 | ||||
| -rwxr-xr-x | .travis/macos/upload.sh | 94 |
2 files changed, 14 insertions, 83 deletions
diff --git a/.travis/macos/deps.sh b/.travis/macos/deps.sh index 1a547c060..faeafa216 100755 --- a/.travis/macos/deps.sh +++ b/.travis/macos/deps.sh | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #!/bin/sh -ex | 1 | #!/bin/sh -ex |
| 2 | 2 | ||
| 3 | brew update | 3 | brew update |
| 4 | brew install dylibbundler p7zip qt5 sdl2 ccache | 4 | brew install p7zip qt5 sdl2 ccache |
| 5 | brew outdated cmake || brew upgrade cmake | 5 | brew outdated cmake || brew upgrade cmake |
| 6 | pip3 install macpack | ||
diff --git a/.travis/macos/upload.sh b/.travis/macos/upload.sh index 9ba95086b..66e3455ff 100755 --- a/.travis/macos/upload.sh +++ b/.travis/macos/upload.sh | |||
| @@ -11,92 +11,19 @@ mkdir "$REV_NAME" | |||
| 11 | cp build/bin/yuzu-cmd "$REV_NAME" | 11 | cp build/bin/yuzu-cmd "$REV_NAME" |
| 12 | cp -r build/bin/yuzu.app "$REV_NAME" | 12 | cp -r build/bin/yuzu.app "$REV_NAME" |
| 13 | 13 | ||
| 14 | # move qt libs into app bundle for deployment | 14 | # move libs into folder for deployment |
| 15 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/yuzu.app" | 15 | macpack "${REV_NAME}/yuzu.app/Contents/MacOS/yuzu" -d "../Frameworks" |
| 16 | # move qt frameworks into app bundle for deployment | ||
| 17 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/yuzu.app" -executable="${REV_NAME}/yuzu.app/Contents/MacOS/yuzu" | ||
| 16 | 18 | ||
| 17 | # move SDL2 libs into folder for deployment | 19 | # move libs into folder for deployment |
| 18 | dylibbundler -b -x "${REV_NAME}/yuzu-cmd" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" | 20 | macpack "${REV_NAME}/yuzu-cmd" -d "libs" |
| 19 | |||
| 20 | # Make the changes to make the yuzu 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}yuzu.app" \ | ||
| 37 | -executable="${REV_NAME_ALT}yuzu.app/Contents/MacOS/yuzu" | ||
| 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}yuzu.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}yuzu.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}yuzu.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}yuzu.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}yuzu.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}yuzu.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}yuzu.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" | ||
| 93 | done | ||
| 94 | 21 | ||
| 95 | # Make the yuzu.app application launch a debugging terminal. | 22 | # Make the yuzu.app application launch a debugging terminal. |
| 96 | # Store away the actual binary | 23 | # Store away the actual binary |
| 97 | mv ${REV_NAME_ALT}yuzu.app/Contents/MacOS/yuzu ${REV_NAME_ALT}yuzu.app/Contents/MacOS/yuzu-bin | 24 | mv ${REV_NAME}/yuzu.app/Contents/MacOS/yuzu ${REV_NAME}/yuzu.app/Contents/MacOS/yuzu-bin |
| 98 | 25 | ||
| 99 | cat > ${REV_NAME_ALT}yuzu.app/Contents/MacOS/yuzu <<EOL | 26 | cat > ${REV_NAME}/yuzu.app/Contents/MacOS/yuzu <<EOL |
| 100 | #!/usr/bin/env bash | 27 | #!/usr/bin/env bash |
| 101 | cd "\`dirname "\$0"\`" | 28 | cd "\`dirname "\$0"\`" |
| 102 | chmod +x yuzu-bin | 29 | chmod +x yuzu-bin |
| @@ -105,6 +32,9 @@ EOL | |||
| 105 | # Content that will serve as the launching script for yuzu (within the .app folder) | 32 | # Content that will serve as the launching script for yuzu (within the .app folder) |
| 106 | 33 | ||
| 107 | # Make the launching script executable | 34 | # Make the launching script executable |
| 108 | chmod +x ${REV_NAME_ALT}yuzu.app/Contents/MacOS/yuzu | 35 | chmod +x ${REV_NAME}/yuzu.app/Contents/MacOS/yuzu |
| 36 | |||
| 37 | # Verify loader instructions | ||
| 38 | find "$REV_NAME" -exec otool -L {} \; | ||
| 109 | 39 | ||
| 110 | . .travis/common/post-upload.sh | 40 | . .travis/common/post-upload.sh |