Squash commits for public release
This commit is contained in:
73
build/userland/BUILD.gn
Normal file
73
build/userland/BUILD.gn
Normal file
@@ -0,0 +1,73 @@
|
||||
import("//build/userland/USERLAND_FLAGS.gni")
|
||||
|
||||
config("userland_flags") {
|
||||
cflags = uland_c_flags
|
||||
cflags_cc = uland_cc_flags
|
||||
cflags_objcc = uland_objcc_flags
|
||||
asmflags = uland_asm_flags
|
||||
ldflags = uland_ld_flags
|
||||
defines = [ "xOS" ]
|
||||
}
|
||||
|
||||
group("applications") {
|
||||
deps = [
|
||||
"//userland/applications/about:about",
|
||||
"//userland/applications/activity_monitor:activity_monitor",
|
||||
"//userland/applications/calculator:calculator",
|
||||
"//userland/applications/terminal:terminal",
|
||||
]
|
||||
}
|
||||
|
||||
group("system") {
|
||||
deps = [
|
||||
"//userland/system/applist:applist",
|
||||
"//userland/system/dock:dock",
|
||||
"//userland/system/homescreen:homescreen",
|
||||
]
|
||||
}
|
||||
|
||||
group("servers") {
|
||||
deps = [ "//userland/servers/window_server:window_server" ]
|
||||
}
|
||||
|
||||
group("utilities") {
|
||||
deps = [
|
||||
"//userland/utilities/cat:cat",
|
||||
"//userland/utilities/kill:kill",
|
||||
"//userland/utilities/ls:ls",
|
||||
"//userland/utilities/mkdir:mkdir",
|
||||
"//userland/utilities/rm:rm",
|
||||
"//userland/utilities/rmdir:rmdir",
|
||||
"//userland/utilities/sudo:sudo",
|
||||
"//userland/utilities/touch:touch",
|
||||
"//userland/utilities/uname:uname",
|
||||
"//userland/utilities/whoami:whoami",
|
||||
]
|
||||
}
|
||||
|
||||
group("userland") {
|
||||
deps = [
|
||||
"//build/userland:applications",
|
||||
"//build/userland:servers",
|
||||
"//build/userland:system",
|
||||
"//build/userland:utilities",
|
||||
"//userland/shell/xsh:xsh",
|
||||
]
|
||||
|
||||
# Make sure that we don't run any tests/benchmarks, since
|
||||
# tests/benchmarks use thier own entry point.
|
||||
if (test_method == "none") {
|
||||
deps += [ "//userland/servers/launch_server:launch_server" ]
|
||||
}
|
||||
|
||||
if (compile_tests) {
|
||||
deps += [
|
||||
"//userland/tests/testlibcxx:testlibcxx",
|
||||
"//userland/tests/utester:utester",
|
||||
]
|
||||
|
||||
if (objc_support) {
|
||||
deps += [ "//userland/tests/testobjc:testobjc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
77
build/userland/EXEC_TEMPLATE.gni
Normal file
77
build/userland/EXEC_TEMPLATE.gni
Normal file
@@ -0,0 +1,77 @@
|
||||
template("xOS_executable_template") {
|
||||
assert(defined(invoker.sources),
|
||||
"Need sources in $target_name to build xOS App")
|
||||
|
||||
app_name = target_name
|
||||
app_build_name = app_name + "_build"
|
||||
|
||||
deplibs = []
|
||||
depbuilders = []
|
||||
includes = []
|
||||
confs = []
|
||||
if (defined(invoker.libs)) {
|
||||
deplibs = invoker.libs
|
||||
}
|
||||
if (defined(invoker.deps)) {
|
||||
depbuilders = invoker.deps
|
||||
}
|
||||
if (defined(invoker.include_dirs)) {
|
||||
includes = invoker.include_dirs
|
||||
}
|
||||
if (defined(invoker.configs)) {
|
||||
confs = invoker.configs
|
||||
}
|
||||
if (defined(invoker.deplibs)) {
|
||||
foreach(i, invoker.deplibs) {
|
||||
deplibs += [ "$root_out_dir/base/libs/" + i + ".a" ]
|
||||
depbuilders += [ "//libs/" + i + ":" + i ]
|
||||
includes += [ "//libs/" + i + "/include" ]
|
||||
confs += [ "//libs/" + i + ":" + i + "_include_config" ]
|
||||
|
||||
# Also adding libc includes.
|
||||
# Note to add libc after libcxx.
|
||||
if (i == "libcxx") {
|
||||
includes += [ "//libs/libc/include" ]
|
||||
}
|
||||
|
||||
if (i == "libui") {
|
||||
includes += [ "//libs/libapi/include" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
linkflags = []
|
||||
if (defined(invoker.need_sign_section) && invoker.need_sign_section == true) {
|
||||
# Adding empty section for a signature.
|
||||
# HACK: Since ldflags follow inputs for linker we put this
|
||||
# section as a first flag, but it will be treated as input.
|
||||
linkflags += [ rebase_path("$root_out_dir/tmp/elfsign_section.o", "") ]
|
||||
}
|
||||
if (defined(invoker.ldflags)) {
|
||||
linkflags += invoker.ldflags
|
||||
}
|
||||
|
||||
executable(app_build_name) {
|
||||
if (defined(invoker.install_path)) {
|
||||
output_name = "base/" + invoker.install_path + app_name
|
||||
} else {
|
||||
output_name = "base/bin/" + app_name
|
||||
}
|
||||
sources = invoker.sources
|
||||
libs = deplibs
|
||||
deps = depbuilders
|
||||
include_dirs = includes
|
||||
configs = confs
|
||||
ldflags = linkflags
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"cflags",
|
||||
"cflags_c",
|
||||
"cflags_cc",
|
||||
"cflags_objc",
|
||||
"cflags_objcc",
|
||||
"asmflags",
|
||||
"public_deps",
|
||||
])
|
||||
}
|
||||
}
|
||||
94
build/userland/TEMPLATE.gni
Normal file
94
build/userland/TEMPLATE.gni
Normal file
@@ -0,0 +1,94 @@
|
||||
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",
|
||||
]
|
||||
}
|
||||
}
|
||||
140
build/userland/USERLAND_FLAGS.gni
Normal file
140
build/userland/USERLAND_FLAGS.gni
Normal file
@@ -0,0 +1,140 @@
|
||||
uland_c_flags = [
|
||||
"-Werror",
|
||||
"-Wno-address-of-packed-member",
|
||||
]
|
||||
|
||||
if (userland_symbols) {
|
||||
uland_c_flags += [ "-ggdb" ]
|
||||
}
|
||||
|
||||
if (optimize) {
|
||||
uland_c_flags += [ "-Os" ]
|
||||
}
|
||||
|
||||
uland_cc_flags = [
|
||||
"-std=c++2a",
|
||||
"-fno-sized-deallocation",
|
||||
"-fno-exceptions",
|
||||
"-D_LIBCXX_BUILD_XOS_EXTENSIONS",
|
||||
]
|
||||
|
||||
uland_objcc_flags = uland_cc_flags + [
|
||||
"-fno-objc-exceptions",
|
||||
"-fno-objc-arc",
|
||||
]
|
||||
|
||||
uland_asm_flags = []
|
||||
uland_ld_flags = []
|
||||
|
||||
if (device_type == "desktop") {
|
||||
uland_c_flags += [ "-DTARGET_DESKTOP" ]
|
||||
}
|
||||
if (device_type == "mobile") {
|
||||
uland_c_flags += [ "-DTARGET_MOBILE" ]
|
||||
}
|
||||
|
||||
if (target_arch == "x86") {
|
||||
uland_asm_flags += [
|
||||
"-f",
|
||||
"elf",
|
||||
]
|
||||
}
|
||||
|
||||
if (target_arch == "x86_64") {
|
||||
uland_asm_flags += [
|
||||
"-f",
|
||||
"elf64",
|
||||
]
|
||||
}
|
||||
|
||||
if (target_arch == "arm32") {
|
||||
uland_c_flags += [
|
||||
"-fno-builtin",
|
||||
"-march=armv7-a",
|
||||
"-mfpu=neon-vfpv4",
|
||||
"-mfloat-abi=softfp",
|
||||
"-fno-pie",
|
||||
]
|
||||
uland_asm_flags += [
|
||||
"-march=armv7-a",
|
||||
"-mfpu=neon-vfpv4",
|
||||
"-mfloat-abi=softfp",
|
||||
"-mcpu=cortex-a15",
|
||||
]
|
||||
uland_ld_flags += [ "-nostdlib" ]
|
||||
|
||||
if (host == "gnu") {
|
||||
uland_ld_flags += [
|
||||
"-nostdinc",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-lgcc",
|
||||
]
|
||||
}
|
||||
|
||||
if (host == "llvm") {
|
||||
uland_ld_flags += [
|
||||
"--oformat",
|
||||
"elf32-littlearm",
|
||||
"/usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.builtins-arm.a",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (target_arch == "arm64") {
|
||||
uland_c_flags += [
|
||||
"-fno-builtin",
|
||||
"-mcpu=cortex-a53+nocrypto+nocrc",
|
||||
"-fno-pie",
|
||||
]
|
||||
uland_asm_flags += [ "-mcpu=cortex-a53+nocrypto+nocrc" ]
|
||||
uland_ld_flags += [ "-nostdlib" ]
|
||||
|
||||
if (host == "gnu") {
|
||||
uland_ld_flags += [
|
||||
"-nostdinc",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-lgcc",
|
||||
]
|
||||
}
|
||||
|
||||
if (host == "llvm") {
|
||||
uland_ld_flags += [
|
||||
"--oformat",
|
||||
"elf64-littlearm",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (target_arch == "riscv64") {
|
||||
uland_c_flags += [
|
||||
"-fno-builtin",
|
||||
"-march=rv64ima",
|
||||
"-mabi=lp64",
|
||||
]
|
||||
uland_asm_flags += [
|
||||
"-march=rv64ima",
|
||||
"-mabi=lp64",
|
||||
]
|
||||
uland_ld_flags += [ "-nostdlib" ]
|
||||
|
||||
if (host == "gnu") {
|
||||
uland_ld_flags += [
|
||||
"-nostdinc",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
rebase_path("//toolchains/gcc_runtime/10.2.1/riscv64-libgcc.a",
|
||||
root_build_dir),
|
||||
]
|
||||
}
|
||||
|
||||
if (host == "llvm") {
|
||||
uland_ld_flags += [
|
||||
"--oformat",
|
||||
"elf64",
|
||||
rebase_path("//toolchains/gcc_runtime/10.2.1/riscv64-libgcc.a",
|
||||
root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
44
build/userland/prepare_app.py
Normal file
44
build/userland/prepare_app.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
fs_app_name = sys.argv[1]
|
||||
app_name = sys.argv[2]
|
||||
outpath = sys.argv[3]
|
||||
src_dir = sys.argv[4]
|
||||
|
||||
|
||||
def print_json(config_file, rdict):
|
||||
json.dump(rdict, config_file, indent=4)
|
||||
|
||||
|
||||
def read_config(path):
|
||||
with open(path) as json_file:
|
||||
data = json.load(json_file)
|
||||
return data
|
||||
return {}
|
||||
|
||||
|
||||
def write_config(config, outpath):
|
||||
config_file = open(outpath+"/info.json", "w")
|
||||
|
||||
config['name'] = app_name
|
||||
config['exec_rel_path'] = fs_app_name
|
||||
config['icon_path'] = "/res/icons/apps/" + fs_app_name + ".icon"
|
||||
config['bundle_id'] = "com.x.{0}".format(fs_app_name)
|
||||
|
||||
print_json(config_file, config)
|
||||
config_file.close()
|
||||
|
||||
|
||||
if not os.path.exists(outpath):
|
||||
os.makedirs(outpath)
|
||||
|
||||
config = {}
|
||||
for fname in os.listdir(src_dir):
|
||||
if fname == "info.json":
|
||||
config = read_config(src_dir + "/info.json")
|
||||
break
|
||||
|
||||
write_config(config, outpath)
|
||||
Reference in New Issue
Block a user