This commit updates the build_sign_notarize.sh script to improve the notarization process by introducing a conditional stapling option. It also cleans up temporary files and clears macOS provenance metadata to prevent issues during builds. The Dmg.cmake script is modified to remove the reliance on environment variables for codesigning, streamlining the build process. Additionally, the build_app.sh script is enhanced with heartbeat logging for long-running commands and improved cleanup procedures for build directories.
115 lines
5.1 KiB
CMake
115 lines
5.1 KiB
CMake
# NOTE: Packaging helpers should not be REQUIRED at configure time.
|
|
# Missing tools should simply disable the related custom targets.
|
|
find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin)
|
|
if(MACDEPLOYQT_EXECUTABLE)
|
|
message(STATUS "Found macdeployqt: ${MACDEPLOYQT_EXECUTABLE}")
|
|
else()
|
|
message(WARNING "Missing macdeployqt executable.")
|
|
endif()
|
|
|
|
find_program(MACDEPLOYCHECK_EXECUTABLE NAMES macdeploycheck PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin)
|
|
if(MACDEPLOYCHECK_EXECUTABLE)
|
|
message(STATUS "Found macdeploycheck: ${MACDEPLOYCHECK_EXECUTABLE}")
|
|
else()
|
|
message(STATUS "macdeploycheck not found (optional): 'deploycheck' target will be unavailable.")
|
|
endif()
|
|
|
|
find_program(CREATEDMG_EXECUTABLE NAMES create-dmg)
|
|
if(CREATEDMG_EXECUTABLE)
|
|
message(STATUS "Found create-dmg: ${CREATEDMG_EXECUTABLE}")
|
|
else()
|
|
message(WARNING "Missing create-dmg executable.")
|
|
endif()
|
|
|
|
set(_SPARKLE_FRAMEWORK_DIR "")
|
|
set(_SPARKLE_ORIGINAL_BIN_LINK "")
|
|
set(_SPARKLE_ORIGINAL_BIN_REAL "")
|
|
if(SPARKLE)
|
|
# SPARKLE may be either the framework directory or the framework binary path.
|
|
get_filename_component(_sparkle_link "${SPARKLE}" ABSOLUTE)
|
|
get_filename_component(_sparkle_real "${SPARKLE}" REALPATH)
|
|
if(_sparkle_link MATCHES "Sparkle\\.framework$")
|
|
set(_SPARKLE_FRAMEWORK_DIR "${_sparkle_real}")
|
|
set(_SPARKLE_ORIGINAL_BIN_LINK "${_sparkle_link}/Versions/B/Sparkle")
|
|
set(_SPARKLE_ORIGINAL_BIN_REAL "${_sparkle_real}/Versions/B/Sparkle")
|
|
else()
|
|
# Assume it's the framework binary path:
|
|
# .../Sparkle.framework/Versions/B/Sparkle
|
|
set(_SPARKLE_ORIGINAL_BIN_LINK "${_sparkle_link}")
|
|
set(_SPARKLE_ORIGINAL_BIN_REAL "${_sparkle_real}")
|
|
get_filename_component(_sparkle_b_dir "${_SPARKLE_ORIGINAL_BIN_REAL}" DIRECTORY) # .../Versions/B
|
|
get_filename_component(_sparkle_versions_dir "${_sparkle_b_dir}" DIRECTORY) # .../Versions
|
|
get_filename_component(_SPARKLE_FRAMEWORK_DIR "${_sparkle_versions_dir}" DIRECTORY) # .../Sparkle.framework
|
|
endif()
|
|
|
|
if(NOT EXISTS "${_SPARKLE_FRAMEWORK_DIR}" OR NOT EXISTS "${_SPARKLE_ORIGINAL_BIN_REAL}")
|
|
set(_SPARKLE_FRAMEWORK_DIR "")
|
|
set(_SPARKLE_ORIGINAL_BIN_LINK "")
|
|
set(_SPARKLE_ORIGINAL_BIN_REAL "")
|
|
else()
|
|
message(STATUS "Sparkle.framework found: ${_SPARKLE_FRAMEWORK_DIR}")
|
|
endif()
|
|
endif()
|
|
|
|
if(MACDEPLOYQT_EXECUTABLE)
|
|
|
|
# Note: We intentionally do NOT codesign during the CMake 'deploy'/'dmg' targets.
|
|
# macdeployqt can optionally sign, but passing identities safely through Ninja's /bin/sh wrapper is brittle.
|
|
# This repo's signing/notarization pipeline is handled in build_tools/macos/build_sign_notarize.sh instead.
|
|
if(CREATEDMG_SKIP_JENKINS)
|
|
set(CREATEDMG_SKIP_JENKINS_ARG "--skip-jenkins")
|
|
endif()
|
|
|
|
set(_deploy_commands
|
|
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks
|
|
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources
|
|
COMMAND cp -v ${CMAKE_BINARY_DIR}/dist/macos/Info.plist ${CMAKE_BINARY_DIR}/strawberry.app/Contents/
|
|
COMMAND cp -v ${CMAKE_SOURCE_DIR}/dist/macos/strawberry.icns ${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources/
|
|
)
|
|
|
|
if(_SPARKLE_FRAMEWORK_DIR)
|
|
list(APPEND _deploy_commands
|
|
COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/bundle_sparkle.sh ${CMAKE_BINARY_DIR}/strawberry.app ${_SPARKLE_FRAMEWORK_DIR} ${_SPARKLE_ORIGINAL_BIN_LINK} ${_SPARKLE_ORIGINAL_BIN_REAL}
|
|
)
|
|
endif()
|
|
|
|
list(APPEND _deploy_commands
|
|
COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macgstcopy.sh ${CMAKE_BINARY_DIR}/strawberry.app
|
|
COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app -verbose=3 -executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/gst-plugin-scanner
|
|
)
|
|
|
|
# Make 'deploy' incremental:
|
|
# - add_custom_target() is always out-of-date, so it reruns every time.
|
|
# - using a stamp file makes Ninja/Make skip deploy when inputs haven't changed.
|
|
set(_deploy_stamp "${CMAKE_BINARY_DIR}/deploy_app_bundle.stamp")
|
|
|
|
add_custom_command(
|
|
OUTPUT "${_deploy_stamp}"
|
|
${_deploy_commands}
|
|
COMMAND ${CMAKE_COMMAND} -E touch "${_deploy_stamp}"
|
|
COMMENT "Deploying app bundle (bundling Sparkle/GStreamer + macdeployqt)"
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
DEPENDS
|
|
strawberry
|
|
"${CMAKE_BINARY_DIR}/dist/macos/Info.plist"
|
|
"${CMAKE_SOURCE_DIR}/dist/macos/strawberry.icns"
|
|
"${CMAKE_SOURCE_DIR}/dist/macos/macgstcopy.sh"
|
|
"${CMAKE_SOURCE_DIR}/dist/macos/bundle_sparkle.sh"
|
|
)
|
|
|
|
add_custom_target(deploy DEPENDS "${_deploy_stamp}")
|
|
|
|
if(MACDEPLOYCHECK_EXECUTABLE)
|
|
add_custom_target(deploycheck
|
|
COMMAND ${MACDEPLOYCHECK_EXECUTABLE} strawberry.app
|
|
)
|
|
endif()
|
|
if(CREATEDMG_EXECUTABLE)
|
|
add_custom_target(dmg
|
|
COMMAND ${CREATEDMG_EXECUTABLE} --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 ${CREATEDMG_SKIP_JENKINS_ARG} strawberry-${STRAWBERRY_VERSION_PACKAGE}-${CMAKE_HOST_SYSTEM_PROCESSOR}.dmg strawberry.app
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
DEPENDS deploy
|
|
)
|
|
endif()
|
|
endif()
|