Pārlūkot izejas kodu

CI: Update macOS build script to support alternative build configs

Also adds a tweak to the brew update which _might_ fix Azure CI.
PatTheMav 5 gadi atpakaļ
vecāks
revīzija
c16517ca83
2 mainītis faili ar 35 papildinājumiem un 11 dzēšanām
  1. 9 1
      .github/workflows/main.yml
  2. 26 10
      CI/full-build-macos.sh

+ 9 - 1
.github/workflows/main.yml

@@ -53,7 +53,15 @@ jobs:
       - name: 'Install prerequisites (Homebrew)'
       - name: 'Install prerequisites (Homebrew)'
         shell: bash
         shell: bash
         run: |
         run: |
-          brew update --preinstall
+          if [ -d /usr/local/opt/[email protected] ]; then
+              brew uninstall [email protected]
+              brew untap local/openssl
+          fi
+
+          if [ -d /usr/local/opt/[email protected] ]; then
+              brew uninstall [email protected]
+              brew untap local/python2
+          fi
           brew bundle --file ./CI/scripts/macos/Brewfile
           brew bundle --file ./CI/scripts/macos/Brewfile
       - name: 'Restore Chromium Embedded Framework from cache'
       - name: 'Restore Chromium Embedded Framework from cache'
         id: cef-cache
         id: cef-cache

+ 26 - 10
CI/full-build-macos.sh

@@ -38,6 +38,7 @@ PRODUCT_NAME="OBS-Studio"
 CHECKOUT_DIR="$(git rev-parse --show-toplevel)"
 CHECKOUT_DIR="$(git rev-parse --show-toplevel)"
 DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies"
 DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies"
 BUILD_DIR="${BUILD_DIR:-build}"
 BUILD_DIR="${BUILD_DIR:-build}"
+BUILD_CONFIG=${BUILD_CONFIG:-RelWithDebInfo}
 CI_SCRIPTS="${CHECKOUT_DIR}/CI/scripts/macos"
 CI_SCRIPTS="${CHECKOUT_DIR}/CI/scripts/macos"
 CI_WORKFLOW="${CHECKOUT_DIR}/.github/workflows/main.yml"
 CI_WORKFLOW="${CHECKOUT_DIR}/.github/workflows/main.yml"
 CI_CEF_VERSION=$(cat ${CI_WORKFLOW} | sed -En "s/[ ]+CEF_BUILD_VERSION: '([0-9]+)'/\1/p")
 CI_CEF_VERSION=$(cat ${CI_WORKFLOW} | sed -En "s/[ ]+CEF_BUILD_VERSION: '([0-9]+)'/\1/p")
@@ -130,7 +131,16 @@ install_homebrew_deps() {
         exit 1
         exit 1
     fi
     fi
 
 
-    brew update
+    if [ -d /usr/local/opt/[email protected] ]; then
+        brew uninstall [email protected]
+        brew untap local/openssl
+    fi
+
+    if [ -d /usr/local/opt/[email protected] ]; then
+        brew uninstall [email protected]
+        brew untap local/python2
+    fi
+
     brew bundle --file ${CI_SCRIPTS}/Brewfile
     brew bundle --file ${CI_SCRIPTS}/Brewfile
 
 
     check_curl
     check_curl
@@ -271,6 +281,7 @@ configure_obs_build() {
         -DBUILD_CAPTIONS=ON \
         -DBUILD_CAPTIONS=ON \
         -DWITH_RTMPS=ON \
         -DWITH_RTMPS=ON \
         -DCEF_ROOT_DIR="${DEPS_BUILD_DIR}/cef_binary_${CEF_BUILD_VERSION:-${CI_CEF_VERSION}}_macosx64" \
         -DCEF_ROOT_DIR="${DEPS_BUILD_DIR}/cef_binary_${CEF_BUILD_VERSION:-${CI_CEF_VERSION}}_macosx64" \
+        -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
         ..
         ..
 
 
 }
 }
