From 47d2c1264eb14e55ade42f993be5163ffc6cfaae Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 23 Nov 2023 10:39:06 +0100 Subject: embed html frontend content as binary compiled data (#559) - Feature: Added xmake task `updatefrontend` which updates the zip file containing the frontend html (`/src/zenserver/frontend/html.zip`) - Improvement: The frontend html content is no longer appended at the end of the executable which prevented signing, instead it is compiled in from the `/src/zenserver/frontend/html.zip` archive - Improvement: MacOS now does ad-hoc code signing by default when issuing `xmake bundle`, signing with proper cert is done on CI builds --- scripts/bundle.lua | 61 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'scripts/bundle.lua') diff --git a/scripts/bundle.lua b/scripts/bundle.lua index a8a6b973a..207122345 100644 --- a/scripts/bundle.lua +++ b/scripts/bundle.lua @@ -155,21 +155,6 @@ local function _find_vcpkg_binary(triple, port, binary) return bin_path end --------------------------------------------------------------------------------- -local function _append_content_zip(bin_path) - local zip_path = "build/frontend.zip" - local content_dir = "src/zenserver/frontend/html/" - _zip(true, zip_path, content_dir) - - zip_file = io.open(zip_path, "rb") - local zip_data = zip_file:read("*all") - zip_file:close() - - bin_file = io.open(bin_path, "ab") - bin_file:write(zip_data) - bin_file:close() -end - -------------------------------------------------------------------------------- local function main_windows() import("core.base.option") @@ -183,8 +168,6 @@ local function main_windows() _build("x64", false, config_args) - _append_content_zip("build/windows/x64/release/zenserver.exe") - local crashpad_handler_path = _find_vcpkg_binary( "x64-windows-static", "sentry-native", @@ -200,7 +183,7 @@ local function main_windows() end -------------------------------------------------------------------------------- -local function main_mac() +local function main_mac(signidentity) -- Build and universalify _build("x86_64", false, "--target_minver=10.15") _build("arm64", false, "--target_minver=10.15") @@ -211,25 +194,43 @@ local function main_mac() "-create", "-output", "build/macosx/universal/release/zenserver", "build/macosx/x86_64/release/zenserver", - "build/macosx/arm64/release/zenserver" - ) + "build/macosx/arm64/release/zenserver") if ret > 0 then raise("Failed creating universal zenserver binary") end - _append_content_zip("build/macosx/universal/release/zenserver") - ret = _exec( "lipo", "-create", "-output", "build/macosx/universal/release/zen", "build/macosx/x86_64/release/zen", - "build/macosx/arm64/release/zen" - ) + "build/macosx/arm64/release/zen") if ret > 0 then raise("Failed creating universal zen binary") end + ret = _exec("codesign", + "-s", + signidentity, + "-f", + "-v", + "--deep", + "build/macosx/universal/release/zenserver") + if ret > 0 then + raise("Failed signing universal zenserver binary") + end + + ret = _exec("codesign", + "-s", + signidentity, + "-f", + "-v", + "--deep", + "build/macosx/universal/release/zen") + if ret > 0 then + raise("Failed signing universal zen binary") + end + -- At the time of writing vcpkg does not support sentry-native on arm64. Once -- it does we can create a univeral binary for this. For now just bundle x64 local crashpad_handler_path = _find_vcpkg_binary( @@ -258,8 +259,6 @@ local function main_linux() "crashpad_handler") --]] - _append_content_zip("build/linux/x86_64/release/zenserver") - _zip(false, "build/zenserver-linux.zip", "build/linux/x86_64/release/zenserver", @@ -268,13 +267,21 @@ local function main_linux() end -------------------------------------------------------------------------------- + +import("core.base.option") + function main() if is_host("windows") then return main_windows() end if is_host("mac") then - return main_mac() + signidentity = option.get("codesignidentity") + if (signidentity == nil or signidentity == '') then + signidentity = '-' + end + + return main_mac(signidentity) end if is_host("linux") then -- cgit v1.2.3