mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-27 10:00:24 -04:00
CI: Simplify build scripts for CI-only use
This commit is contained in:
237
.github/scripts/.build.zsh
vendored
237
.github/scripts/.build.zsh
vendored
@@ -16,27 +16,22 @@ setopt FUNCTION_ARGZERO
|
||||
#setopt WARN_NESTED_VAR
|
||||
#setopt XTRACE
|
||||
|
||||
if (( ! ${+CI} )) {
|
||||
print -u2 -PR "%F{1} ✖︎ ${ZSH_ARGZERO:t:r} requires CI environment.%f"
|
||||
exit 1
|
||||
}
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TRAPEXIT() {
|
||||
local return_value=$?
|
||||
|
||||
if (( ${+CI} )) unset NSUnbufferedIO
|
||||
|
||||
return ${return_value}
|
||||
}
|
||||
|
||||
TRAPZERR() {
|
||||
if (( ${_loglevel:-3} > 2 )) {
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
}
|
||||
print -u2 -PR "::error::%F{1} ✖︎ script execution error.%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
|
||||
exit 2
|
||||
}
|
||||
@@ -48,91 +43,41 @@ build() {
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=(${SCRIPT_HOME}/utils.zsh ${fpath})
|
||||
autoload -Uz log_group log_info log_status log_error log_output set_loglevel check_${host_os} setup_ccache
|
||||
autoload -Uz log_group log_error log_output check_${host_os} setup_ccache
|
||||
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.' \
|
||||
'A buildspec.json.template file is provided in the repository to get you started.'
|
||||
log_error 'Missing buildspec.json in project checkout.'
|
||||
return 2
|
||||
}
|
||||
|
||||
typeset -g -a skips=()
|
||||
local -i verbosity=1
|
||||
local -r _version='1.0.0'
|
||||
local -i debug=0
|
||||
|
||||
local target
|
||||
local -r -a _valid_targets=(
|
||||
macos-x86_64
|
||||
macos-arm64
|
||||
linux-x86_64
|
||||
)
|
||||
local target
|
||||
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
local -i codesign=0
|
||||
|
||||
if [[ ${host_os} == linux ]] {
|
||||
local -r -a _valid_generators=(Ninja 'Unix Makefiles')
|
||||
local generator='Ninja'
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for Linux builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B--generator%b Specify build system to generate
|
||||
Available generators:
|
||||
- Ninja
|
||||
- Unix Makefiles"
|
||||
} elif [[ ${host_os} == macos ]] {
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for macOS builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)"
|
||||
}
|
||||
|
||||
local -i _print_config=0
|
||||
local -r _usage="
|
||||
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||
|
||||
%BOptions%b:
|
||||
|
||||
%F{yellow} Build configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
|
||||
%B-c | --config%b Build configuration
|
||||
%B--print-config%b Print composed CMake configuration parameters
|
||||
%B--skip-[all|build|deps]%b Skip all|building OBS|checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-t|--target|--generator|-c|--config)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--)
|
||||
shift
|
||||
args+=($@)
|
||||
break
|
||||
;;
|
||||
--) shift; args+=($@); break ;;
|
||||
-t|--target)
|
||||
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
target=${2}
|
||||
@@ -141,37 +86,13 @@ ${_usage_host:-}"
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
--generator)
|
||||
if [[ ${host_os} == linux ]] {
|
||||
if (( ! ${_valid_generators[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
generator=${2}
|
||||
}
|
||||
shift 2
|
||||
;;
|
||||
--print-config) _print_config=1; skips+=(unpack deps); shift ;;
|
||||
--skip-*)
|
||||
local _skip="${${(s:-:)1}[-1]}"
|
||||
local _check=(all deps build)
|
||||
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
|
||||
skips+=(${_skip})
|
||||
shift
|
||||
;;
|
||||
--debug) debug=1; shift ;;
|
||||
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||
}
|
||||
}
|
||||
@@ -179,11 +100,8 @@ ${_usage_host:-}"
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
check_${host_os}
|
||||
}
|
||||
check_${host_os}
|
||||
setup_ccache
|
||||
|
||||
if [[ ${host_os} == linux ]] {
|
||||
@@ -191,82 +109,39 @@ ${_usage_host:-}"
|
||||
}
|
||||
|
||||
local product_name
|
||||
read -r product_name <<< \
|
||||
"$(jq -r '.name' ${buildspec_file})"
|
||||
read -r product_name <<< "$(jq -r '.name' ${buildspec_file})"
|
||||
|
||||
pushd ${project_root}
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_group "Configuring ${product_name}..."
|
||||
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
case ${_loglevel} {
|
||||
0) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR) ;;
|
||||
1) ;;
|
||||
2) cmake_build_args+=(--verbose) ;;
|
||||
*) cmake_args+=(--debug-output) ;;
|
||||
}
|
||||
if (( debug )) cmake_args+=(--debug-output)
|
||||
|
||||
case ${target} {
|
||||
macos-*)
|
||||
cmake_args+=(
|
||||
--preset "macos${CI:+-ci}"
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING=${target##*-}
|
||||
)
|
||||
case ${target} {
|
||||
macos-*)
|
||||
cmake_args+=(--preset 'macos-ci' -DCMAKE_OSX_ARCHITECTURES:STRING=${target##*-})
|
||||
|
||||
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
|
||||
typeset -gx NSUnbufferedIO=YES
|
||||
|
||||
if (( codesign )) {
|
||||
autoload -Uz read_codesign_team && read_codesign_team
|
||||
typeset -gx CODESIGN_IDENT="${CODESIGN_IDENT:--}"
|
||||
if (( codesign )) && [[ -z ${CODESIGN_TEAM} ]] {
|
||||
typeset -gx CODESIGN_TEAM="$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')"
|
||||
}
|
||||
|
||||
if [[ -z ${CODESIGN_TEAM} ]] {
|
||||
autoload -Uz read_codesign && read_codesign
|
||||
}
|
||||
}
|
||||
log_group "Configuring ${product_name}..."
|
||||
cmake -S ${project_root} ${cmake_args}
|
||||
|
||||
cmake_args+=(
|
||||
-DOBS_CODESIGN_TEAM:STRING=${CODESIGN_TEAM:-}
|
||||
-DOBS_CODESIGN_IDENTITY:STRING=${CODESIGN_IDENT:--}
|
||||
)
|
||||
;;
|
||||
linux-*)
|
||||
cmake_args+=(
|
||||
-S ${PWD} -B "build_${target##*-}"
|
||||
-G "${generator}"
|
||||
-DCMAKE_BUILD_TYPE:STRING=${config}
|
||||
-DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//-/_}"
|
||||
)
|
||||
|
||||
local cmake_version
|
||||
read -r _ _ cmake_version <<< "$(cmake --version)"
|
||||
|
||||
cmake_build_args+=("build_${target##*-}" --config ${config})
|
||||
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] {
|
||||
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))
|
||||
log_group "Building ${product_name}..."
|
||||
run_xcodebuild() {
|
||||
if (( debug )) {
|
||||
xcodebuild ${@}
|
||||
} else {
|
||||
cmake_build_args+=(--parallel)
|
||||
xcodebuild ${@} 2>&1 | xcbeautify
|
||||
}
|
||||
}
|
||||
|
||||
cmake_args+=(
|
||||
-DENABLE_AJA:BOOL=OFF
|
||||
-DENABLE_WEBRTC:BOOL=OFF
|
||||
)
|
||||
if (( ! UBUNTU_2210_OR_LATER )) cmake_args+=(-DENABLE_NEW_MPEGTS_OUTPUT:BOOL=OFF)
|
||||
|
||||
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/build_${target##*-}/install/${config})
|
||||
;;
|
||||
}
|
||||
|
||||
if (( _print_config )) { log_output "CMake configuration: ${cmake_args}"; exit 0 }
|
||||
|
||||
log_debug "Attempting to configure with CMake arguments: ${cmake_args}"
|
||||
cmake -S ${project_root} ${cmake_args}
|
||||
|
||||
log_group "Building ${product_name}..."
|
||||
if [[ ${host_os} == macos ]] {
|
||||
local -a build_args=(
|
||||
ONLY_ACTIVE_ARCH=NO
|
||||
-project obs-studio.xcodeproj
|
||||
@@ -296,9 +171,8 @@ ${_usage_host:-}"
|
||||
-exportPath ${project_root}/build_macos
|
||||
)
|
||||
|
||||
autoload -Uz run_xcodebuild
|
||||
pushd build_macos
|
||||
if (( ${+CI} )) && [[ ${GITHUB_EVENT_NAME} == push && ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]] {
|
||||
if [[ ${GITHUB_EVENT_NAME} == push && ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]] {
|
||||
run_xcodebuild ${archive_args}
|
||||
run_xcodebuild ${export_args}
|
||||
} else {
|
||||
@@ -309,16 +183,35 @@ ${_usage_host:-}"
|
||||
ditto UI/${config}/OBS.app OBS.app
|
||||
}
|
||||
popd
|
||||
} else {
|
||||
;;
|
||||
linux-*)
|
||||
cmake_args+=(
|
||||
-S ${PWD} -B build_${target##*-}
|
||||
-G Ninja
|
||||
-DCMAKE_BUILD_TYPE:STRING=${config}
|
||||
-DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//-/_}"
|
||||
-DENABLE_AJA:BOOL=OFF
|
||||
-DENABLE_WEBRTC:BOOL=OFF
|
||||
)
|
||||
if (( ! UBUNTU_2210_OR_LATER )) cmake_args+=(-DENABLE_NEW_MPEGTS_OUTPUT:BOOL=OFF)
|
||||
|
||||
cmake_build_args+=(build_${target##*-} --config ${config} --parallel)
|
||||
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/build_${target##*-}/install/${config})
|
||||
|
||||
log_group "Configuring ${product_name}..."
|
||||
cmake -S ${project_root} ${cmake_args}
|
||||
|
||||
log_group "Building ${product_name}..."
|
||||
if (( debug )) cmake_build_args+=(--verbose)
|
||||
cmake ${cmake_build_args}
|
||||
|
||||
log_group "Installing ${product_name}..."
|
||||
if (( _loglevel > 1 )) cmake_install_args+=(--verbose)
|
||||
if (( debug )) cmake_install_args+=(--verbose)
|
||||
cmake ${cmake_install_args}
|
||||
popd
|
||||
}
|
||||
log_group
|
||||
;;
|
||||
}
|
||||
popd
|
||||
log_group
|
||||
}
|
||||
|
||||
build ${@}
|
||||
|
||||
118
.github/scripts/.package.zsh
vendored
118
.github/scripts/.package.zsh
vendored
@@ -16,29 +16,22 @@ setopt FUNCTION_ARGZERO
|
||||
#setopt WARN_NESTED_VAR
|
||||
#setopt XTRACE
|
||||
|
||||
if (( ! ${+CI} )) {
|
||||
print -u2 -PR "%F{1} ✖︎ ${ZSH_ARGZERO:t:r} requires CI environment%f"
|
||||
exit 1
|
||||
}
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TRAPEXIT() {
|
||||
local return_value=$?
|
||||
|
||||
if (( ${+CI} )) {
|
||||
unset NSUnbufferedIO
|
||||
}
|
||||
|
||||
return ${return_value}
|
||||
}
|
||||
|
||||
TRAPZERR() {
|
||||
if (( ${_loglevel:-3} > 2 )) {
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
}
|
||||
print -u2 -PR "::error::%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
|
||||
exit 2
|
||||
}
|
||||
@@ -50,76 +43,40 @@ package() {
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=(${SCRIPT_HOME}/utils.zsh ${fpath})
|
||||
autoload -Uz set_loglevel log_info log_error log_output check_${host_os}
|
||||
autoload -Uz log_error log_output log_group check_${host_os}
|
||||
|
||||
local -i verbosity=1
|
||||
local -r _version='1.0.0'
|
||||
local -i debug=0
|
||||
|
||||
local target
|
||||
local -r -a _valid_targets=(
|
||||
macos-x86_64
|
||||
macos-arm64
|
||||
linux-x86_64
|
||||
)
|
||||
local target
|
||||
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
|
||||
local -i codesign=0
|
||||
local -i notarize=0
|
||||
local -i package=0
|
||||
local -i skip_deps=0
|
||||
|
||||
if [[ ${host_os} == macos ]] {
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for macOS builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-s | --codesign%b Enable codesigning (macOS only)
|
||||
%B-n | --notarize%b Enable notarization (macOS only)"
|
||||
}
|
||||
|
||||
local -r _usage="
|
||||
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||
|
||||
%BOptions%b:
|
||||
|
||||
%F{yellow} Package configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
|
||||
%B-c | --config%b Build configuration
|
||||
%B-p | --package%b Create package installer (macOS only)
|
||||
%B--skip-deps%b Skip checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-t|--target|-c|--config)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--)
|
||||
shift
|
||||
args+=($@)
|
||||
break
|
||||
;;
|
||||
--) shift; args+=($@); break ;;
|
||||
-t|--target)
|
||||
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
target=${2}
|
||||
@@ -128,7 +85,6 @@ ${_usage_host:-}"
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
@@ -137,12 +93,7 @@ ${_usage_host:-}"
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
-n|--notarize) notarize=1; shift ;;
|
||||
-p|--package) typeset -g package=1; shift ;;
|
||||
--skip-deps) typeset -g skip_deps=1; shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
--debug) debug=0; shift ;;
|
||||
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||
}
|
||||
}
|
||||
@@ -150,11 +101,8 @@ ${_usage_host:-}"
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
if (( ! skip_deps )) {
|
||||
check_${host_os}
|
||||
}
|
||||
check_${host_os}
|
||||
|
||||
local product_name
|
||||
read -r product_name <<< \
|
||||
@@ -171,7 +119,6 @@ ${_usage_host:-}"
|
||||
commit_distance="${${git_description%-*}##*-}"
|
||||
}
|
||||
|
||||
|
||||
local output_name
|
||||
if (( commit_distance > 0 )) {
|
||||
output_name="obs-studio-${commit_version}-${commit_hash}"
|
||||
@@ -180,8 +127,6 @@ ${_usage_host:-}"
|
||||
}
|
||||
|
||||
if [[ ${host_os} == macos ]] {
|
||||
autoload -Uz read_codesign read_codesign_pass log_warning log_group
|
||||
|
||||
if [[ ! -d build_macos/OBS.app ]] {
|
||||
log_error 'No application bundle found. Run the build script to create a valid application bundle.'
|
||||
return 0
|
||||
@@ -197,9 +142,6 @@ ${_usage_host:-}"
|
||||
volume_name="OBS Studio ${commit_version} (${arch_names[${target##*-}]})"
|
||||
}
|
||||
|
||||
local _tarflags='cJf'
|
||||
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
|
||||
|
||||
if (( package )) {
|
||||
pushd build_macos
|
||||
|
||||
@@ -222,13 +164,18 @@ ${_usage_host:-}"
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( codesign )) { autoload -Uz read_codesign && read_codesign }
|
||||
typeset -gx CODESIGN_IDENT="${CODESIGN_IDENT:--}"
|
||||
typeset -gx CODESIGN_TEAM="$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')"
|
||||
|
||||
codesign --sign "${CODESIGN_IDENT:--}" ${output_name}.dmg
|
||||
codesign --sign "${CODESIGN_IDENT}" ${output_name}.dmg
|
||||
|
||||
if (( codesign && notarize )) {
|
||||
autoload -Uz read_codesign_pass && read_codesign_pass
|
||||
if ! [[ ${CODESIGN_IDENT} != '-' && ${CODESIGN_TEAM} && ${CODESIGN_IDENT_USER} && ${CODESIGN_IDENT_PASS} ]] {
|
||||
log_error "Notarization requires Apple ID and application password."
|
||||
return 2
|
||||
}
|
||||
|
||||
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${CODESIGN_TEAM}" --password "${CODESIGN_IDENT_PASS}"
|
||||
xcrun notarytool submit "${output_name}".dmg --keychain-profile "OBS-Codesign-Password" --wait
|
||||
|
||||
local -i _status=0
|
||||
@@ -244,7 +191,7 @@ ${_usage_host:-}"
|
||||
} else {
|
||||
log_group "Archiving obs-studio..."
|
||||
pushd build_macos
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${output_name}.tar.xz OBS.app
|
||||
XZ_OPT=-T0 tar -cvJf ${output_name}.tar.xz OBS.app
|
||||
popd
|
||||
}
|
||||
|
||||
@@ -254,7 +201,7 @@ ${_usage_host:-}"
|
||||
pushd build_macos/dSYMs
|
||||
rm -rf -- *.dSYM(N)
|
||||
cp -pR ${PWD:h}/**/*.dSYM .
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${output_name}-dSYMs.tar.xz -- *
|
||||
XZ_OPT=-T0 tar -cvJf ${output_name}-dSYMs.tar.xz -- *
|
||||
mv ${output_name}-dSYMs.tar.xz ${PWD:h}
|
||||
popd
|
||||
}
|
||||
@@ -263,7 +210,7 @@ ${_usage_host:-}"
|
||||
|
||||
} elif [[ ${host_os} == linux ]] {
|
||||
local -a cmake_args=()
|
||||
if (( _loglevel > 1 )) cmake_args+=(--verbose)
|
||||
if (( debug )) cmake_args+=(--verbose)
|
||||
|
||||
if (( package )) {
|
||||
log_group "Packaging obs-studio..."
|
||||
@@ -282,11 +229,8 @@ ${_usage_host:-}"
|
||||
log_group "Archiving obs-studio..."
|
||||
output_name="${output_name}-${target##*-}-linux-gnu"
|
||||
|
||||
local _tarflags='cJf'
|
||||
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
|
||||
|
||||
pushd ${project_root}/build_${target##*-}/install/${config}
|
||||
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/build_${target##*-}/${output_name}.tar.xz (bin|lib|share)
|
||||
XZ_OPT=-T0 tar -cvJf ${project_root}/build_${target##*-}/${output_name}.tar.xz (bin|lib|share)
|
||||
popd
|
||||
}
|
||||
log_group
|
||||
|
||||
82
.github/scripts/Build-Windows.ps1
vendored
82
.github/scripts/Build-Windows.ps1
vendored
@@ -3,10 +3,7 @@ param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[switch] $SkipAll,
|
||||
[switch] $SkipBuild,
|
||||
[switch] $SkipDeps
|
||||
[string] $Configuration = 'RelWithDebInfo'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -16,6 +13,10 @@ if ( $DebugPreference -eq 'Continue' ) {
|
||||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( $env:CI -eq $null ) {
|
||||
throw "Build-Windows.ps1 requires CI environment"
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "obs-studio requires a 64-bit system to build and run."
|
||||
}
|
||||
@@ -46,57 +47,40 @@ function Build {
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
||||
Ensure-Location $ProjectRoot
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$Preset = "windows-$(if ( $env:CI -ne $null ) { 'ci-' })${Target}"
|
||||
$CmakeArgs = @(
|
||||
'--preset', $Preset
|
||||
)
|
||||
$CmakeArgs = @('--preset', "windows-ci-${Target}")
|
||||
$CmakeBuildArgs = @('--build')
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
$CmakeBuildArgs = @('--build')
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
if ( ( $env:CI -ne $null ) -and ( $env:CCACHE_CONFIGPATH -ne $null ) ) {
|
||||
$CmakeArgs += @(
|
||||
"-DENABLE_CCACHE:BOOL=TRUE"
|
||||
)
|
||||
}
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
}
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--preset', "windows-${Target}"
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/build_${Target}/install"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring obs-studio..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building obs-studio..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--preset', "windows-${Target}"
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/build_${Target}/install"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring obs-studio..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building obs-studio..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
|
||||
Log-Group "Installing obs-studio..."
|
||||
Invoke-External cmake @CmakeInstallArgs
|
||||
|
||||
|
||||
13
.github/scripts/Package-Windows.ps1
vendored
13
.github/scripts/Package-Windows.ps1
vendored
@@ -3,8 +3,7 @@ param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[switch] $SkipDeps
|
||||
[string] $Configuration = 'RelWithDebInfo'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -14,6 +13,10 @@ if ( $DebugPreference -eq 'Continue' ) {
|
||||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( $env:CI -eq $null ) {
|
||||
throw "Package-Windows.ps1 requires CI environment"
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "obs-studio requires a 64-bit system to build and run."
|
||||
}
|
||||
@@ -40,9 +43,7 @@ function Package {
|
||||
. $Utility.FullName
|
||||
}
|
||||
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
|
||||
$GitDescription = Invoke-External git describe --tags --long
|
||||
$Tokens = ($GitDescription -split '-')
|
||||
@@ -60,7 +61,7 @@ function Package {
|
||||
'-C', "${Configuration}"
|
||||
)
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CpackArgs += ('--verbose')
|
||||
}
|
||||
|
||||
|
||||
70
.github/scripts/utils.pwsh/Expand-ArchiveExt.ps1
vendored
70
.github/scripts/utils.pwsh/Expand-ArchiveExt.ps1
vendored
@@ -1,70 +0,0 @@
|
||||
function Expand-ArchiveExt {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Expands archive files.
|
||||
.DESCRIPTION
|
||||
Allows extraction of zip, 7z, gz, and xz archives.
|
||||
Requires tar and 7-zip to be available on the system.
|
||||
Archives ending with .zip but created using LZMA compression are
|
||||
expanded using 7-zip as a fallback.
|
||||
.EXAMPLE
|
||||
Expand-ArchiveExt -Path <Path-To-Your-Archive>
|
||||
Expand-ArchiveExt -Path <Path-To-Your-Archive> -DestinationPath <Expansion-Path>
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Path,
|
||||
[string] $DestinationPath = [System.IO.Path]::GetFileNameWithoutExtension($Path),
|
||||
[switch] $Force
|
||||
)
|
||||
|
||||
switch ( [System.IO.Path]::GetExtension($Path) ) {
|
||||
.zip {
|
||||
try {
|
||||
Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force:$Force
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
{ ( $_ -eq ".7z" ) -or ( $_ -eq ".exe" ) } {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Extraction utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
break
|
||||
}
|
||||
.gz {
|
||||
try {
|
||||
Invoke-External tar -x -o $DestinationPath -f $Path
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
.xz {
|
||||
try {
|
||||
Invoke-External tar -x -o $DestinationPath -f $Path
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
}
|
||||
default {
|
||||
throw "Unsupported archive extension provided."
|
||||
}
|
||||
}
|
||||
}
|
||||
20
.github/scripts/utils.zsh/check_linux
vendored
20
.github/scripts/utils.zsh/check_linux
vendored
@@ -1,4 +1,4 @@
|
||||
autoload -Uz log_info log_status log_error log_debug log_warning log_group
|
||||
autoload -Uz log_debug log_group
|
||||
|
||||
log_group 'Check Linux build requirements'
|
||||
log_debug 'Checking Linux distribution name and version...'
|
||||
@@ -16,14 +16,6 @@ if [[ -f /etc/os_release ]] {
|
||||
fi
|
||||
}
|
||||
|
||||
log_debug 'Checking for apt-get...'
|
||||
if (( ! ${+commands[apt-get]} )) {
|
||||
log_error 'No apt-get command found. Please install apt'
|
||||
return 2
|
||||
} else {
|
||||
log_debug "Apt-get located at ${commands[apt-get]}"
|
||||
}
|
||||
|
||||
local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}")
|
||||
local -a install_list
|
||||
local binary
|
||||
@@ -46,15 +38,7 @@ for dependency (${dependencies}) {
|
||||
|
||||
log_debug "List of dependencies to install: ${install_list}"
|
||||
if (( #install_list )) {
|
||||
if (( ! ${+CI} )) log_warning 'Dependency installation via apt may require elevated privileges'
|
||||
|
||||
local -a apt_args=(
|
||||
${CI:+-y}
|
||||
--no-install-recommends
|
||||
)
|
||||
if (( _loglevel == 0 )) apt_args+=(--quiet)
|
||||
|
||||
sudo apt-get ${apt_args} install ${install_list}
|
||||
sudo apt-get -y --no-install-recommends install ${install_list}
|
||||
}
|
||||
|
||||
rehash
|
||||
|
||||
13
.github/scripts/utils.zsh/create_diskimage
vendored
13
.github/scripts/utils.zsh/create_diskimage
vendored
@@ -16,10 +16,7 @@ local output_name=${3}
|
||||
|
||||
log_group "Create macOS disk image"
|
||||
|
||||
local _hdiutil_flags
|
||||
if (( _loglevel < 1 )) _hdiutil_flags='-quiet'
|
||||
|
||||
trap "safe_hdiutil detach ${_hdiutil_flags} /Volumes/${output_name}; rm temp.dmg; log_group; return 2" ERR
|
||||
trap "safe_hdiutil detach /Volumes/${output_name}; rm temp.dmg; log_group; return 2" ERR
|
||||
|
||||
safe_hdiutil() {
|
||||
local _status=0
|
||||
@@ -43,14 +40,14 @@ safe_hdiutil() {
|
||||
}
|
||||
}
|
||||
|
||||
safe_hdiutil create ${_hdiutil_flags} \
|
||||
safe_hdiutil create \
|
||||
-volname "${volume_name}" \
|
||||
-srcfolder ${source} \
|
||||
-ov \
|
||||
-fs APFS \
|
||||
-format UDRW \
|
||||
temp.dmg
|
||||
safe_hdiutil attach ${_hdiutil_flags} \
|
||||
safe_hdiutil attach \
|
||||
-noverify \
|
||||
-readwrite \
|
||||
-mountpoint /Volumes/${output_name} \
|
||||
@@ -70,9 +67,9 @@ SetFile -a C /Volumes/${output_name}
|
||||
rm -rf -- /Volumes/${output_name}/.fseventsd(N)
|
||||
log_info "Converting disk image..."
|
||||
|
||||
safe_hdiutil detach ${_hdiutil_flags} /Volumes/${output_name}
|
||||
safe_hdiutil detach /Volumes/${output_name}
|
||||
|
||||
safe_hdiutil convert ${_hdiutil_flags} \
|
||||
safe_hdiutil convert \
|
||||
-format ULMO \
|
||||
-ov \
|
||||
-o ${output_name}.dmg temp.dmg
|
||||
|
||||
4
.github/scripts/utils.zsh/log_debug
vendored
4
.github/scripts/utils.zsh/log_debug
vendored
@@ -1,3 +1 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 2 )) print -PR -e "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
|
||||
if (( debug )) print -PR -e "::debug::%F{220}DEBUG: ${@}%f"
|
||||
|
||||
4
.github/scripts/utils.zsh/log_error
vendored
4
.github/scripts/utils.zsh/log_error
vendored
@@ -1,3 +1 @@
|
||||
local icon=' ✖︎ '
|
||||
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
|
||||
print -u2 -PR "::error::%F{1} ✖︎%f ${@}"
|
||||
|
||||
18
.github/scripts/utils.zsh/log_group
vendored
18
.github/scripts/utils.zsh/log_group
vendored
@@ -2,15 +2,11 @@ autoload -Uz log_info
|
||||
|
||||
if (( ! ${+_log_group} )) typeset -g _log_group=0
|
||||
|
||||
if (( ${+CI} )) {
|
||||
if (( _log_group )) {
|
||||
print "::endgroup::"
|
||||
typeset -g _log_group=0
|
||||
}
|
||||
if (( # )) {
|
||||
print "::group::${@}"
|
||||
typeset -g _log_group=1
|
||||
}
|
||||
} else {
|
||||
if (( # )) log_info ${@}
|
||||
if (( _log_group )) {
|
||||
print "::endgroup::"
|
||||
typeset -g _log_group=0
|
||||
}
|
||||
if (( # )) {
|
||||
print "::group::${@}"
|
||||
typeset -g _log_group=1
|
||||
}
|
||||
|
||||
8
.github/scripts/utils.zsh/log_info
vendored
8
.github/scripts/utils.zsh/log_info
vendored
@@ -1,7 +1 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "%F{4} ${(r:5:)icon}%f %B${@}%b"
|
||||
}
|
||||
print -PR "%F{4} =>%f %B${@}%b"
|
||||
|
||||
8
.github/scripts/utils.zsh/log_output
vendored
8
.github/scripts/utils.zsh/log_output
vendored
@@ -1,7 +1 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=''
|
||||
|
||||
print -PR " ${(r:5:)icon} ${@}"
|
||||
}
|
||||
print -PR " ${@}"
|
||||
|
||||
8
.github/scripts/utils.zsh/log_status
vendored
8
.github/scripts/utils.zsh/log_status
vendored
@@ -1,7 +1 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' >'
|
||||
|
||||
print -PR "%F{2} ${(r:5:)icon}%f ${@}"
|
||||
}
|
||||
print -PR "%F{2} >%f ${@}"
|
||||
|
||||
8
.github/scripts/utils.zsh/log_warning
vendored
8
.github/scripts/utils.zsh/log_warning
vendored
@@ -1,7 +1 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
|
||||
}
|
||||
print -PR "::warning::%F{3} => ${@}%f"
|
||||
|
||||
9
.github/scripts/utils.zsh/read_codesign
vendored
9
.github/scripts/utils.zsh/read_codesign
vendored
@@ -1,9 +0,0 @@
|
||||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
typeset -g CODESIGN_IDENT
|
||||
log_info 'Setting up Apple Developer ID for application codesigning...'
|
||||
read CODESIGN_IDENT'?Apple Developer Application ID: '
|
||||
}
|
||||
|
||||
typeset -g CODESIGN_TEAM=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')
|
||||
27
.github/scripts/utils.zsh/read_codesign_pass
vendored
27
.github/scripts/utils.zsh/read_codesign_pass
vendored
@@ -1,27 +0,0 @@
|
||||
autoload -Uz read_codesign read_codesign_user log_info log_warning
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
read_codesign
|
||||
}
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT_USER} )) {
|
||||
read_codesign_user
|
||||
}
|
||||
|
||||
log_info 'Setting up password for notarization keychain...'
|
||||
if (( ! ${+CODESIGN_IDENT_PASS} )) {
|
||||
read -s CODESIGN_IDENT_PASS'?Apple Developer ID password: '
|
||||
}
|
||||
|
||||
print ''
|
||||
log_info 'Setting up notarization keychain...'
|
||||
|
||||
if (( ! ${+CI} )) {
|
||||
log_warning "
|
||||
+ Your Apple ID and an app-specific password is necessary for notarization from CLI
|
||||
+ This password will be stored in your macOS keychain under the identifier
|
||||
'OBS-Codesign-Password' with access Apple's 'altool' only.
|
||||
|
||||
"
|
||||
}
|
||||
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${CODESIGN_TEAM}" --password "${CODESIGN_IDENT_PASS}"
|
||||
7
.github/scripts/utils.zsh/read_codesign_team
vendored
7
.github/scripts/utils.zsh/read_codesign_team
vendored
@@ -1,7 +0,0 @@
|
||||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+CODESIGN_TEAM} )) {
|
||||
typeset -g CODESIGN_TEAM
|
||||
log_info 'Setting up Apple Developer Team ID for codesigning...'
|
||||
read CODESIGN_TEAM'?Apple Developer Team ID (leave empty to use Apple Developer ID instead): '
|
||||
}
|
||||
7
.github/scripts/utils.zsh/read_codesign_user
vendored
7
.github/scripts/utils.zsh/read_codesign_user
vendored
@@ -1,7 +0,0 @@
|
||||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT_USER} )) {
|
||||
typeset -g CODESIGN_IDENT_USER
|
||||
log_info 'Setting up Apple ID for notarization...'
|
||||
read CODESIGN_IDENT_USER'?Apple ID: '
|
||||
}
|
||||
7
.github/scripts/utils.zsh/run_xcodebuild
vendored
7
.github/scripts/utils.zsh/run_xcodebuild
vendored
@@ -1,7 +0,0 @@
|
||||
if (( _loglevel > 1 )) {
|
||||
xcodebuild ${@}
|
||||
} else {
|
||||
local -a xcbeautify_opts=()
|
||||
if (( _loglevel == 0 )) xcbeautify_opts+=(--quiet)
|
||||
xcodebuild ${@} 2>&1 | xcbeautify ${xcbeautify_opts}
|
||||
}
|
||||
17
.github/scripts/utils.zsh/set_loglevel
vendored
17
.github/scripts/utils.zsh/set_loglevel
vendored
@@ -1,17 +0,0 @@
|
||||
autoload -Uz log_debug log_error log_output
|
||||
|
||||
local -r _usage="Usage: %B${0}%b <loglevel>
|
||||
|
||||
Set log level, following levels are supported: 0 (quiet), 1 (normal), 2 (verbose), 3 (debug)"
|
||||
|
||||
if (( ! # )); then
|
||||
log_error 'Called without arguments.'
|
||||
log_output ${_usage}
|
||||
return 2
|
||||
elif (( ${1} >= 4 )); then
|
||||
log_error 'Called with loglevel > 3.'
|
||||
log_output ${_usage}
|
||||
fi
|
||||
|
||||
typeset -g -i -r _loglevel=${1}
|
||||
log_debug "Log level set to '${1}'"
|
||||
19
.github/scripts/utils.zsh/setup_ccache
vendored
19
.github/scripts/utils.zsh/setup_ccache
vendored
@@ -1,15 +1,8 @@
|
||||
autoload -Uz log_debug log_warning log_error
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
autoload -Uz log_debug log_warning
|
||||
|
||||
if (( ${+commands[ccache]} )) {
|
||||
log_debug "Found ccache at ${commands[ccache]}"
|
||||
|
||||
typeset -gx CCACHE_CONFIGPATH="${project_root}/.ccache.conf"
|
||||
|
||||
ccache --set-config=run_second_cpp=true
|
||||
ccache --set-config=direct_mode=true
|
||||
ccache --set-config=inode_cache=true
|
||||
@@ -32,11 +25,9 @@ if (( ${+commands[ccache]} )) {
|
||||
ccache --set-config=sloppiness=${(j:,:)sloppiness}
|
||||
}
|
||||
|
||||
if (( ${+CI} )) {
|
||||
ccache --set-config=cache_dir="${GITHUB_WORKSPACE:-${HOME}}/.ccache"
|
||||
ccache --set-config=max_size="${CCACHE_SIZE:-1G}"
|
||||
ccache -z > /dev/null
|
||||
}
|
||||
ccache --set-config=cache_dir="${GITHUB_WORKSPACE:-${HOME}}/.ccache"
|
||||
ccache --set-config=max_size="${CCACHE_SIZE:-1G}"
|
||||
ccache -z > /dev/null
|
||||
} else {
|
||||
log_warning "No ccache found on the system"
|
||||
log_warning "Ccache not available"
|
||||
}
|
||||
|
||||
258
.github/scripts/utils.zsh/setup_linux
vendored
258
.github/scripts/utils.zsh/setup_linux
vendored
@@ -1,32 +1,16 @@
|
||||
autoload -Uz log_group log_error log_status log_info log_debug
|
||||
|
||||
if (( ! ${+commands[curl]} )) {
|
||||
log_error 'curl not found. Please install curl.'
|
||||
log_error 'curl not available.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+commands[jq]} )) {
|
||||
log_error 'jq not found. Please install jq.'
|
||||
log_error 'jq not available.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+target} )) {
|
||||
log_error "'target' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
local -a curl_opts=()
|
||||
if (( ! ${+CI} )) {
|
||||
curl_opts+=(--progress-bar --continue-at -)
|
||||
} else {
|
||||
curl_opts+=(--show-error --silent)
|
||||
}
|
||||
curl_opts+=(--location -O ${@})
|
||||
local -a curl_opts=(--show-error --silent --location -O ${@})
|
||||
|
||||
pushd ${project_root}
|
||||
|
||||
@@ -36,152 +20,98 @@ read -r QT_VERSION <<< \
|
||||
'.platformConfig[$target] | { qtVersion } | join(" ")' \
|
||||
${buildspec_file})"
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
log_group 'Installing obs-studio build dependencies...'
|
||||
log_group 'Installing obs-studio build dependencies...'
|
||||
|
||||
mkdir -p ${project_root}/.deps
|
||||
local deps_version
|
||||
local deps_baseurl
|
||||
local deps_label
|
||||
local deps_hash
|
||||
mkdir -p ${project_root}/.deps
|
||||
local deps_version
|
||||
local deps_baseurl
|
||||
local deps_label
|
||||
local deps_hash
|
||||
|
||||
IFS=';' read -r deps_version deps_baseurl deps_label deps_hash <<< \
|
||||
"$(jq -r --arg target "${target}" \
|
||||
'.dependencies["cef"] | {version, baseUrl, "label", "hash": .hashes[$target]} | join(";")' \
|
||||
${buildspec_file})"
|
||||
IFS=';' read -r deps_version deps_baseurl deps_label deps_hash <<< \
|
||||
"$(jq -r --arg target "${target}" \
|
||||
'.dependencies["cef"] | {version, baseUrl, "label", "hash": .hashes[$target]} | join(";")' \
|
||||
${buildspec_file})"
|
||||
|
||||
if (( ! deps_version )) {
|
||||
log_error 'No valid cef spec found in buildspec.json.'
|
||||
return 2
|
||||
}
|
||||
log_group 'Setting up pre-built Chromium Embedded Framework...'
|
||||
|
||||
pushd ${project_root}/.deps
|
||||
local _filename="cef_binary_${deps_version}_${target//-/_}.tar.xz"
|
||||
local _url=${deps_baseurl}/${_filename}
|
||||
local _target="cef_binary_${deps_version}_${target//-/_}"
|
||||
typeset -g CEF_VERSION=${deps_version}
|
||||
|
||||
log_status 'Checking for available wrapper library...'
|
||||
local -i _skip=0
|
||||
if [[ -f ${_target}/build/libcef_dll_wrapper/libcef_dll_wrapper.a ]] {
|
||||
_skip=1
|
||||
}
|
||||
|
||||
if ! (( _skip )) {
|
||||
if [[ ! -f ${_filename} ]] {
|
||||
log_debug "Running curl ${curl_opts} ${_url}"
|
||||
curl ${curl_opts} ${_url} && \
|
||||
log_status "Downloaded ${deps_label} for ${target}."
|
||||
} else {
|
||||
log_status "Found downloaded ${deps_label}"
|
||||
}
|
||||
|
||||
read -r artifact_checksum _ <<< "$(sha256sum ${_filename})"
|
||||
if [[ ${deps_hash} != ${artifact_checksum} ]] {
|
||||
log_error "Checksum of downloaded ${deps_label} does not match specification.
|
||||
Expected : ${deps_hash}
|
||||
Actual : ${artifact_checksum}"
|
||||
return 2
|
||||
}
|
||||
log_status "Checksum of downloaded ${deps_label} matches."
|
||||
mkdir -p ${_target} && pushd ${_target}
|
||||
|
||||
XZ_OPT=-T0 tar --strip-components 1 -xJf ../${_filename} && log_status "${deps_label} extracted."
|
||||
|
||||
if [[ ! -f build/libcef_dll_wrapper/libcef_dll_wrapper.a ]] {
|
||||
log_group "Configuring CEF wrapper library..."
|
||||
|
||||
local -a cmake_args=(
|
||||
-DPROJECT_ARCH:STRING=${target##*-}
|
||||
-DCEF_COMPILER_FLAGS:STRING="-Wno-deprecated-copy"
|
||||
-DCMAKE_BUILD_TYPE:STRING=${config}
|
||||
-DCMAKE_CXX_FLAGS:STRING="-std=c++11 -Wno-deprecated-declarations -Wno-unknonw-warning-option"
|
||||
-DCMAKE_EXE_LINKER_FLAGS:STRING="-std=c++11"
|
||||
)
|
||||
if (( _loglevel == 0 )) cmake_args+=(-Wno-deprecated -Wno-dev --log-level=ERROR)
|
||||
if (( ${+commands[ccache]} )) {
|
||||
cmake_args+=(
|
||||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
|
||||
)
|
||||
}
|
||||
|
||||
cmake -S . -B build -G Ninja ${cmake_args}
|
||||
|
||||
log_group "Building CEF Wrapper library..."
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
mkdir -p build/libcef_dll
|
||||
popd
|
||||
} else {
|
||||
log_info 'Found existing Chromium Embedded Framework and loader library...'
|
||||
}
|
||||
popd
|
||||
|
||||
local -a apt_args=(
|
||||
${CI:+-y}
|
||||
--no-install-recommends
|
||||
)
|
||||
if (( _loglevel == 0 )) apt_args+=(--quiet)
|
||||
|
||||
local suffix
|
||||
if [[ ${CPUTYPE} != ${target##*-} ]] {
|
||||
local -A arch_mappings=(
|
||||
aarch64 arm64
|
||||
x86_64 amd64
|
||||
)
|
||||
|
||||
suffix=":${arch_mappings[${target##*-}]}"
|
||||
sudo apt-get install ${apt_args} gcc-${${target##*-}//_/-}-linux-gnu g++-${${target##*-}//_/-}-linux-gnu
|
||||
}
|
||||
|
||||
sudo apt-get install ${apt_args} \
|
||||
build-essential \
|
||||
libcurl4-openssl-dev \
|
||||
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \
|
||||
libswresample-dev libswscale-dev \
|
||||
libjansson-dev \
|
||||
libx11-xcb-dev \
|
||||
libgles2-mesa-dev libgles2-mesa \
|
||||
libwayland-dev \
|
||||
libpipewire-0.3-dev \
|
||||
libpulse-dev \
|
||||
libx264-dev \
|
||||
libmbedtls-dev \
|
||||
libgl1-mesa-dev \
|
||||
libjansson-dev \
|
||||
libluajit-5.1-dev python3-dev \
|
||||
libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev \
|
||||
libxcb-composite0-dev libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \
|
||||
swig libcmocka-dev libxss-dev libglvnd-dev \
|
||||
libxkbcommon-dev \
|
||||
libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev \
|
||||
libpulse-dev libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev \
|
||||
libpci-dev libdrm-dev \
|
||||
nlohmann-json3-dev libwebsocketpp-dev libasio-dev libvpl-dev libqrcodegencpp-dev
|
||||
|
||||
if (( UBUNTU_2210_OR_LATER )) sudo apt-get install ${apt_args} librist-dev libsrt-openssl-dev
|
||||
|
||||
local -a _qt_packages=()
|
||||
|
||||
if (( QT_VERSION == 6 )) {
|
||||
_qt_packages+=(
|
||||
qt6-base-dev
|
||||
libqt6svg6-dev
|
||||
qt6-base-private-dev
|
||||
)
|
||||
} else {
|
||||
log_error "Unsupported Qt version '${QT_VERSION}' specified."
|
||||
return 2
|
||||
}
|
||||
|
||||
sudo apt-get install ${apt_args} ${_qt_packages}
|
||||
} else {
|
||||
local cef_version
|
||||
read -r cef_version <<< \
|
||||
"$(jq -r '.dependencies | [.cef.version] | join(" ")' ${buildspec_file})"
|
||||
|
||||
typeset -g CEF_VERSION=${cef_version}
|
||||
if (( ! deps_version )) {
|
||||
log_error 'No valid cef spec found in buildspec.json.'
|
||||
return 2
|
||||
}
|
||||
log_group 'Setting up pre-built Chromium Embedded Framework...'
|
||||
|
||||
pushd ${project_root}/.deps
|
||||
local _filename="cef_binary_${deps_version}_${target//-/_}.tar.xz"
|
||||
local _url=${deps_baseurl}/${_filename}
|
||||
local _target="cef_binary_${deps_version}_${target//-/_}"
|
||||
typeset -g CEF_VERSION=${deps_version}
|
||||
|
||||
log_debug "Running curl ${curl_opts} ${_url}"
|
||||
curl ${curl_opts} ${_url} && \
|
||||
log_status "Downloaded ${deps_label} for ${target}."
|
||||
|
||||
read -r artifact_checksum _ <<< "$(sha256sum ${_filename})"
|
||||
if [[ ${deps_hash} != ${artifact_checksum} ]] {
|
||||
log_error "Checksum of downloaded ${deps_label} does not match specification.
|
||||
Expected : ${deps_hash}
|
||||
Actual : ${artifact_checksum}"
|
||||
return 2
|
||||
}
|
||||
log_status "Checksum of downloaded ${deps_label} matches."
|
||||
mkdir -p ${_target} && pushd ${_target}
|
||||
|
||||
XZ_OPT=-T0 tar --strip-components 1 -xJf ../${_filename} && log_status "${deps_label} extracted."
|
||||
popd
|
||||
|
||||
local suffix
|
||||
if [[ ${CPUTYPE} != ${target##*-} ]] {
|
||||
local -A arch_mappings=(
|
||||
aarch64 arm64
|
||||
x86_64 amd64
|
||||
)
|
||||
|
||||
suffix=":${arch_mappings[${target##*-}]}"
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
gcc-${${target##*-}//_/-}-linux-gnu g++-${${target##*-}//_/-}-linux-gnu
|
||||
}
|
||||
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libcurl4-openssl-dev \
|
||||
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \
|
||||
libswresample-dev libswscale-dev \
|
||||
libjansson-dev \
|
||||
libx11-xcb-dev \
|
||||
libgles2-mesa-dev libgles2-mesa \
|
||||
libwayland-dev \
|
||||
libpipewire-0.3-dev \
|
||||
libpulse-dev \
|
||||
libx264-dev \
|
||||
libmbedtls-dev \
|
||||
libgl1-mesa-dev \
|
||||
libjansson-dev \
|
||||
libluajit-5.1-dev python3-dev \
|
||||
libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev \
|
||||
libxcb-composite0-dev libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \
|
||||
swig libcmocka-dev libxss-dev libglvnd-dev \
|
||||
libxkbcommon-dev \
|
||||
libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev \
|
||||
libpulse-dev libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev \
|
||||
libpci-dev libdrm-dev \
|
||||
nlohmann-json3-dev libwebsocketpp-dev libasio-dev libvpl-dev libqrcodegencpp-dev
|
||||
|
||||
if (( UBUNTU_2210_OR_LATER )) sudo apt-get install -y --no-install-recommends librist-dev libsrt-openssl-dev
|
||||
|
||||
local -a _qt_packages=()
|
||||
|
||||
if (( QT_VERSION == 6 )) {
|
||||
_qt_packages+=(
|
||||
qt6-base-dev
|
||||
libqt6svg6-dev
|
||||
qt6-base-private-dev
|
||||
)
|
||||
} else {
|
||||
log_error "Unsupported Qt version '${QT_VERSION}' specified."
|
||||
return 2
|
||||
}
|
||||
|
||||
sudo apt-get install -y --no-install-recommends ${_qt_packages}
|
||||
|
||||
Reference in New Issue
Block a user