before-deploy-osx.sh 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. hr() {
  2. echo "───────────────────────────────────────────────────"
  3. echo $1
  4. echo "───────────────────────────────────────────────────"
  5. }
  6. # Exit if something fails
  7. set -e
  8. # Generate file name variables
  9. export GIT_TAG=$(git describe --abbrev=0)
  10. export GIT_HASH=$(git rev-parse --short HEAD)
  11. export FILE_DATE=$(date +%Y-%m-%d.%H-%M-%S)
  12. export FILENAME=$FILE_DATE-$GIT_HASH-$TRAVIS_BRANCH-osx.dmg
  13. echo "git tag: $GIT_TAG"
  14. cd ./build
  15. # Move obslua
  16. hr "Moving OBS LUA"
  17. mv ./rundir/RelWithDebInfo/data/obs-scripting/obslua.so ./rundir/RelWithDebInfo/bin/
  18. # Move obspython
  19. hr "Moving OBS Python"
  20. # mv ./rundir/RelWithDebInfo/data/obs-scripting/_obspython.so ./rundir/RelWithDebInfo/bin/
  21. # mv ./rundir/RelWithDebInfo/data/obs-scripting/obspython.py ./rundir/RelWithDebInfo/bin/
  22. # Package everything into a nice .app
  23. hr "Packaging .app"
  24. STABLE=false
  25. if [ -n "${TRAVIS_TAG}" ]; then
  26. STABLE=true
  27. fi
  28. #sudo python ../CI/install/osx/build_app.py --public-key ../CI/install/osx/OBSPublicDSAKey.pem --sparkle-framework ../../sparkle/Sparkle.framework --stable=$STABLE
  29. ../CI/install/osx/packageApp.sh
  30. # fix obs outputs plugin it doesn't play nicely with dylibBundler at the moment
  31. if [ -f /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib ]; then
  32. cp /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib ./OBS.app/Contents/Frameworks/
  33. cp /usr/local/opt/mbedtls/lib/libmbedcrypto.3.dylib ./OBS.app/Contents/Frameworks/
  34. cp /usr/local/opt/mbedtls/lib/libmbedx509.0.dylib ./OBS.app/Contents/Frameworks/
  35. chmod +w ./OBS.app/Contents/Frameworks/*.dylib
  36. install_name_tool -id @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Frameworks/libmbedtls.12.dylib
  37. install_name_tool -id @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Frameworks/libmbedcrypto.3.dylib
  38. install_name_tool -id @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Frameworks/libmbedx509.0.dylib
  39. install_name_tool -change libmbedtls.12.dylib @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  40. install_name_tool -change libmbedcrypto.3.dylib @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  41. install_name_tool -change libmbedx509.0.dylib @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  42. elif [ -f /usr/local/opt/mbedtls/lib/libmbedtls.13.dylib ]; then
  43. cp /usr/local/opt/mbedtls/lib/libmbedtls.13.dylib ./OBS.app/Contents/Frameworks/
  44. cp /usr/local/opt/mbedtls/lib/libmbedcrypto.5.dylib ./OBS.app/Contents/Frameworks/
  45. cp /usr/local/opt/mbedtls/lib/libmbedx509.1.dylib ./OBS.app/Contents/Frameworks/
  46. chmod +w ./OBS.app/Contents/Frameworks/*.dylib
  47. install_name_tool -id @executable_path/../Frameworks/libmbedtls.13.dylib ./OBS.app/Contents/Frameworks/libmbedtls.13.dylib
  48. install_name_tool -id @executable_path/../Frameworks/libmbedcrypto.5.dylib ./OBS.app/Contents/Frameworks/libmbedcrypto.5.dylib
  49. install_name_tool -id @executable_path/../Frameworks/libmbedx509.1.dylib ./OBS.app/Contents/Frameworks/libmbedx509.1.dylib
  50. install_name_tool -change libmbedtls.13.dylib @executable_path/../Frameworks/libmbedtls.13.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  51. install_name_tool -change libmbedcrypto.5.dylib @executable_path/../Frameworks/libmbedcrypto.5.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  52. install_name_tool -change libmbedx509.1.dylib @executable_path/../Frameworks/libmbedx509.1.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  53. fi
  54. install_name_tool -change /usr/local/opt/curl/lib/libcurl.4.dylib @executable_path/../Frameworks/libcurl.4.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  55. install_name_tool -change @rpath/libobs.0.dylib @executable_path/../Frameworks/libobs.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  56. install_name_tool -change /tmp/obsdeps/bin/libjansson.4.dylib @executable_path/../Frameworks/libjansson.4.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  57. # copy sparkle into the app
  58. hr "Copying Sparkle.framework"
  59. cp -R ../../sparkle/Sparkle.framework ./OBS.app/Contents/Frameworks/
  60. install_name_tool -change @rpath/Sparkle.framework/Versions/A/Sparkle @executable_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle ./OBS.app/Contents/MacOS/obs
  61. # Copy Chromium embedded framework to app Frameworks directory
  62. hr "Copying Chromium Embedded Framework.framework"
  63. sudo mkdir -p OBS.app/Contents/Frameworks
  64. sudo cp -R ../../cef_binary_${CEF_BUILD_VERSION}_macosx64/Release/Chromium\ Embedded\ Framework.framework OBS.app/Contents/Frameworks/
  65. install_name_tool -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/obs-browser.so
  66. install_name_tool -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/obs-browser.so
  67. install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/obs-browser.so
  68. cp ../CI/install/osx/OBSPublicDSAKey.pem OBS.app/Contents/Resources
  69. # edit plist
  70. plutil -insert CFBundleVersion -string $GIT_TAG ./OBS.app/Contents/Info.plist
  71. plutil -insert CFBundleShortVersionString -string $GIT_TAG ./OBS.app/Contents/Info.plist
  72. plutil -insert OBSFeedsURL -string https://obsproject.com/osx_update/feeds.xml ./OBS.app/Contents/Info.plist
  73. plutil -insert SUFeedURL -string https://obsproject.com/osx_update/stable/updates.xml ./OBS.app/Contents/Info.plist
  74. plutil -insert SUPublicDSAKeyFile -string OBSPublicDSAKey.pem ./OBS.app/Contents/Info.plist
  75. dmgbuild -s ../CI/install/osx/settings.json "OBS" obs.dmg
  76. if [ -v "$TRAVIS" ]; then
  77. # Signing stuff
  78. hr "Decrypting Cert"
  79. openssl aes-256-cbc -K $encrypted_dd3c7f5e9db9_key -iv $encrypted_dd3c7f5e9db9_iv -in ../CI/osxcert/Certificates.p12.enc -out Certificates.p12 -d
  80. hr "Creating Keychain"
  81. security create-keychain -p mysecretpassword build.keychain
  82. security default-keychain -s build.keychain
  83. security unlock-keychain -p mysecretpassword build.keychain
  84. security set-keychain-settings -t 3600 -u build.keychain
  85. hr "Importing certs into keychain"
  86. security import ./Certificates.p12 -k build.keychain -T /usr/bin/productsign -P ""
  87. # macOS 10.12+
  88. security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword build.keychain
  89. fi
  90. cp ./OBS.dmg ./$FILENAME
  91. # Move to the folder that travis uses to upload artifacts from
  92. hr "Moving package to nightly folder for distribution"
  93. mkdir ../nightly
  94. sudo mv ./$FILENAME ../nightly