diff options
Diffstat (limited to 'bundle.lua')
| -rw-r--r-- | bundle.lua | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/bundle.lua b/bundle.lua new file mode 100644 index 000000000..81e292034 --- /dev/null +++ b/bundle.lua @@ -0,0 +1,87 @@ +-- Copyright Epic Games, Inc. All Rights Reserved. + +local function bundle_windows() + import("core.base.option") + import("detect.tools.find_zip") + import("detect.tools.find_7z") + import("detect.sdks.find_vcpkgdir") + + local zip_cmd = find_7z() + if not zip_cmd then + raise("unable to find zip tool") + end + + local dirs = { + vcpkg = { + root = find_vcpkgdir(), + tools = "" + }, + sentry = { + root = "" + }, + package = { + root = "" + } + } + + if dirs.vcpkg.root == nil or dirs.vcpkg.root == "" then + raise("unable to find vcpkg root directory" ); + end + + dirs.vcpkg.tools = dirs.vcpkg.root.."/installed/x64-windows-static/tools" + dirs.sentry.root = dirs.vcpkg.tools.."/sentry-native" + + dirs.package_root = "./build/packages/z" + + local external_files = { + dirs.sentry.root.."/crashpad_handler.exe" + } + + dirs.package.root = "./build/packages/z" + + dirs.package.zenserver = { + root = dirs.package.root.."/zenserver", + windows = dirs.package.root.."/zenserver/windows/x64/release/bin" + } + + local config = "-c -m release -a x64" + if option.get("withtrace") then + config = config.." --zentrace=yes" + end + + print(os.exec("xmake config "..config)) + print(os.exec("xmake build zenserver")) + print(os.exec("xmake package -f local zenserver")) + + -- copy extenral file(s) + for _,file in ipairs(external_files) do + printf("copy '%s' -> '%s'\n", file, dirs.package.zenserver.windows) + os.cp(file, dirs.package.zenserver.windows.."/") + end + + -- create zip file + local bundle_name = "zenserver-win64.zip" + if option.get("withtrace") then + bundle_name = "zenserver-trace-win64.zip" + end + + local bundle_path = dirs.package.zenserver.root.."/"..bundle_name + + local zip_args = {} + table.insert(zip_args, "a") + table.insert(zip_args, bundle_path) + table.insert(zip_args, dirs.package.zenserver.windows.."/*.*") + + print(string.format("creating bundle '%s' from '%s'\n",bundle_path, dirs.package.zenserver.windows.."/")) + os.runv(zip_cmd, zip_args) + + print(string.format("bundle '%s' ok!", bundle_name)) +end + +function main() + if is_host("windows") then + return bundle_windows() + end + + raise("'xmake bundle' not currently supported on this platform") +end |