1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-07-19 02:54:47 +02:00

WIP: Add mac .dmg installer

This does not yet work with signing of the
macos .dmg
ScreenPlay-Installer.dmg:
rejected (the code is valid but does not seem to be an app)
This commit is contained in:
Elias Steurer 2023-08-24 16:02:43 +02:00
parent 716db7ac66
commit fdbf077f0e
4 changed files with 68 additions and 31 deletions

View File

@ -0,0 +1,22 @@
message(STATUS "[DMG INSTALLER ENABLED]: Configuring. This can take some time...")
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_VOLUME_NAME "ScreenPlay")
set(CPACK_SYSTEM_NAME "OSX")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_PACKAGE_NAME "ScreenPlay")
set(CPACK_PACKAGE_FILE_NAME "ScreenPlay-Installer")
set(CPACK_PACKAGE_VENDOR "Elias Steurer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
include(CPack)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "./")

View File

@ -135,8 +135,12 @@ if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
endif()
if(${SCREENPLAY_INSTALLER} AND NOT APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
if(${SCREENPLAY_INSTALLER})
if(APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateDmgInstaller.cmake)
else()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
endif()
endif()
message(STATUS "[PROJECT] PROJECT_VERSION = ${PROJECT_VERSION}")

View File

@ -104,18 +104,29 @@ def execute(
package_duration = time.time() - step_time
print(f"⏱️ package_duration: {package_duration}s")
if platform.system() == "Darwin":
if (build_config.sign_osx):
print(f"Sign binary at: {build_config.bin_dir}")
macos_sign.sign(build_config=build_config)
# Creates a Qt InstallerFrameWork (IFW) installer
if build_config.create_installer == "ON":
step_time = time.time()
build_installer(build_config, build_result)
build_installer_duration = time.time() - step_time
print(f"⏱️ build_installer_duration: {build_installer_duration}s")
print(f"⏱️ build_installer_duration: {build_installer_duration}s")
if platform.system() == "Darwin":
if (build_config.sign_osx):
print(f"Sign ScreenPlay-installer.dmg at: {build_config.bin_dir}")
macos_sign.sign_dmg(build_config=build_config)
# Create a zip file of the build
step_time = time.time()
build_result = zip(build_config, build_result)
zip_duration = time.time() - step_time
print(f"⏱️ zip_duration: {zip_duration}s")
if platform.system() != "Darwin":
step_time = time.time()
build_result = zip(build_config, build_result)
zip_duration = time.time() - step_time
print(f"⏱️ zip_duration: {zip_duration}s")
duration = time.time() - start_time
print(f"⏱️ Build completed in: {duration}s")
@ -247,10 +258,6 @@ def package(build_config: BuildConfig):
run(cmd=cmd_raw.format(qt_bin_path=qt_bin_path, repo_root_path=source_path,
build_bin_dir=build_bin_dir, app="ScreenPlayWidget"), cwd=cwd)
if (build_config.sign_osx):
print(f"Sign binary at: {build_config.bin_dir}")
macos_sign.sign(build_config=build_config)
if platform.system() == "Windows":
print("Executing deploy commands...")
run(build_config.package_command.format(

View File

@ -7,6 +7,7 @@ import time
stdout.reconfigure(encoding='utf-8')
def sign(build_config: BuildConfig):
print("Run codedesign")
#run("codesign -f -s 'Developer ID Application: Elias Steurer (V887LHYKRH)' --verbose --force --timestamp --options 'runtime' -f --entitlements '../../ScreenPlay/entitlements.plist' 'ScreenPlay.app/' ",
@ -17,6 +18,7 @@ def sign(build_config: BuildConfig):
# run(base_sign_command.format(app="ffprobe"), cwd=build_config.bin_dir)
run("codesign --deep -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --verbose --force --timestamp --options \"runtime\" --entitlements \"../../ScreenPlay/entitlements.plist\" \"ScreenPlay.app/\"",
cwd=build_config.bin_dir)
print("Run codedesign verify")
run("codesign --verify --verbose=4 'ScreenPlay.app/'",
@ -41,25 +43,27 @@ def sign(build_config: BuildConfig):
print("Run spctl assess")
run("spctl --assess --verbose 'ScreenPlay.app/'", cwd=build_config.bin_dir)
print("Remove *.app.zip files.")
print("Remove ScreenPlay.app.zip.")
run("rm ScreenPlay.app.zip", cwd=build_config.bin_dir)
def sign_dmg(build_config: BuildConfig):
# Sign the DMG
run("codesign -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
# We also need to sign the installer in osx:
if build_config.create_installer == "ON":
run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"", cwd=build_config.build_folder)
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"",
cwd=build_config.build_folder)
run("xcnotary notarize ScreenPlay-Installer.dmg/ScreenPlay-Installer.app -d kelteseth@gmail.com -k ScreenPlay",
cwd=build_config.build_folder)
run("spctl --assess --verbose \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/\"",
cwd=build_config.build_folder)
run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg/\"", cwd=build_config.build_folder)
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg/\"",
cwd=build_config.build_folder)
run("xcnotary notarize ScreenPlay-Installer.dmg -d kelteseth@gmail.com -k ScreenPlay",
cwd=build_config.build_folder)
run("spctl --assess --verbose \"ScreenPlay-Installer.dmg/\"",
cwd=build_config.build_folder)
# Verify the DMG's signature
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
# Pack the DMG for notarization
run("ditto -c -k --keepParent ScreenPlay-Installer.dmg ScreenPlay-Installer.dmg.zip", cwd=build_config.build_folder)
# Notarize the DMG using notarytool
run("xcrun notarytool submit ScreenPlay-Installer.dmg.zip --keychain-profile 'ScreenPlay' --wait", cwd=build_config.build_folder)
# Staple the notarization ticket to the DMG
run("xcrun stapler staple ScreenPlay-Installer.dmg", cwd=build_config.build_folder)
# Check the notarization status for the DMG
run("spctl --assess --verbose \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
# Clean up the zip file
run("rm ScreenPlay-Installer.dmg.zip", cwd=build_config.build_folder)