Files
Custom-Operating-System/build/userland/TEMPLATE.gni

95 lines
2.5 KiB
Plaintext
Raw Normal View History

2025-02-12 09:54:05 -05:00
import("//build/security/SIGN_TEMPLATE.gni")
import("//build/userland/EXEC_TEMPLATE.gni")
template("xOS_executable") {
app_name = target_name
assert(defined(invoker.install_path), "Install path must be provided")
signexec = false
if (defined(invoker.signexec)) {
signexec = invoker.signexec
}
if (signexec) {
xOS_signexec(app_name) {
binpath = invoker.install_path + app_name
}
}
xOS_executable_template(app_name) {
need_sign_section = signexec
forward_variables_from(invoker,
[
"install_path",
"sources",
"configs",
"deplibs",
"cflags",
"cflags_c",
"cflags_cc",
"cflags_objc",
"cflags_objcc",
"asmflags",
"ldflags",
"public_deps",
"include_dirs",
])
}
group(app_name) {
deps = [ ":$app_name" + "_build" ]
if (signexec) {
deps += [ ":sign_" + "$app_name" ]
}
}
}
template("xOS_application") {
app_name = target_name
root = "Applications/$app_name.app"
exec_file = "$root/Content/"
action("prepare_$app_name") {
script = "//build/userland/prepare_app.py"
outputs = [ "$root_out_dir/base/Applications/$app_name.app/Content" ]
args = [
app_name,
invoker.display_name,
rebase_path("$root_out_dir/base/Applications/$app_name.app/Content",
root_build_dir),
rebase_path("//userland/applications/$app_name", root_build_dir),
]
}
xOS_signexec(app_name) {
binpath = exec_file + app_name
}
xOS_executable_template(app_name) {
install_path = "$exec_file"
need_sign_section = true
forward_variables_from(invoker,
[
"sources",
"configs",
"deplibs",
"cflags",
"cflags_c",
"cflags_cc",
"asmflags",
"ldflags",
"public_deps",
"include_dirs",
])
}
group(app_name) {
deps = [
":$app_name" + "_build",
":prepare_$app_name",
":sign_" + "$app_name",
]
}
}