From b771e08cb1f38d147264297f3176fc23bce1ba9f Mon Sep 17 00:00:00 2001 From: Josh Wong <34504936+jbwong05@users.noreply.github.com> Date: Tue, 18 Jul 2023 19:09:35 -0700 Subject: [PATCH 1/2] OBS 29 upgrade (#11) * Updated build system for OBS 28/29 * Removed all macos and windows build scripts * Fixed missing buildspec * Functional recording without a combine module * Removed old code * Fixed formatting errors * Disabled broken release packaging script --- .cmake-format.json | 16 + .github/FUNDING.yml | 3 + .github/actions/build-plugin/action.yml | 31 + .github/actions/package-plugin/action.yml | 30 + .github/scripts/.Aptfile | 9 + .github/scripts/.build.zsh | 249 +++++ .github/scripts/.package.zsh | 193 ++++ .github/scripts/build-linux.sh | 13 + .github/scripts/build-linux.zsh | 1 + .../scripts/check-changes.sh | 0 .github/scripts/check-cmake.sh | 53 + .github/scripts/check-format.sh | 60 ++ .github/scripts/package-linux.sh | 13 + .github/scripts/package-linux.zsh | 1 + .github/scripts/utils.zsh/check_linux | 36 + .github/scripts/utils.zsh/check_packages | 52 + .github/scripts/utils.zsh/log_debug | 3 + .github/scripts/utils.zsh/log_error | 3 + .github/scripts/utils.zsh/log_info | 7 + .github/scripts/utils.zsh/log_output | 7 + .github/scripts/utils.zsh/log_status | 7 + .github/scripts/utils.zsh/log_warning | 5 + .github/scripts/utils.zsh/mkcd | 1 + .github/scripts/utils.zsh/read_codesign | 7 + .../scripts/utils.zsh/read_codesign_installer | 7 + .github/scripts/utils.zsh/read_codesign_pass | 33 + .github/scripts/utils.zsh/read_codesign_user | 7 + .github/scripts/utils.zsh/set_loglevel | 17 + .github/scripts/utils.zsh/setup_ccache | 14 + .github/scripts/utils.zsh/setup_linux | 62 ++ .github/scripts/utils.zsh/setup_obs | 104 ++ .github/workflows/clang-format.yml | 20 - .github/workflows/main.yml | 135 ++- .gitignore | 4 +- CI/ci_includes.sh.in | 4 - CI/linux/build-ubuntu.sh | 6 - CI/linux/install-dependencies-ubuntu.sh | 20 - CI/linux/package-ubuntu.sh | 20 - CI/linux/package.sh | 17 - CMakeLists.txt | 240 +---- Dockerfile.ubuntu1804 | 17 - Dockerfile.ubuntu2004 | 17 - buildspec.json | 86 ++ cmake/ObsPluginHelpers.cmake | 704 ++++++++++++++ cmake/bundle/macos/Plugin-Info.plist.in | 26 + cmake/bundle/macos/entitlements.plist | 17 + cmake/bundle/macos/installer-macos.pkgproj.in | 920 ++++++++++++++++++ .../bundle/windows}/installer-Windows.iss.in | 5 +- cmake/bundle/windows/resource.rc.in | 32 + external/FindLibObs.cmake | 107 -- formatcode.sh | 32 - installer/installer-macOS.pkgproj.in | 726 -------------- src/pulse-app-input.cpp | 334 ++----- src/pulse-wrapper.c | 58 +- src/pulse-wrapper.h | 9 +- 55 files changed, 3116 insertions(+), 1484 deletions(-) create mode 100644 .cmake-format.json create mode 100644 .github/FUNDING.yml create mode 100644 .github/actions/build-plugin/action.yml create mode 100644 .github/actions/package-plugin/action.yml create mode 100644 .github/scripts/.Aptfile create mode 100755 .github/scripts/.build.zsh create mode 100755 .github/scripts/.package.zsh create mode 100755 .github/scripts/build-linux.sh create mode 120000 .github/scripts/build-linux.zsh rename CI/check-format.sh => .github/scripts/check-changes.sh (100%) create mode 100755 .github/scripts/check-cmake.sh create mode 100755 .github/scripts/check-format.sh create mode 100755 .github/scripts/package-linux.sh create mode 120000 .github/scripts/package-linux.zsh create mode 100644 .github/scripts/utils.zsh/check_linux create mode 100644 .github/scripts/utils.zsh/check_packages create mode 100644 .github/scripts/utils.zsh/log_debug create mode 100644 .github/scripts/utils.zsh/log_error create mode 100644 .github/scripts/utils.zsh/log_info create mode 100644 .github/scripts/utils.zsh/log_output create mode 100644 .github/scripts/utils.zsh/log_status create mode 100644 .github/scripts/utils.zsh/log_warning create mode 100644 .github/scripts/utils.zsh/mkcd create mode 100644 .github/scripts/utils.zsh/read_codesign create mode 100644 .github/scripts/utils.zsh/read_codesign_installer create mode 100644 .github/scripts/utils.zsh/read_codesign_pass create mode 100644 .github/scripts/utils.zsh/read_codesign_user create mode 100644 .github/scripts/utils.zsh/set_loglevel create mode 100644 .github/scripts/utils.zsh/setup_ccache create mode 100644 .github/scripts/utils.zsh/setup_linux create mode 100644 .github/scripts/utils.zsh/setup_obs delete mode 100644 .github/workflows/clang-format.yml delete mode 100644 CI/ci_includes.sh.in delete mode 100755 CI/linux/build-ubuntu.sh delete mode 100755 CI/linux/install-dependencies-ubuntu.sh delete mode 100755 CI/linux/package-ubuntu.sh delete mode 100755 CI/linux/package.sh delete mode 100644 Dockerfile.ubuntu1804 delete mode 100644 Dockerfile.ubuntu2004 create mode 100644 buildspec.json create mode 100644 cmake/ObsPluginHelpers.cmake create mode 100644 cmake/bundle/macos/Plugin-Info.plist.in create mode 100644 cmake/bundle/macos/entitlements.plist create mode 100644 cmake/bundle/macos/installer-macos.pkgproj.in rename {installer => cmake/bundle/windows}/installer-Windows.iss.in (95%) create mode 100644 cmake/bundle/windows/resource.rc.in delete mode 100644 external/FindLibObs.cmake delete mode 100755 formatcode.sh delete mode 100644 installer/installer-macOS.pkgproj.in diff --git a/.cmake-format.json b/.cmake-format.json new file mode 100644 index 0000000..eb7d554 --- /dev/null +++ b/.cmake-format.json @@ -0,0 +1,16 @@ +{ + "additional_commands": { + "find_qt": { + "flags": [], + "kwargs": { + "COMPONENTS": "+", + "COMPONENTS_WIN": "+", + "COMPONENTS_MACOS": "+", + "COMPONENTS_LINUX": "+" + } + } + }, + "format": { + "line_width": 100 + } +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f3de49f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +custom: ['https://www.paypal.com/donate/?business=924NBJPZRVNXY&no_recurring=0¤cy_code=USD'] diff --git a/.github/actions/build-plugin/action.yml b/.github/actions/build-plugin/action.yml new file mode 100644 index 0000000..f1fd5a1 --- /dev/null +++ b/.github/actions/build-plugin/action.yml @@ -0,0 +1,31 @@ +name: 'Setup and build plugin' +description: 'Builds the plugin for specified architecture and build config.' +inputs: + target: + description: 'Build target for dependencies' + required: true + config: + description: 'Build configuration' + required: false + default: 'Release' + workingDirectory: + description: 'Working directory for packaging' + required: false + default: ${{ github.workspace }} +runs: + using: 'composite' + steps: + - name: Run Linux Build + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | + build_args=( + -c ${{ inputs.config }} + -t linux-${{ inputs.target }} + ) + + if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then + build_args+=(--debug) + fi + + ${{ inputs.workingDirectory }}/.github/scripts/build-linux.sh "${build_args[@]}" diff --git a/.github/actions/package-plugin/action.yml b/.github/actions/package-plugin/action.yml new file mode 100644 index 0000000..682d877 --- /dev/null +++ b/.github/actions/package-plugin/action.yml @@ -0,0 +1,30 @@ +name: 'Package plugin' +description: 'Packages the plugin for specified architecture and build config.' +inputs: + target: + description: 'Build target for dependencies' + required: true + config: + description: 'Build configuration' + required: false + default: 'Release' + workingDirectory: + description: 'Working directory for packaging' + required: false + default: ${{ github.workspace }} +runs: + using: 'composite' + steps: + - name: Run Linux packaging + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | + package_args=( + -c ${{ inputs.config }} + -t linux-${{ inputs.target }} + ) + if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then + build_args+=(--debug) + fi + + ${{ inputs.workingDirectory }}/.github/scripts/package-linux.sh "${package_args[@]}" diff --git a/.github/scripts/.Aptfile b/.github/scripts/.Aptfile new file mode 100644 index 0000000..59196f0 --- /dev/null +++ b/.github/scripts/.Aptfile @@ -0,0 +1,9 @@ +package 'cmake' +package 'ccache' +package 'curl' +package 'git' +package 'jq' +package 'ninja-build', bin: 'ninja' +package 'pkg-config' +package 'clang' +package 'clang-format-13' diff --git a/.github/scripts/.build.zsh b/.github/scripts/.build.zsh new file mode 100755 index 0000000..c93dfa1 --- /dev/null +++ b/.github/scripts/.build.zsh @@ -0,0 +1,249 @@ +#!/usr/bin/env zsh + +builtin emulate -L zsh +setopt EXTENDED_GLOB +setopt PUSHD_SILENT +setopt ERR_EXIT +setopt ERR_RETURN +setopt NO_UNSET +setopt PIPE_FAIL +setopt NO_AUTO_PUSHD +setopt NO_PUSHD_IGNORE_DUPS +setopt FUNCTION_ARGZERO + +## Enable for script debugging +# setopt WARN_CREATE_GLOBAL +# setopt WARN_NESTED_VAR +# setopt XTRACE + +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 + +_trap_error() { + print -u2 -PR '%F{1} ✖︎ script execution error%f' + print -PR -e " + Callstack: + ${(j:\n :)funcfiletrace} + " + exit 2 +} + +build() { + if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h} + local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[2]} + local target="${host_os}-${CPUTYPE}" + local project_root=${SCRIPT_HOME:A:h:h} + local buildspec_file="${project_root}/buildspec.json" + + trap '_trap_error' ZERR + + fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath}) + autoload -Uz log_info log_error log_output set_loglevel check_${host_os} setup_${host_os} setup_obs 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.' + return 2 + } + + typeset -g -a skips=() + local -i _verbosity=1 + local -r _version='1.0.0' + local -r -a _valid_targets=( + macos-x86_64 + macos-arm64 + macos-universal + linux-x86_64 + linux-aarch64 + ) + local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel) + if [[ ${host_os} == 'macos' ]] { + local -r -a _valid_generators=(Xcode Ninja 'Unix Makefiles') + local generator="${${CI:+Ninja}:-Xcode}" + } else { + local -r -a _valid_generators=(Ninja 'Unix Makefiles') + local generator='Ninja' + } + local -r _usage=" +Usage: %B${functrace[1]%:*}%b