mirror of
https://github.com/occ-ai/obs-localvocal
synced 2024-11-07 02:40:12 +00:00
fix osx build
This commit is contained in:
parent
acb259980c
commit
3fa1f11418
9
.github/scripts/.package.zsh
vendored
9
.github/scripts/.package.zsh
vendored
@ -180,18 +180,13 @@ ${_usage_host:-}"
|
||||
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
|
||||
|
||||
if (( package )) {
|
||||
if [[ ! -f ${project_root}/build_macos/installer-macos.generated.pkgproj ]] {
|
||||
log_error 'Packages project file not found. Run the build script or the CMake build and install procedures first.'
|
||||
if [[ ! -f ${project_root}/release/${config}/${product_name}.pkg ]] {
|
||||
log_error 'Installer Package not found. Run the build script or the CMake build and install procedures first.'
|
||||
return 2
|
||||
}
|
||||
|
||||
check_packages
|
||||
|
||||
log_group "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
packagesbuild \
|
||||
--build-folder ${project_root}/release/${config} \
|
||||
${project_root}/build_macos/installer-macos.generated.pkgproj
|
||||
|
||||
if (( codesign )) {
|
||||
read_codesign_installer
|
||||
|
62
.github/scripts/utils.zsh/check_packages
vendored
62
.github/scripts/utils.zsh/check_packages
vendored
@ -1,62 +0,0 @@
|
||||
if (( ! ${+commands[packagesbuild]} )) {
|
||||
autoload -Uz log_group log_info log_status mkcd
|
||||
|
||||
if (( ! ${+commands[curl]} )) {
|
||||
log_error 'curl not found. Please install curl.'
|
||||
return 2
|
||||
}
|
||||
|
||||
if (( ! ${+project_root} )) {
|
||||
log_error "'project_root' not set. Please set before running ${0}."
|
||||
return 2
|
||||
}
|
||||
|
||||
local -a curl_opts=()
|
||||
if (( ${+CI} )) {
|
||||
curl_opts+=(--show-error --silent)
|
||||
} else {
|
||||
curl_opts+=(--progress-bar)
|
||||
}
|
||||
curl_opts+=(--location -O)
|
||||
|
||||
log_group 'Installing Packages.app...'
|
||||
|
||||
local version
|
||||
local base_url
|
||||
local hash
|
||||
IFS=';' read -r version base_url hash <<< \
|
||||
"$(jq -r '.tools.packages | {version, baseUrl, hash} | join(";")' buildspec.json)"
|
||||
|
||||
mkdir -p ${project_root}/.deps && pushd ${project_root}/.deps
|
||||
curl ${curl_opts} "${base_url}/Packages.dmg"
|
||||
|
||||
local checksum="$(sha256sum Packages.dmg | cut -d " " -f 1)"
|
||||
|
||||
if [[ ${hash} != ${checksum} ]] {
|
||||
log_error "Checksum mismatch of Packages.dmg download.
|
||||
Expected : ${hash}
|
||||
Actual : ${checksum}"
|
||||
return 2
|
||||
}
|
||||
|
||||
hdiutil attach -readonly -noverify -noautoopen -plist Packages.dmg > .result.plist
|
||||
local -i num_entities=$(( $(plutil -extract system-entities raw -- .result.plist) - 1 ))
|
||||
local keys
|
||||
local mount_point
|
||||
for i ({0..${num_entities}}) {
|
||||
keys=($(plutil -extract system-entities.${i} raw -- .result.plist))
|
||||
if [[ ${keys} == *mount-point* ]] {
|
||||
mount_point=$(plutil -extract system-entities.${i}.mount-point raw -- .result.plist)
|
||||
break
|
||||
}
|
||||
}
|
||||
rm .result.plist
|
||||
|
||||
log_status 'Installing Packages.app requires elevated privileges!'
|
||||
|
||||
sudo installer -pkg ${mount_point}/packages/Packages.pkg -target / && rehash
|
||||
hdiutil detach ${mount_point} &> /dev/null && log_status 'Packages.dmg image unmounted.'
|
||||
popd
|
||||
|
||||
log_group
|
||||
}
|
2
.github/workflows/pr-pull.yaml
vendored
2
.github/workflows/pr-pull.yaml
vendored
@ -6,7 +6,7 @@ on:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
branches: [master, main]
|
||||
types: [ opened, synchronize, reopened, labeled, unlabeled ]
|
||||
types: [ opened, synchronize, reopened ]
|
||||
permissions:
|
||||
contents: read
|
||||
concurrency:
|
||||
|
@ -3,7 +3,7 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Set C and C++ language standards to C17 and C++17
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
else()
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
@ -79,7 +79,8 @@ function(set_target_properties_plugin target)
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION .
|
||||
OPTIONAL)
|
||||
configure_file(cmake/macos/resources/create-package.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
|
||||
configure_file(cmake/macos/resources/distribution.in "${CMAKE_CURRENT_BINARY_DIR}/distribution" @ONLY)
|
||||
configure_file(cmake/macos/resources/create-package.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake" @ONLY)
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
|
||||
endfunction()
|
||||
|
||||
|
@ -1,7 +1,35 @@
|
||||
set(CMAKE_PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CMAKE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
set(MACOS_BUNDLEID ${MACOS_BUNDLEID})
|
||||
set(UUID_PACKAGE ${UUID_PACKAGE})
|
||||
set(UUID_INSTALLER ${UUID_INSTALLER})
|
||||
configure_file(cmake/macos/resources/installer-macos.pkgproj.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/installer-macos.generated.pkgproj")
|
||||
make_directory("$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins")
|
||||
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin")
|
||||
file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins"
|
||||
TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin" USE_SOURCE_PERMISSIONS)
|
||||
|
||||
if(CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$" OR CMAKE_INSTALL_CONFIG_NAME MATCHES "^([Mm][Ii][Nn][Ss][Ii][Zz][Ee][Rr][Ee][Ll])$")
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin.dSYM" AND NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin.dSYM")
|
||||
file(INSTALL DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package/Library/Application Support/obs-studio/plugins" TYPE DIRECTORY FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.plugin.dSYM" USE_SOURCE_PERMISSIONS)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
make_directory("$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp")
|
||||
|
||||
execute_process(
|
||||
COMMAND /usr/bin/pkgbuild
|
||||
--identifier '@MACOS_BUNDLEID@'
|
||||
--version '@CMAKE_PROJECT_VERSION@'
|
||||
--root "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package"
|
||||
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp/@CMAKE_PROJECT_NAME@.pkg"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND /usr/bin/productbuild
|
||||
--distribution "@CMAKE_CURRENT_BINARY_DIR@/distribution"
|
||||
--package-path "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp"
|
||||
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.pkg"
|
||||
COMMAND_ERROR_IS_FATAL ANY)
|
||||
|
||||
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@CMAKE_PROJECT_NAME@.pkg")
|
||||
file(REMOVE_RECURSE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/temp")
|
||||
file(REMOVE_RECURSE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/package")
|
||||
endif()
|
||||
|
33
cmake/macos/resources/distribution.in
Normal file
33
cmake/macos/resources/distribution.in
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<installer-gui-script minSpecVersion="1.0">
|
||||
<options
|
||||
rootVolumeOnly="true"
|
||||
hostArchitectures="arm64,x86_64"
|
||||
customize="never"
|
||||
allow-external-scripts="no" />
|
||||
<domains enable_currentUserHome="true" enable_anywhere="false" enable_localSystem="false" />
|
||||
<title>@CMAKE_PROJECT_NAME@</title>
|
||||
<choices-outline>
|
||||
<line choice="obs-plugin" />
|
||||
</choices-outline>
|
||||
<choice id="obs-plugin" title="@CMAKE_PROJECT_NAME@" description="">
|
||||
<pkg-ref id="@MACOS_BUNDLEID@" />
|
||||
</choice>
|
||||
<pkg-ref id="@MACOS_BUNDLEID@" version="@CMAKE_PROJECT_VERSION@">#@CMAKE_PROJECT_NAME@.pkg</pkg-ref>
|
||||
<installation-check script="installCheck();" />
|
||||
<script>
|
||||
function installCheck() {
|
||||
var macOSVersion = system.version.ProductVersion
|
||||
|
||||
if (system.compareVersions(macOSVersion, '@CMAKE_OSX_DEPLOYMENT_TARGET@') == -1) {
|
||||
my.result.title = system.localizedStandardStringWithFormat(
|
||||
'InstallationCheckError',
|
||||
system.localizedString('DISTRIBUTION_TITLE')
|
||||
);
|
||||
my.result.message = ' ';
|
||||
my.result.type = 'Fatal';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</installer-gui-script>
|
Loading…
Reference in New Issue
Block a user