Skip to content

Commit

Permalink
CI: Add necessary build system changes for universal and M1 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
PatTheMav committed Oct 11, 2021
1 parent 7d75c6b commit 9adf898
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 20 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ on:

env:
CEF_BUILD_VERSION_MAC: '4183'
CEF_HASH_MAC: 'd2bd040013cf52135620d25003483fe75e7e8a893095a7d0b985176700b05beb'
CEF_BUILD_VERSION_LINUX: '4280'
CEF_BUILD_VERSION_WIN: '3770'
QT_VERSION_MAC: '5.15.2'
QT_HASH_MAC: 'a09690095d16b3f476ae6e0f5bf3154effcd6571738c1c40f8abbb83676d2afb'
QT_VERSION_WIN: '5.15.2'
DEPS_VERSION_MAC: '2021-02-28'
DEPS_VERSION_MAC: '2021-08-17'
DEPS_HASH_MAC: 'fc6b356572c4703d56f5b2deb98e46cddffb29a0d36c988702dd76329efe7072'
DEPS_VERSION_WIN: '2019'
VLC_VERSION_MAC: '3.0.8'
VLC_HASH_MAC: 'e0149ef4a20a19b9ecd87309c2d27787ee3f47dfd47c6639644bc1f6fd95bdf6'
VLC_VERSION_WIN: '3.0.0-git'
TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
Expand Down Expand Up @@ -57,6 +61,7 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
SPARKLE_VERSION: '1.26.0'
SPARKLE_HASH: '8312cbf7528297a49f1b97692c33cb8d33254c396dc51be394e9484e4b6833a0'
BLOCKED_FORMULAS: 'speexdsp curl php'
CODESIGN_IDENT: '-'
HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY != '' && secrets.MACOS_SIGNING_CERT != '' }}
Expand Down
2 changes: 2 additions & 0 deletions CI/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ print_usage() {
"-h, --help : Print this help\n" \
"-q, --quiet : Suppress most build process output\n" \
"-v, --verbose : Enable more verbose build process output\n" \
"-a, --architecture : Specify build architecture (default: x86_64, alternative: arm64)\n" \
"-d, --skip-dependency-checks : Skip dependency checks (default: off)\n" \
"-b, --bundle : Create relocatable application bundle (default: off)\n" \
"-p, --package : Create distributable disk image (default: off)\n" \
Expand Down Expand Up @@ -91,6 +92,7 @@ obs-build-main() {
-h | --help ) print_usage; exit 0 ;;
-q | --quiet ) export QUIET=TRUE; shift ;;
-v | --verbose ) export VERBOSE=TRUE; shift ;;
-a | --architecture ) ARCH="${2}"; shift 2 ;;
-d | --skip-dependency-checks ) SKIP_DEP_CHECKS=TRUE; shift ;;
-p | --package ) PACKAGE=TRUE; shift ;;
-c | --codesign ) CODESIGN=TRUE; shift ;;
Expand Down
2 changes: 2 additions & 0 deletions CI/include/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ brew "ccache"
brew "ninja"
brew "freetype"
brew "cmocka"
brew "swig"
brew "coreutils"
5 changes: 5 additions & 0 deletions CI/include/build_support_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
# Setup build environment

CI_DEPS_VERSION=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+DEPS_VERSION_MAC: '([0-9\-]+)'/\1/p")
CI_DEPS_HASH=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+DEPS_HASH_MAC: '([0-9a-f]+)'/\1/p")
CI_VLC_VERSION=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+VLC_VERSION_MAC: '([0-9\.]+)'/\1/p")
CI_VLC_HASH=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+VLC_HASH_MAC: '([0-9a-f]+)'/\1/p")
CI_SPARKLE_VERSION=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+SPARKLE_VERSION: '([0-9\.]+)'/\1/p")
CI_SPARKLE_HASH=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+SPARKLE_HASH: '([0-9a-f]+)'/\1/p")
CI_QT_VERSION=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+QT_VERSION_MAC: '([0-9\.]+)'/\1/p" | /usr/bin/head -1)
CI_QT_HASH=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+QT_HASH_MAC: '([0-9a-f]+)'/\1/p")
CI_MACOSX_DEPLOYMENT_TARGET=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+MACOSX_DEPLOYMENT_TARGET: '([0-9\.]+)'/\1/p")
CI_MACOS_CEF_VERSION=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+CEF_BUILD_VERSION_MAC: '([0-9]+)'/\1/p")
CI_CEF_HASH=$(/bin/cat "${CI_WORKFLOW}" | /usr/bin/sed -En "s/[ ]+CEF_HASH_MAC: '([0-9a-f]+)'/\1/p")

MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
MACOS_MAJOR="$(echo ${MACOS_VERSION} | /usr/bin/cut -d '.' -f 1)"
Expand Down
27 changes: 15 additions & 12 deletions CI/macos/01_install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ install_obs-deps() {
status "Set up precompiled macOS OBS dependencies v${1}"
ensure_dir "${DEPS_BUILD_DIR}"
step "Download..."
${CURLCMD:-curl} https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-${1}.tar.gz
check_and_fetch "https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-${1}-universal.tar.xz" "${2}"
mkdir -p obs-deps
step "Unpack..."
/usr/bin/tar -xf "./macos-deps-${1}.tar.gz" -C /tmp
/usr/bin/tar -xf "./macos-deps-${1}-universal.tar.xz" -C ./obs-deps
/usr/bin/xattr -r -d com.apple.quarantine ./obs-deps
}

install_qt-deps() {
status "Set up precompiled dependency Qt v${1}"
ensure_dir "${DEPS_BUILD_DIR}"
step "Download..."
${CURLCMD:-curl} https://github.com/obsproject/obs-deps/releases/download/${2}/macos-qt-${1}-${2}.tar.gz
check_and_fetch "https://github.com/obsproject/obs-deps/releases/download/${1}/macos-deps-qt-${1}-universal.tar.xz" "${2}"
mkdir -p obs-deps
step "Unpack..."
/usr/bin/tar -xf ./macos-qt-${1}-${2}.tar.gz -C /tmp
/usr/bin/xattr -r -d com.apple.quarantine /tmp/obsdeps
/usr/bin/tar -xf "./macos-deps-qt-${1}-universal.tar.xz" -C ./obs-deps
/usr/bin/xattr -r -d com.apple.quarantine ./obs-deps
}

