1
0

before-deploy-osx.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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
  31. cp /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib ./OBS.app/Contents/Frameworks/
  32. cp /usr/local/opt/mbedtls/lib/libmbedcrypto.3.dylib ./OBS.app/Contents/Frameworks/
  33. cp /usr/local/opt/mbedtls/lib/libmbedx509.0.dylib ./OBS.app/Contents/Frameworks/
  34. chmod +w ./OBS.app/Contents/Frameworks/*.dylib
  35. install_name_tool -id @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Frameworks/libmbedtls.12.dylib
  36. install_name_tool -id @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Frameworks/libmbedcrypto.3.dylib
  37. install_name_tool -id @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Frameworks/libmbedx509.0.dylib
  38. install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  39. install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedcrypto.3.dylib @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  40. install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedx509.0.dylib @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  41. 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
  42. install_name_tool -change @rpath/libobs.0.dylib @executable_path/../Frameworks/libobs.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
  43. # copy sparkle into the app
  44. hr "Copying Sparkle.framework"
  45. cp -R ../../sparkle/Sparkle.framework ./OBS.app/Contents/Frameworks/
  46. install_name_tool -change @rpath/Sparkle.framework/Versions/A/Sparkle @executable_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle ./OBS.app/Contents/MacOS/obs
  47. # Copy Chromium embedded framework to app Frameworks directory
  48. hr "Copying Chromium Embedded Framework.framework"
  49. sudo mkdir -p OBS.app/Contents/Frameworks
  50. sudo cp -R ../../cef_binary_${CEF_BUILD_VERSION}_macosx64/Release/Chromium\ Embedded\ Framework.framework OBS.app/Contents/Frameworks/
  51. 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
  52. 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
  53. 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
  54. cp ../CI/install/osx/OBSPublicDSAKey.pem OBS.app/Contents/Resources
  55. # edit plist
  56. plutil -insert CFBundleVersion -string $GIT_TAG ./OBS.app/Contents/Info.plist
  57. plutil -insert CFBundleShortVersionString -string $GIT_TAG ./OBS.app/Contents/Info.plist
  58. plutil -insert OBSFeedsURL -string https://obsproject.com/osx_update/feeds.xml ./OBS.app/Contents/Info.plist
  59. plutil -insert SUFeedURL -string https://obsproject.com/osx_update/stable/updates.xml ./OBS.app/Contents/Info.plist
  60. plutil -insert SUPublicDSAKeyFile -string OBSPublicDSAKey.pem ./OBS.app/Contents/Info.plist
  61. dmgbuild -s ../CI/install/osx/settings.json "OBS" obs.dmg
  62. if [ -v "$TRAVIS" ]; then
  63. # Signing stuff
  64. hr "Decrypting Cert"
  65. openssl aes-256-cbc -K $encrypted_dd3c7f5e9db9_key -iv $encrypted_dd3c7f5e9db9_iv -in ../CI/osxcert/Certificates.p12.enc -out Certificates.p12 -d
  66. hr "Creating Keychain"
  67. security create-keychain -p mysecretpassword build.keychain
  68. security default-keychain -s build.keychain
  69. security unlock-keychain -p mysecretpassword build.keychain
  70. security set-keychain-settings -t 3600 -u build.keychain
  71. hr "Importing certs into keychain"
  72. security import ./Certificates.p12 -k build.keychain -T /usr/bin/productsign -P ""
  73. # macOS 10.12+
  74. security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword build.keychain
  75. fi
  76. cp ./OBS.dmg ./$FILENAME
  77. # Move to the folder that travis uses to upload artifacts from
  78. hr "Moving package to nightly folder for distribution"
  79. mkdir ../nightly
  80. sudo mv ./$FILENAME ../nightly