Use the downloaded clang when building for armhf-debian
This makes it work on a barebones Stretch installation.
Also add building for this CPU to the CI script so we know it keeps
working, which means marking everything that's supposed to work
appropriately.
Change-Id: Ic050ce20eae45c6b23e0e42dddb24db3ebc70b84
diff --git a/tools/build_rules/protobuf.bzl b/tools/build_rules/protobuf.bzl
index 11753c2..9c92158 100644
--- a/tools/build_rules/protobuf.bzl
+++ b/tools/build_rules/protobuf.bzl
@@ -38,28 +38,30 @@
}
_do_proto_cc_library = rule(
- implementation = _do_proto_cc_library_impl,
- attrs = {
- 'src': attr.label(
- allow_files = FileType(['.proto']),
- mandatory = True,
- single_file = True,
- ),
- 'deps': attr.label_list(providers = ["proto"]),
- '_protoc': attr.label(
- default = Label('//third_party/protobuf:protoc'),
- executable = True,
- cfg = 'host',
- ),
- '_well_known_protos': attr.label(
- default = Label('//third_party/protobuf:well_known_protos'),
- ),
- },
- outputs = _do_proto_cc_library_outputs,
- output_to_genfiles = True,
+ attrs = {
+ "src": attr.label(
+ allow_files = FileType([".proto"]),
+ mandatory = True,
+ single_file = True,
+ ),
+ "deps": attr.label_list(providers = ["proto"]),
+ "_protoc": attr.label(
+ default = Label("//third_party/protobuf:protoc"),
+ executable = True,
+ cfg = "host",
+ ),
+ "_well_known_protos": attr.label(
+ default = Label("//third_party/protobuf:well_known_protos"),
+ ),
+ },
+ output_to_genfiles = True,
+ outputs = _do_proto_cc_library_outputs,
+ implementation = _do_proto_cc_library_impl,
)
-def proto_cc_library(name, src, deps = [], visibility = None):
+def proto_cc_library(name, src, deps = [],
+ compatible_with = None, restricted_to = None,
+ visibility = None):
'''Generates a cc_library from a single .proto file. Does not support
dependencies on any .proto files except the well-known ones protobuf comes
with (which are unconditionally depended on).
@@ -73,6 +75,8 @@
src = src,
deps = [('%s__proto_srcs' % o_name) for o_name in deps],
visibility = visibility,
+ compatible_with = compatible_with,
+ restricted_to = restricted_to,
)
basename = src[:-len('.proto')]
native.cc_library(
@@ -81,4 +85,6 @@
hdrs = [ '%s.pb.h' % basename ],
deps = [ '//third_party/protobuf' ] + deps,
visibility = visibility,
+ compatible_with = compatible_with,
+ restricted_to = restricted_to,
)
diff --git a/tools/build_rules/select.bzl b/tools/build_rules/select.bzl
index 994e775..2d0bce5 100644
--- a/tools/build_rules/select.bzl
+++ b/tools/build_rules/select.bzl
@@ -3,10 +3,15 @@
# quickly find issues where something new isn't handled.
# It will also make adding ORs when it makes sense easy to do nicely.
-all_cpus = ['amd64', 'roborio', 'armhf']
-'''All of the CPUs we know about.'''
+all_cpus = [
+ "amd64",
+ "roborio",
+ "armhf",
+]
-'''A select wrapper for CPU architectures.
+"""All of the CPUs we know about."""
+
+"""A select wrapper for CPU architectures.
Args:
values: A mapping from architecture names (as strings) to other things.
@@ -14,7 +19,8 @@
'else' is also allowed as a default.
'arm' is allowed instead of roborio and armhf.
Returns a select which evaluates to the correct element of values.
-'''
+"""
+
def cpu_select(values):
if 'arm' in values:
new_values = {}
@@ -39,12 +45,13 @@
'//tools:cpu_armhf': values['armhf'],
})
-'''A select wrapper for address space sizes.
+"""A select wrapper for address space sizes.
Args:
values: A mapping from address space sizes (as strings) to other things.
Returns a select which evaluates to the correct element of values.
-'''
+"""
+
def address_size_select(values):
if '32' not in values:
fail('Need to handle 32 bit addresses!', 'values')
@@ -53,15 +60,17 @@
return select({
'//tools:cpu_k8': values['64'],
'//tools:cpu_roborio': values['32'],
+ '//tools:cpu_armhf': values['32'],
})
-'''A select wrapper for compilers.
+"""A select wrapper for compilers.
Args:
values: A mapping from compiler names (as strings) to other things.
Currently 'gcc' and 'clang' are recognized.
Returns a select which evaluates to the correct element of values.
-'''
+"""
+
def compiler_select(values):
if 'gcc' not in values:
fail('Need to handle gcc!', 'values')