@@ -64,6 +64,39 @@ filegroup(
64
64
)
65
65
"""
66
66
67
+ RUST_FREEBSD_BUILD_FILE = """
68
+ filegroup(
69
+ name = "rustc",
70
+ srcs = ["rustc/bin/rustc"],
71
+ visibility = ["//visibility:public"],
72
+ )
73
+
74
+ filegroup(
75
+ name = "rustc_lib",
76
+ srcs = glob(["rustc/lib/*.so"]),
77
+ visibility = ["//visibility:public"],
78
+ )
79
+
80
+ filegroup(
81
+ name = "rustdoc",
82
+ srcs = ["rustc/bin/rustdoc"],
83
+ visibility = ["//visibility:public"],
84
+ )
85
+
86
+ filegroup(
87
+ name = "rust_lib",
88
+ srcs = glob([
89
+ "rust-std-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/*.rlib",
90
+ "rust-std-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/*.so",
91
+ "rust-std-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/*.a",
92
+ "rustc/lib/rustlib/x86_64-unknown-freebsd/lib/*.rlib",
93
+ "rustc/lib/rustlib/x86_64-unknown-freebsd/lib/*.so",
94
+ "rustc/lib/rustlib/x86_64-unknown-freebsd/lib/*.a",
95
+ ]),
96
+ visibility = ["//visibility:public"],
97
+ )
98
+ """
99
+
67
100
# This defines the default toolchain separately from the actual repositories, so that the remote
68
101
# repositories will only be downloaded if they are actually used.
69
102
DEFAULT_TOOLCHAINS = """
@@ -118,6 +151,31 @@ rust_toolchain(
118
151
dylib_ext = ".dylib",
119
152
visibility = ["//visibility:public"],
120
153
)
154
+
155
+ toolchain(
156
+ name = "rust-freebsd-x86_64",
157
+ exec_compatible_with = [
158
+ "@bazel_tools//platforms:freebsd",
159
+ "@bazel_tools//platforms:x86_64",
160
+ ],
161
+ target_compatible_with = [
162
+ "@bazel_tools//platforms:freebsd",
163
+ "@bazel_tools//platforms:x86_64",
164
+ ],
165
+ toolchain = ":rust-freebsd-x86_64_impl",
166
+ toolchain_type = "@io_bazel_rules_rust//rust:toolchain",
167
+ )
168
+
169
+ rust_toolchain(
170
+ name = "rust-freebsd-x86_64_impl",
171
+ rust_doc = "@rust_freebsd_x86_64//:rustdoc",
172
+ rust_lib = ["@rust_freebsd_x86_64//:rust_lib"],
173
+ rustc = "@rust_freebsd_x86_64//:rustc",
174
+ rustc_lib = ["@rust_freebsd_x86_64//:rustc_lib"],
175
+ staticlib_ext = ".a",
176
+ dylib_ext = ".so",
177
+ visibility = ["//visibility:public"],
178
+ )
121
179
"""
122
180
123
181
# Eventually with better toolchain hosting options we could load only one of these, not both.
@@ -138,6 +196,14 @@ def rust_repositories():
138
196
build_file_content = RUST_DARWIN_BUILD_FILE ,
139
197
)
140
198
199
+ native .new_http_archive (
200
+ name = "rust_freebsd_x86_64" ,
201
+ url = "https://static.rust-lang.org/dist/rust-1.24.1-x86_64-unknown-freebsd.tar.gz" ,
202
+ strip_prefix = "rust-1.24.1-x86_64-unknown-freebsd" ,
203
+ sha256 = "a33af1434186a42b3156060f0343f4816f9df5ec253c199d1be59fd42ed1e304" ,
204
+ build_file_content = RUST_FREEBSD_BUILD_FILE ,
205
+ )
206
+
141
207
native .new_local_repository (
142
208
name = "rust_default_toolchains" ,
143
209
path = "." ,
@@ -146,4 +212,5 @@ def rust_repositories():
146
212
# Register toolchains
147
213
native .register_toolchains (
148
214
"@rust_default_toolchains//:rust-linux-x86_64" ,
149
- "@rust_default_toolchains//:rust-darwin-x86_64" )
215
+ "@rust_default_toolchains//:rust-darwin-x86_64" ,
216
+ "@rust_default_toolchains//:rust-freebsd-x86_64" )
0 commit comments