@@ -296,7 +307,7 @@ bundle_dylibs() {
     ${CI_SCRIPTS}/app/dylibbundler -cd -of -a ./OBS.app -q -f \
     ${CI_SCRIPTS}/app/dylibbundler -cd -of -a ./OBS.app -q -f \
         -s ./OBS.app/Contents/MacOS \
         -s ./OBS.app/Contents/MacOS \
         -s "${DEPS_BUILD_DIR}/sparkle/Sparkle.framework" \
         -s "${DEPS_BUILD_DIR}/sparkle/Sparkle.framework" \
-        -s ./rundir/RelWithDebInfo/bin/ \
+        -s ./rundir/${BUILD_CONFIG}/bin/ \
         -x ./OBS.app/Contents/PlugIns/coreaudio-encoder.so \
         -x ./OBS.app/Contents/PlugIns/coreaudio-encoder.so \
         -x ./OBS.app/Contents/PlugIns/decklink-ouput-ui.so \
         -x ./OBS.app/Contents/PlugIns/decklink-ouput-ui.so \
         -x ./OBS.app/Contents/PlugIns/frontend-tools.so \
         -x ./OBS.app/Contents/PlugIns/frontend-tools.so \
@@ -321,7 +332,12 @@ bundle_dylibs() {
         -x ./OBS.app/Contents/PlugIns/obs-libfdk.so \
         -x ./OBS.app/Contents/PlugIns/obs-libfdk.so \
         -x ./OBS.app/Contents/PlugIns/obs-outputs.so
         -x ./OBS.app/Contents/PlugIns/obs-outputs.so
     step "Move libobs-opengl to final destination"
     step "Move libobs-opengl to final destination"
-    cp ./libobs-opengl/libobs-opengl.so ./OBS.app/Contents/Frameworks
+
+    if [ -f "./libobs-opengl/libobs-opengl.so" ]; then
+        cp ./libobs-opengl/libobs-opengl.so ./OBS.app/Contents/Frameworks
+    else
+        cp ./libobs-opengl/${BUILD_CONFIG}/libobs-opengl.so ./OBS.app/Contents/Frameworks
+    fi
 
 
     step "Copy QtNetwork for plugin support"
     step "Copy QtNetwork for plugin support"
     cp -R /tmp/obsdeps/lib/QtNetwork.framework ./OBS.app/Contents/Frameworks
     cp -R /tmp/obsdeps/lib/QtNetwork.framework ./OBS.app/Contents/Frameworks
@@ -350,7 +366,7 @@ install_frameworks() {
 prepare_macos_bundle() {
 prepare_macos_bundle() {
     ensure_dir "${CHECKOUT_DIR}/${BUILD_DIR}"
     ensure_dir "${CHECKOUT_DIR}/${BUILD_DIR}"
 
 
-    if [ ! -d ./rundir/RelWithDebInfo/bin ]; then
+    if [ ! -d ./rundir/${BUILD_CONFIG}/bin ]; then
         error "No OBS build found"
         error "No OBS build found"
         return
         return
     fi
     fi
@@ -363,12 +379,12 @@ prepare_macos_bundle() {
     mkdir OBS.app/Contents/PlugIns
     mkdir OBS.app/Contents/PlugIns
     mkdir OBS.app/Contents/Resources
     mkdir OBS.app/Contents/Resources
 
 
-    cp rundir/RelWithDebInfo/bin/obs ./OBS.app/Contents/MacOS
-    cp rundir/RelWithDebInfo/bin/obs-ffmpeg-mux ./OBS.app/Contents/MacOS
-    cp rundir/RelWithDebInfo/bin/libobsglad.0.dylib ./OBS.app/Contents/MacOS
-    cp -R rundir/RelWithDebInfo/data ./OBS.app/Contents/Resources
+    cp rundir/${BUILD_CONFIG}/bin/obs ./OBS.app/Contents/MacOS
+    cp rundir/${BUILD_CONFIG}/bin/obs-ffmpeg-mux ./OBS.app/Contents/MacOS
+    cp rundir/${BUILD_CONFIG}/bin/libobsglad.0.dylib ./OBS.app/Contents/MacOS
+    cp -R rundir/${BUILD_CONFIG}/data ./OBS.app/Contents/Resources
     cp ${CI_SCRIPTS}/app/obs.icns ./OBS.app/Contents/Resources
     cp ${CI_SCRIPTS}/app/obs.icns ./OBS.app/Contents/Resources
-    cp -R rundir/RelWithDebInfo/obs-plugins/ ./OBS.app/Contents/PlugIns
+    cp -R rundir/${BUILD_CONFIG}/obs-plugins/ ./OBS.app/Contents/PlugIns
     cp ${CI_SCRIPTS}/app/Info.plist ./OBS.app/Contents
     cp ${CI_SCRIPTS}/app/Info.plist ./OBS.app/Contents
     # Scripting plugins are required to be placed in same directory as binary
     # Scripting plugins are required to be placed in same directory as binary
     if [ -d ./OBS.app/Contents/Resources/data/obs-scripting ]; then
     if [ -d ./OBS.app/Contents/Resources/data/obs-scripting ]; then
@@ -657,4 +673,4 @@ obs-build-main() {
     cleanup
     cleanup
 }
 }
 
 
-obs-build-main $*
+obs-build-main $*