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

Side by Side Diff: fusl/BUILD.gn

Issue 1649133002: Start to fusl toolchain (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove unneeded dummy action Created 4 years, 10 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
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 # Define the sysroot directory.
6 sysroot = "$root_out_dir/sysroot"
7
5 config("fusl_config") { 8 config("fusl_config") {
6 cflags = [ 9 cflags = [
7 # Flags from musl 10 # Flags from musl
8 "-std=c99", 11 "-std=c99",
9 "-ffreestanding", 12 "-ffreestanding",
10 "-nostdinc", 13 "-nostdinc",
11 14
12 "-D_XOPEN_SOURCE=700", 15 "-D_XOPEN_SOURCE=700",
13 16
14 "-Wa,--noexecstack", 17 "-Wa,--noexecstack",
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 "src/unistd/unlinkat.c", 1463 "src/unistd/unlinkat.c",
1461 "src/unistd/usleep.c", 1464 "src/unistd/usleep.c",
1462 "src/unistd/write.c", 1465 "src/unistd/write.c",
1463 "src/unistd/writev.c", 1466 "src/unistd/writev.c",
1464 ] 1467 ]
1465 1468
1466 # Arch specific sources. 1469 # Arch specific sources.
1467 deps += [ ":libc_${current_cpu}" ] 1470 deps += [ ":libc_${current_cpu}" ]
1468 } 1471 }
1469 1472
1470 # Build a sysroot. 1473 static_library("libgcc_s") {
viettrungluu 2016/02/01 21:15:55 What's this for?
kulakowski 2016/02/01 21:29:29 Will add comment.
1471 sysroot = "${target_out_dir}/sysroot/" 1474 complete_static_lib = true
1472 sysroot_lib_dir = "${sysroot}/usr/lib" 1475 }
1473 sysroot_include_dir = "${sysroot}/usr/include" 1476
1477 static_library("libm") {
viettrungluu 2016/02/01 21:15:55 I assume this is so "-lm" works? Could you add a c
kulakowski 2016/02/01 21:29:29 Ditto.
1478 complete_static_lib = true
1479 }
1474 1480
1475 template("copy_objects") { 1481 template("copy_objects") {
1476 assert(defined(invoker.input_dir), "input_dir must be defined") 1482 assert(defined(invoker.input_dir), "input_dir must be defined")
1477 assert(defined(invoker.output_dir), "output_dir must be defined") 1483 assert(defined(invoker.output_dir), "output_dir must be defined")
1478 object_prefix = "" 1484 object_prefix = ""
1479 if (defined(invoker.object_prefix)) { 1485 if (defined(invoker.object_prefix)) {
1480 object_prefix = invoker.object_prefix 1486 object_prefix = invoker.object_prefix
1481 } 1487 }
1482 foreach(file, invoker.sources) { 1488 foreach(file, invoker.sources) {
1483 copy("copy_${file}") { 1489 copy("copy_${file}") {
(...skipping 13 matching lines...) Expand all
1497 group(target_name) { 1503 group(target_name) {
1498 deps = [ 1504 deps = [
1499 ":crt", 1505 ":crt",
1500 ] 1506 ]
1501 foreach(file, invoker.sources) { 1507 foreach(file, invoker.sources) {
1502 deps += [ ":copy_$file" ] 1508 deps += [ ":copy_$file" ]
1503 } 1509 }
1504 } 1510 }
1505 } 1511 }
1506 1512
1513 sysroot_lib_dir = "${sysroot}/usr/lib"
1514 sysroot_include_dir = "${sysroot}/usr/include"
1515
1507 copy_objects("copy_crt_objects") { 1516 copy_objects("copy_crt_objects") {
1508 sources = [ 1517 sources = [
1509 "Scrt1.o", 1518 "Scrt1.o",
1510 "crt1.o", 1519 "crt1.o",
1511 "rcrt1.o", 1520 "rcrt1.o",
1512 ] 1521 ]
1513 object_prefix = "crt." 1522 object_prefix = "crt."
1514 input_dir = "crt" 1523 input_dir = "crt"
1515 output_dir = "${sysroot_lib_dir}" 1524 output_dir = "${sysroot_lib_dir}"
1516 } 1525 }
(...skipping 24 matching lines...) Expand all
1541 if (current_cpu == "x64") { 1550 if (current_cpu == "x64") {
1542 sources = [ 1551 sources = [
1543 "arch/x86_64/bits", 1552 "arch/x86_64/bits",
1544 ] 1553 ]
1545 } 1554 }
1546 outputs = [ 1555 outputs = [
1547 "${sysroot_include_dir}/{{source_name_part}}", 1556 "${sysroot_include_dir}/{{source_name_part}}",
1548 ] 1557 ]
1549 } 1558 }
1550 1559
1551 copy("copy_libc") { 1560 copy("copy_libs") {
1552 deps = [ 1561 deps = [
1553 ":libc", 1562 ":libc",
1563 ":libgcc_s",
1564 ":libm",
1554 ] 1565 ]
1555 sources = [ 1566 sources = [
1556 "${target_out_dir}/libc.a", 1567 "${target_out_dir}/libc.a",
1568 "${target_out_dir}/libgcc_s.a",
1569 "${target_out_dir}/libm.a",
1557 ] 1570 ]
1558 outputs = [ 1571 outputs = [
1559 "${sysroot_lib_dir}/libc.a", 1572 "${sysroot_lib_dir}/{{source_name_part}}.a",
1560 ] 1573 ]
1561 } 1574 }
1562 1575
1563 group("sysroot") { 1576 group("copy_sysroot") {
1564 deps = [ 1577 deps = [
1565 ":copy_crt_objects", 1578 ":copy_crt_objects",
1566 ":copy_include", 1579 ":copy_include",
1567 ":copy_include_bits", 1580 ":copy_include_bits",
1568 ":copy_libc", 1581 ":copy_libs",
1569 ] 1582 ]
1570 if (current_cpu == "x64") { 1583 if (current_cpu == "x64") {
1571 deps += [ ":copy_crt_x64_objects" ] 1584 deps += [ ":copy_crt_x64_objects" ]
1572 } 1585 }
1573 } 1586 }
1574 1587
1588 action("finish_sysroot") {
1589 script = "tools/populate_crt.py"
1590
1591 clang = "//third_party/llvm-build/Release+Asserts/bin/clang"
1592 target = "$sysroot/usr/lib"
1593
1594 args = [
1595 rebase_path(clang),
1596 rebase_path(target),
1597 ]
1598
1599 outputs = [
1600 "$target/crtbegin.o",
1601 "$target/crtend.o",
1602 "$target/libgcc.a",
1603 ]
1604
1605 deps = [
1606 ":copy_sysroot",
1607 ]
1608 }
1609
1610 config("sysroot_config") {
1611 rebased_sysroot = rebase_path(sysroot)
1612
1613 cflags = [
1614 "--sysroot=$rebased_sysroot",
1615 "-fPIC",
1616 "-static",
1617 ]
1618
1619 ldflags = [ "--sysroot=$rebased_sysroot" ]
1620 }
1621
1622 executable("empty_main") {
1623 configs = []
1624 configs += [ ":sysroot_config" ]
1625
1626 sources = [
1627 "test/empty_main.c",
1628 ]
1629
1630 deps = [
1631 ":finish_sysroot",
1632 ]
1633 }
1634
1575 group("fusl") { 1635 group("fusl") {
1576 deps = [ 1636 deps = [
1577 ":crt", 1637 ":crt(//build/toolchain/fusl:fusl_$current_cpu)",
1578 ":libc", 1638 ":empty_main(//build/toolchain/fusl:fusl_$current_cpu)",
1579 ":sysroot", 1639 ":finish_sysroot(//build/toolchain/fusl:fusl_$current_cpu)",
1640 ":libc(//build/toolchain/fusl:fusl_$current_cpu)",
1580 ] 1641 ]
1581 } 1642 }
OLDNEW
« no previous file with comments | « build/toolchain/fusl/BUILD.gn ('k') | fusl/test/empty_main.c » ('j') | fusl/test/empty_main.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698