Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: fusl/BUILD.gn

Issue 1628443003: Use GN to copy crt objects into fusl sysroot (Closed) Base URL: https://github.com/domokit/mojo.git@gn-update
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fusl/tools/copy_crt.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/BUILD.gn
diff --git a/fusl/BUILD.gn b/fusl/BUILD.gn
index a03a3585f18559d2300ee9904d9b4db9c7434dbc..a352bcbc19e88b8e6c358b7889dbe09ab84f0390 100644
--- a/fusl/BUILD.gn
+++ b/fusl/BUILD.gn
@@ -1472,48 +1472,57 @@ sysroot = "${target_out_dir}/sysroot/"
sysroot_lib_dir = "${sysroot}/usr/lib"
sysroot_include_dir = "${sysroot}/usr/include"
-action("copy_crt_objects") {
- deps = [
- ":crt",
- ]
- script = "tools/copy_crt.py"
-
- args = [
- "--source",
- rebase_path("${target_out_dir}/crt", root_build_dir),
-
- "--target",
- rebase_path("${sysroot_lib_dir}", root_build_dir),
-
- # GN mangling prefix. It corresponds to e.g. the first few
- # characters of "crt.Scrt1.o". This is included to catch some of
- # the brittleness in this script, which depends on where exactly
- # GN places and names things. If this changes, this and the
- # following path names must also change.
- "--gn-prefix",
- "crt.",
-
- # Object files.
- "crt.Scrt1.o",
- "crt.crt1.o",
- "crt.rcrt1.o",
- ]
-
- # Arch-specific object files.
- if (current_cpu == "x64") {
- args += [
- "x86_64/crt.crti.o",
- "x86_64/crt.crtn.o",
+template("copy_objects") {
+ assert(defined(invoker.input_dir), "input_dir must be defined")
+ assert(defined(invoker.output_dir), "output_dir must be defined")
+ object_prefix = ""
+ if (defined(invoker.object_prefix)) {
+ object_prefix = invoker.object_prefix
+ }
+ foreach(file, invoker.sources) {
+ copy("copy_${file}") {
+ sources = [
+ rebase_path("${invoker.input_dir}/${object_prefix}${file}",
+ "",
+ target_out_dir),
+ ]
+ outputs = [
+ "${invoker.output_dir}/${file}",
+ ]
+ deps = [
+ ":crt",
+ ]
+ }
+ }
+ group(target_name) {
+ deps = [
+ ":crt",
]
+ foreach(file, invoker.sources) {
+ deps += [ ":copy_$file" ]
+ }
}
+}
- outputs = [
- "${sysroot_lib_dir}/Scrt1.o",
- "${sysroot_lib_dir}/crt1.o",
- "${sysroot_lib_dir}/crti.o",
- "${sysroot_lib_dir}/crtn.o",
- "${sysroot_lib_dir}/rcrt1.o",
+copy_objects("copy_crt_objects") {
+ sources = [
+ "Scrt1.o",
+ "crt1.o",
+ "rcrt1.o",
]
+ object_prefix = "crt."
+ input_dir = "crt"
+ output_dir = "${sysroot_lib_dir}"
+}
+
+copy_objects("copy_crt_x64_objects") {
+ sources = [
+ "crti.o",
+ "crtn.o",
+ ]
+ object_prefix = "crt."
+ input_dir = "crt/x86_64"
+ output_dir = "${sysroot_lib_dir}"
}
copy("copy_include") {
@@ -1558,6 +1567,9 @@ group("sysroot") {
":copy_include_bits",
":copy_libc",
]
+ if (current_cpu == "x64") {
+ deps += [ ":copy_crt_x64_objects" ]
+ }
}
group("fusl") {
« no previous file with comments | « no previous file | fusl/tools/copy_crt.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698