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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | fusl/tools/copy_crt.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 config("fusl_config") { 5 config("fusl_config") {
6 cflags = [ 6 cflags = [
7 # Flags from musl 7 # Flags from musl
8 "-std=c99", 8 "-std=c99",
9 "-ffreestanding", 9 "-ffreestanding",
10 "-nostdinc", 10 "-nostdinc",
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 1465
1466 # Arch specific sources. 1466 # Arch specific sources.
1467 deps += [ ":libc_${current_cpu}" ] 1467 deps += [ ":libc_${current_cpu}" ]
1468 } 1468 }
1469 1469
1470 # Build a sysroot. 1470 # Build a sysroot.
1471 sysroot = "${target_out_dir}/sysroot/" 1471 sysroot = "${target_out_dir}/sysroot/"
1472 sysroot_lib_dir = "${sysroot}/usr/lib" 1472 sysroot_lib_dir = "${sysroot}/usr/lib"
1473 sysroot_include_dir = "${sysroot}/usr/include" 1473 sysroot_include_dir = "${sysroot}/usr/include"
1474 1474
1475 action("copy_crt_objects") { 1475 template("copy_objects") {
1476 deps = [ 1476 assert(defined(invoker.input_dir), "input_dir must be defined")
1477 ":crt", 1477 assert(defined(invoker.output_dir), "output_dir must be defined")
1478 object_prefix = ""
1479 if (defined(invoker.object_prefix)) {
1480 object_prefix = invoker.object_prefix
1481 }
1482 foreach(file, invoker.sources) {
1483 copy("copy_${file}") {
1484 sources = [
1485 rebase_path("${invoker.input_dir}/${object_prefix}${file}",
1486 "",
1487 target_out_dir),
1488 ]
1489 outputs = [
1490 "${invoker.output_dir}/${file}",
1491 ]
1492 deps = [
1493 ":crt",
1494 ]
1495 }
1496 }
1497 group(target_name) {
1498 deps = [
1499 ":crt",
1500 ]
1501 foreach(file, invoker.sources) {
1502 deps += [ ":copy_$file" ]
1503 }
1504 }
1505 }
1506
1507 copy_objects("copy_crt_objects") {
1508 sources = [
1509 "Scrt1.o",
1510 "crt1.o",
1511 "rcrt1.o",
1478 ] 1512 ]
1479 script = "tools/copy_crt.py" 1513 object_prefix = "crt."
1514 input_dir = "crt"
1515 output_dir = "${sysroot_lib_dir}"
1516 }
1480 1517
1481 args = [ 1518 copy_objects("copy_crt_x64_objects") {
1482 "--source", 1519 sources = [
1483 rebase_path("${target_out_dir}/crt", root_build_dir), 1520 "crti.o",
1484 1521 "crtn.o",
1485 "--target",
1486 rebase_path("${sysroot_lib_dir}", root_build_dir),
1487
1488 # GN mangling prefix. It corresponds to e.g. the first few
1489 # characters of "crt.Scrt1.o". This is included to catch some of
1490 # the brittleness in this script, which depends on where exactly
1491 # GN places and names things. If this changes, this and the
1492 # following path names must also change.
1493 "--gn-prefix",
1494 "crt.",
1495
1496 # Object files.
1497 "crt.Scrt1.o",
1498 "crt.crt1.o",
1499 "crt.rcrt1.o",
1500 ] 1522 ]
1501 1523 object_prefix = "crt."
1502 # Arch-specific object files. 1524 input_dir = "crt/x86_64"
1503 if (current_cpu == "x64") { 1525 output_dir = "${sysroot_lib_dir}"
1504 args += [
1505 "x86_64/crt.crti.o",
1506 "x86_64/crt.crtn.o",
1507 ]
1508 }
1509
1510 outputs = [
1511 "${sysroot_lib_dir}/Scrt1.o",
1512 "${sysroot_lib_dir}/crt1.o",
1513 "${sysroot_lib_dir}/crti.o",
1514 "${sysroot_lib_dir}/crtn.o",
1515 "${sysroot_lib_dir}/rcrt1.o",
1516 ]
1517 } 1526 }
1518 1527
1519 copy("copy_include") { 1528 copy("copy_include") {
1520 sources = [ 1529 sources = [
1521 "include", 1530 "include",
1522 ] 1531 ]
1523 outputs = [ 1532 outputs = [
1524 "${sysroot_include_dir}", 1533 "${sysroot_include_dir}",
1525 ] 1534 ]
1526 } 1535 }
(...skipping 24 matching lines...) Expand all
1551 ] 1560 ]
1552 } 1561 }
1553 1562
1554 group("sysroot") { 1563 group("sysroot") {
1555 deps = [ 1564 deps = [
1556 ":copy_crt_objects", 1565 ":copy_crt_objects",
1557 ":copy_include", 1566 ":copy_include",
1558 ":copy_include_bits", 1567 ":copy_include_bits",
1559 ":copy_libc", 1568 ":copy_libc",
1560 ] 1569 ]
1570 if (current_cpu == "x64") {
1571 deps += [ ":copy_crt_x64_objects" ]
1572 }
1561 } 1573 }
1562 1574
1563 group("fusl") { 1575 group("fusl") {
1564 deps = [ 1576 deps = [
1565 ":crt", 1577 ":crt",
1566 ":libc", 1578 ":libc",
1567 ":sysroot", 1579 ":sysroot",
1568 ] 1580 ]
1569 } 1581 }
OLDNEW
« 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