From 84a73963cb2a97b9f4d2ee2b4c28f004ce801f11 Mon Sep 17 00:00:00 2001 From: Gonzalo Exequiel Pedone Date: Wed, 3 Nov 2021 19:10:30 -0300 Subject: [PATCH] Switched from QtIFW to MacPkg. --- CMakeLists.txt | 108 ++++++++++---------- package_info.conf.in | 15 +-- ports/deploy/mac/installScripts/postinstall | 50 +++++++++ ports/deploy/mac/uninstall.sh | 25 +++++ 4 files changed, 134 insertions(+), 64 deletions(-) create mode 100644 ports/deploy/mac/installScripts/postinstall create mode 100644 ports/deploy/mac/uninstall.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index e7756e3..9e59376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,54 +1,54 @@ -# akvirtualcamera, virtual camera for Mac and Windows. -# Copyright (C) 2021 Gonzalo Exequiel Pedone -# -# akvirtualcamera is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# akvirtualcamera is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with akvirtualcamera. If not, see . -# -# Web-Site: http://webcamoid.github.io/ - -cmake_minimum_required(VERSION 3.5) - -project(AkVirtualCamera) - -include(commons.cmake) - -add_subdirectory(VCamUtils) - -if (APPLE) - add_subdirectory(cmio) - set(TARGET_PLATFORM mac) - set(BUILD_INFO_FILE AkVirtualCamera.plugin/Contents/Resources/build-info.txt) - set(APP_LIBDIR AkVirtualCamera.plugin/Contents/Frameworks) - set(MAIN_EXECUTABLE AkVirtualCamera.plugin/Contents/MacOS/AkVirtualCamera) - set(PACKET_TARGET_ARCH ${TARGET_ARCH}) - set(QTIFW_TARGET_DIR "\@ApplicationsDir\@/AkVirtualCamera") - set(OUTPUT_FORMATS "QtIFW") -elseif (WIN32) - add_subdirectory(dshow) - set(TARGET_PLATFORM windows) - set(BUILD_INFO_FILE share/build-info.txt) - set(MAIN_EXECUTABLE ${TARGET_ARCH}/AkVCamManager.exe) - set(APP_LIBDIR ${TARGET_ARCH}) - - if (IS_64BITS_TARGET) - set(PACKET_TARGET_ARCH win64) - else () - set(PACKET_TARGET_ARCH win32) - endif() - - set(OUTPUT_FORMATS "Nsis") -endif () - -add_subdirectory(Manager) - -configure_file(package_info.conf.in package_info.conf) +# akvirtualcamera, virtual camera for Mac and Windows. +# Copyright (C) 2021 Gonzalo Exequiel Pedone +# +# akvirtualcamera is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# akvirtualcamera is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with akvirtualcamera. If not, see . +# +# Web-Site: http://webcamoid.github.io/ + +cmake_minimum_required(VERSION 3.5) + +project(AkVirtualCamera) + +include(commons.cmake) + +add_subdirectory(VCamUtils) + +if (APPLE) + add_subdirectory(cmio) + set(TARGET_PLATFORM mac) + set(BUILD_INFO_FILE AkVirtualCamera.plugin/Contents/Resources/build-info.txt) + set(APP_LIBDIR AkVirtualCamera.plugin/Contents/Frameworks) + set(MAIN_EXECUTABLE AkVirtualCamera.plugin/Contents/MacOS/AkVirtualCamera) + set(PACKET_TARGET_ARCH ${TARGET_ARCH}) + set(QTIFW_TARGET_DIR "\@ApplicationsDir\@/AkVirtualCamera") + set(OUTPUT_FORMATS "MacPkg") +elseif (WIN32) + add_subdirectory(dshow) + set(TARGET_PLATFORM windows) + set(BUILD_INFO_FILE share/build-info.txt) + set(MAIN_EXECUTABLE ${TARGET_ARCH}/AkVCamManager.exe) + set(APP_LIBDIR ${TARGET_ARCH}) + + if (IS_64BITS_TARGET) + set(PACKET_TARGET_ARCH win64) + else () + set(PACKET_TARGET_ARCH win32) + endif() + + set(OUTPUT_FORMATS "Nsis") +endif () + +add_subdirectory(Manager) + +configure_file(package_info.conf.in package_info.conf) diff --git a/package_info.conf.in b/package_info.conf.in index b94061d..275a824 100644 --- a/package_info.conf.in +++ b/package_info.conf.in @@ -11,17 +11,12 @@ outputFormats = @OUTPUT_FORMATS@ hideArch = true writeLauncher = false -[QtIFW] -organization = org.webcamoidprj +[MacPkg] appName = AkVirtualCamera -title = AkVirtualCamera, virtual camera for Mac and Windows -description = Install AkVirtualCamera -url = https://github.com/webcamoid/akvirtualcamera -targetDir = @QTIFW_TARGET_DIR@ -license = COPYING -licenseName = GNU General Public License v3.0 -script = ports/deploy/installscript.@TARGET_PLATFORM@.qs -changeLog = ChangeLog +identifier = org.webcamoidprj.AkVirtualCamera +targetDir = /Applications/AkVirtualCamera +installScripts = ports/deploy/mac/installScripts +uninstallScript = ports/deploy/mac/uninstall.sh [Nsis] organization = Webcamoid diff --git a/ports/deploy/mac/installScripts/postinstall b/ports/deploy/mac/installScripts/postinstall new file mode 100644 index 0000000..99137c8 --- /dev/null +++ b/ports/deploy/mac/installScripts/postinstall @@ -0,0 +1,50 @@ +#!/bin/sh + +appName=AkVirtualCamera +targetDir=/Applications/${appName} + +# Remove old plugin +rm -rf "/Library/CoreMediaIO/Plug-Ins/DAL/${appName}.plugin" + +resourcesDir=${targetDir}/${appName}.plugin/Contents/Resources + +# Reset permissions +chmod a+x "${resourcesDir}/AkVCamAssistant" +chmod a+x "${resourcesDir}/AkVCamManager" + +# Create a symlink to the plugin. +ln -s "${targetDir}/${appName}.plugin" "/Library/CoreMediaIO/Plug-Ins/DAL/${appName}.plugin" + +// Set assistant daemon. +service=org.webcamoid.cmio.AkVCam.Assistant +daemonPlist=/Library/LaunchDaemons/${service}.plist +cat << EOF > "${daemonPlist}" + + + + + Label + ${service} + ProgramArguments + + ${resourcesDir}/AkVCamAssistant + --timeout + 300.0 + + MachServices + + ${service} + + + StandardOutPath + /tmp/AkVCamAssistant.log + StandardErrorPath + /tmp/AkVCamAssistant.log + + +EOF + +# Load assistant daemon. +launchctl enable "system/${service}" +launchctl bootstrap system "${daemonPlist}" diff --git a/ports/deploy/mac/uninstall.sh b/ports/deploy/mac/uninstall.sh new file mode 100644 index 0000000..07deb08 --- /dev/null +++ b/ports/deploy/mac/uninstall.sh @@ -0,0 +1,25 @@ +appName=AkVirtualCamera +path=$(realpath "$0") +targetDir=$(dirname "$path") + +# Unregister app from packages database +pkgutil --forget org.webcamoidprj.${appName} + +resourcesDir=${targetDir}/${appName}.plugin/Contents/Resources + +# Remove virtual cameras +"${resourcesDir}/AkVCamManager" remove-devices +"${resourcesDir}/AkVCamManager" update + +# Remove symlink +rm -f "/Library/CoreMediaIO/Plug-Ins/DAL/${appName}.plugin" + +# Disable service +service=org.webcamoid.cmio.AkVCam.Assistant +daemonPlist=/Library/LaunchDaemons/${service}.plist +launchctl enable "system/${service}" +launchctl bootout system "${daemonPlist}" +rm -f "${daemonPlist}" + +# Remove installed files +rm -rf "${targetDir}"