before-deploy-osx.sh 5.7 KB

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