Skip to content

Commit

Permalink
bump: sysroots (#45)
Browse files Browse the repository at this point in the history
* bump: sysroots

Signed-off-by: Thulio Ferraz Assis <[email protected]>

* fix: flags

Signed-off-by: Thulio Ferraz Assis <[email protected]>
  • Loading branch information
f0rmiga authored Jun 15, 2022
1 parent 44655e1 commit 88622f3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 29 deletions.
43 changes: 20 additions & 23 deletions sysroot/flags.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,32 @@ ARCH_AARCH64 = "aarch64"
cflags = [
"-fdiagnostics-color=always",
"-nostdinc",
"-B{toolchain_root}/bin",
]

cxxflags = [
"-fdiagnostics-color=always",
"-nostdinc",
"-nostdinc++",
"-B{toolchain_root}/bin",
]

# buildifier: disable=function-docstring
def ldflags(arch, gcc_version):
if arch == ARCH_X86_64:
lib = "lib64"
target_triplet = "x86_64-linux-gnu"
target = "x86_64-linux"
arch_specific_prefix = ""
elif arch == ARCH_ARMV7:
lib = "lib"
target_triplet = "arm-linux-gnueabihf"
arch_specific_prefix = target_triplet + "/"
target = "arm-linux-gnueabihf"
arch_specific_prefix = target + "/"
elif arch == ARCH_AARCH64:
lib = "lib64"
target_triplet = "aarch64-linux-gnu"
arch_specific_prefix = ""
target = "aarch64-linux"
arch_specific_prefix = target + "/"
else:
fail("unknown arch")
return [
"-B{toolchain_root}/bin",
"-B%sysroot%/usr/{lib}".format(lib = lib),
"-B%sysroot%/usr/lib",
"-B%sysroot%/{arch_specific_prefix}{lib}".format(
arch_specific_prefix = arch_specific_prefix,
lib = lib
Expand All @@ -45,43 +42,43 @@ def ldflags(arch, gcc_version):
arch_specific_prefix = arch_specific_prefix,
lib = lib
),
"-L%sysroot%/usr/{lib}".format(lib = lib),
"-L%sysroot%/lib/gcc/{target_triplet}/{gcc_version}".format(
"-L%sysroot%/usr/lib",
"-L%sysroot%/lib/gcc/{target}/{gcc_version}".format(
gcc_version = gcc_version,
target_triplet = target_triplet,
target = target,
),
]

# buildifier: disable=function-docstring
def includes(arch, gcc_version):
if arch == ARCH_X86_64:
target_triplet = "x86_64-linux-gnu"
target = "x86_64-linux"
include_prefix = ""
elif arch == ARCH_ARMV7:
target_triplet = "arm-linux-gnueabihf"
include_prefix = target_triplet + "/"
target = "arm-linux-gnueabihf"
include_prefix = target + "/"
elif arch == ARCH_AARCH64:
target_triplet = "aarch64-linux-gnu"
include_prefix = ""
target = "aarch64-linux"
include_prefix = target + "/"
else:
fail("unknown arch")
return [
"%sysroot%/{include_prefix}include/c++/{gcc_version}".format(
gcc_version = gcc_version,
include_prefix = include_prefix,
),
"%sysroot%/{include_prefix}include/c++/{gcc_version}/{target_triplet}".format(
"%sysroot%/{include_prefix}include/c++/{gcc_version}/{target}".format(
gcc_version = gcc_version,
include_prefix = include_prefix,
target_triplet = target_triplet,
target = target,
),
"%sysroot%/lib/gcc/{target_triplet}/{gcc_version}/include-fixed".format(
"%sysroot%/lib/gcc/{target}/{gcc_version}/include-fixed".format(
gcc_version = gcc_version,
target_triplet = target_triplet,
target = target,
),
"%sysroot%/lib/gcc/{target_triplet}/{gcc_version}/include".format(
"%sysroot%/lib/gcc/{target}/{gcc_version}/include".format(
gcc_version = gcc_version,
target_triplet = target_triplet,
target = target,
),
"%sysroot%/usr/include",
]
17 changes: 17 additions & 0 deletions toolchain/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ def _impl(ctx):
"-no-canonical-prefixes",
"-fno-canonical-system-headers",
"-Wno-builtin-macro-redefined",
],
),
],
),
],
)

redacted_dates_feature = feature(
name = "redacted_dates",
enabled = True,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = [
flag_group(
flags = [
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\"",
Expand Down Expand Up @@ -455,6 +471,7 @@ def _impl(ctx):
user_compile_flags_feature,
sysroot_feature,
unfiltered_compile_flags_feature,
redacted_dates_feature,
extra_cflags_feature,
extra_cxxflags_feature,
extra_ldflags_feature,
Expand Down
12 changes: 6 additions & 6 deletions toolchain/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,16 @@ ARCHS = struct(

_SYSROOTS = {
"aarch64": struct(
sha256 = "8ccddd7ca9cd188fbfb06bf29fc5dccc213e5b80591f44e3f84c38e5ad0bb419",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.1.0/sysroot-aarch64.tar.xz",
sha256 = "11e01ece0de5265be7446ab6de55b3d75b6aa75d42acd1db057efe3db8cce7f9",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.2.0/sysroot-aarch64.tar.xz",
),
"armv7": struct(
sha256 = "a3941793e74fd21b1dfc067c7e96d4e6e246914f9050eaf44abb0ebc91121227",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.1.0/sysroot-armv7.tar.xz",
sha256 = "14180244f06f6cdf98ec283dffaf333f21a91d5e3ddaebc71967d798d2a73bd3",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.2.0/sysroot-armv7.tar.xz",
),
"x86_64": struct(
sha256 = "a5b0f5515684b16fb564b935f4b7ee28feda8ded966e26be7c67db71c6148493",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.1.0/sysroot-x86_64.tar.xz",
sha256 = "fc37e9dd5184093b6f92fc4e0a4b680dc144814d6225bc44daaf1b284311b0cc",
url = "https://github.com/aspect-build/gcc-toolchain/releases/download/0.2.0/sysroot-x86_64.tar.xz",
),
}

Expand Down

0 comments on commit 88622f3

Please sign in to comment.