install_vlc() {
Expand Down Expand Up @@ -62,7 +65,7 @@ install_sparkle() {

if [ -z "${_SKIP}" ]; then
step "Download..."
${CURLCMD:-curl} https://github.com/sparkle-project/Sparkle/releases/download/${1}/Sparkle-${1}.tar.xz
check_and_fetch "https://github.com/sparkle-project/Sparkle/releases/download/${1}/Sparkle-${1}.tar.xz" "${2}"
step "Unpack..."
ensure_dir "${DEPS_BUILD_DIR}/sparkle"
/usr/bin/tar -xf ../Sparkle-${1}.tar.xz
Expand Down Expand Up @@ -117,11 +120,11 @@ install_dependencies() {
trap "caught_error 'install_dependencies'" ERR

BUILD_DEPS=(
"obs-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}}"
"qt-deps ${QT_VERSION:-${CI_QT_VERSION}} ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}}"
"cef ${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}"
"vlc ${VLC_VERSION:-${CI_VLC_VERSION}}"
"sparkle ${SPARKLE_VERSION:-${CI_SPARKLE_VERSION}}"
"obs-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}} ${MACOS_DEPS_HASH:-${CI_DEPS_HASH}}"
"qt-deps ${MACOS_DEPS_VERSION:-${CI_DEPS_VERSION}} ${QT_HASH:-${CI_QT_HASH}}"
"cef ${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}} ${CEF_HASH:-${CI_CEF_HASH}}"
"vlc ${VLC_VERSION:-${CI_VLC_VERSION}} ${VLC_HASH:-${CI_VLC_HASH}}"
"sparkle ${SPARKLE_VERSION:-${CI_SPARKLE_VERSION}} ${SPARKLE_HASH:-${CI_SPARKLE_HASH}}"
)

install_homebrew_deps
Expand All @@ -130,7 +133,7 @@ install_dependencies() {
set -- ${DEPENDENCY}
trap "caught_error ${DEPENDENCY}" ERR
FUNC_NAME="install_${1}"
${FUNC_NAME} ${2} ${3}
${FUNC_NAME} ${2} ${3} ${4}
done
}

Expand Down
2 changes: 1 addition & 1 deletion CI/macos/02_build_obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ _configure_obs() {
cmake -S . -B ${BUILD_DIR} -G Ninja \
-DCEF_ROOT_DIR="${DEPS_BUILD_DIR}/cef_binary_${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}_macos_${ARCH:-x86_64}" \
-DVLC_PATH="${DEPS_BUILD_DIR}/vlc-${VLC_VERSION:-${CI_VLC_VERSION}}" \
-DCMAKE_PREFIX_PATH="/tmp/obsdeps;${DEPS_BUILD_DIR}/sparkle" \
-DCMAKE_PREFIX_PATH="${DEPS_BUILD_DIR}/obs-deps;${DEPS_BUILD_DIR}/sparkle" \
-DBROWSER_LEGACY=$(test "${MACOS_CEF_BUILD_VERSION:-${CI_MACOS_CEF_VERSION}}" -le 3770 && echo "ON" || echo "OFF") \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-${CI_MACOSX_DEPLOYMENT_TARGET}} \
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_ARCHS} \
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/CompilerConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ endif()

if(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES
"(i[3-6]86|x86|x64|x86_64|amd64|e2k)")
if(NOT MSVC)
if(NOT MSVC AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(ARCH_SIMD_FLAGS "-mmmx;-msse;-msse2")
endif()
elseif(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
Expand Down
11 changes: 6 additions & 5 deletions cmake/Modules/ObsHelpers_macOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,12 @@ endfunction()
function(setup_obs_bundle target)
install(
CODE "
set(_BUILD_FOR_DISTRIBUTION \"${BUILD_FOR_DISTRIBUTION}\")
set(_BUNDLENAME \"$<TARGET_FILE_BASE_NAME:${target}>.app\")
set(_BUNDLER_COMMAND \"${CMAKE_SOURCE_DIR}/cmake/bundle/macos/dylibbundler\")
set(_CODESIGN_IDENTITY \"${OBS_BUNDLE_CODESIGN_IDENTITY}\")
set(_CODESIGN_ENTITLEMENTS \"${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist\")"
set(_DEPENDENCY_PREFIX \"${CMAKE_PREFIX_PATH}\")
set(_BUILD_FOR_DISTRIBUTION \"${BUILD_FOR_DISTRIBUTION}\")
set(_BUNDLENAME \"$<TARGET_FILE_BASE_NAME:${target}>.app\")
set(_BUNDLER_COMMAND \"${CMAKE_SOURCE_DIR}/cmake/bundle/macos/dylibbundler\")
set(_CODESIGN_IDENTITY \"${OBS_BUNDLE_CODESIGN_IDENTITY}\")
set(_CODESIGN_ENTITLEMENTS \"${CMAKE_SOURCE_DIR}/cmake/bundle/macOS/entitlements.plist\")"
COMPONENT obs_resources)

if(ENABLE_SPARKLE_UPDATER)
Expand Down
4 changes: 4 additions & 0 deletions cmake/bundle/macOS/bundleutils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ endif()
list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/lib\"")
list(APPEND _FIXUP_BUNDLES "-s \"${CMAKE_INSTALL_PREFIX}/Frameworks\"")

foreach(_PREFIX_PATH IN LISTS _DEPENDENCY_PREFIX)
list(APPEND _FIXUP_BUNDLES "-s \"${_PREFIX_PATH}/lib\"")
endforeach()

# Unlinked modules need to be supplied manually to dylibbundler

# Find all modules (plugin and standalone)
Expand Down

0 comments on commit 9adf898

Please sign in to comment.