You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Runner] Move some functions outside of giant generate_compiler_wrappers! (#410)
* [Runner] Move some functions outside of giant `generate_compiler_wrappers!`
* [Runner] Pass new arguments to `wrapper` which were previously taken from outer scope. Sigh
# If we're given both -fsanitize= and -Wl,--no-undefined, then try turning
231
+
# the latter into a warning rather than an error.
232
+
if sanitize
233
+
println(io, """
234
+
if [[ " \${ARGS[@]} " == *"-Wl,--no-undefined"* ]]; then
235
+
PRE_FLAGS+=("-Wl,--warn-unresolved-symbols")
236
+
fi
237
+
""")
238
+
end
239
+
240
+
# Insert extra commands from the user (usually some kind of conditional setting
241
+
# of PRE_FLAGS and POST_FLAGS)
242
+
println(io)
243
+
write(io, extra_cmds)
244
+
println(io)
245
+
246
+
for (name, val) in env
247
+
write(io, "export $(name)=\"$(val)\"\n")
248
+
end
249
+
250
+
#TODO: improve this check
251
+
if lock_microarchitecture
252
+
write(io, raw"""
253
+
if [[ " ${ARGS[@]} " == *"-march="* ]]; then
254
+
echo "BinaryBuilder: Cannot force an architecture via -march" >&2
255
+
exit 1
256
+
fi
257
+
""")
258
+
println(io)
259
+
end
260
+
261
+
if no_soft_float
262
+
write(io, raw"""
263
+
if [[ " ${ARGS[@]} " == *"-mfloat-abi=soft"* ]]; then
264
+
echo "BinaryBuilder: ${target} platform does not support soft-float ABI (-mfloat-abi=soft)" >&2
265
+
exit 1
266
+
fi
267
+
""")
268
+
println(io)
269
+
end
270
+
271
+
iflength(unsafe_flags) >=1
272
+
write(io, """
273
+
if [[ "\${ARGS[@]}" =~ \"$(join(unsafe_flags, "\"|\""))\" ]]; then
274
+
echo -e \"BinaryBuilder error: You used one or more of the unsafe flags: $(join(unsafe_flags, ", "))\\nThis is not allowed, please remove all unsafe flags from your build script to continue.\" >&2
275
+
exit 1
276
+
fi
277
+
""")
278
+
println(io)
279
+
end
280
+
281
+
if allow_ccache
282
+
write(io, """
283
+
# Override `\${CCACHE}` setting from the outside.
284
+
CCACHE=""
285
+
if [[ \${USE_CCACHE} == "true" ]]; then
286
+
CCACHE="ccache"
287
+
fi
288
+
""")
289
+
end
290
+
# Don't evaluate `${CCACHE}` at all if not allowed in the first place.
# If we're given both -fsanitize= and -Wl,--no-undefined, then try turning
270
-
# the latter into a warning rather than an error.
271
-
ifsanitize(platform) !=nothing
272
-
println(io, """
273
-
if [[ " \${ARGS[@]} " == *"-Wl,--no-undefined"* ]]; then
274
-
PRE_FLAGS+=("-Wl,--warn-unresolved-symbols")
275
-
fi
276
-
""")
277
-
end
278
-
279
-
# Insert extra commands from the user (usually some kind of conditional setting
280
-
# of PRE_FLAGS and POST_FLAGS)
281
-
println(io)
282
-
write(io, extra_cmds)
283
-
println(io)
284
-
285
-
for (name, val) in env
286
-
write(io, "export $(name)=\"$(val)\"\n")
287
-
end
288
-
289
-
#TODO: improve this check
290
-
if lock_microarchitecture
291
-
write(io, raw"""
292
-
if [[ " ${ARGS[@]} " == *"-march="* ]]; then
293
-
echo "BinaryBuilder: Cannot force an architecture via -march" >&2
294
-
exit 1
295
-
fi
296
-
""")
297
-
println(io)
298
-
end
299
-
300
-
if no_soft_float
301
-
write(io, raw"""
302
-
if [[ " ${ARGS[@]} " == *"-mfloat-abi=soft"* ]]; then
303
-
echo "BinaryBuilder: ${target} platform does not support soft-float ABI (-mfloat-abi=soft)" >&2
304
-
exit 1
305
-
fi
306
-
""")
307
-
println(io)
308
-
end
309
-
310
-
iflength(unsafe_flags) >=1
311
-
write(io, """
312
-
if [[ "\${ARGS[@]}" =~ \"$(join(unsafe_flags, "\"|\""))\" ]]; then
313
-
echo -e \"BinaryBuilder error: You used one or more of the unsafe flags: $(join(unsafe_flags, ", "))\\nThis is not allowed, please remove all unsafe flags from your build script to continue.\" >&2
314
-
exit 1
315
-
fi
316
-
""")
317
-
println(io)
318
-
end
319
-
320
-
if allow_ccache
321
-
write(io, """
322
-
# Override `\${CCACHE}` setting from the outside.
323
-
CCACHE=""
324
-
if [[ \${USE_CCACHE} == "true" ]]; then
325
-
CCACHE="ccache"
326
-
fi
327
-
""")
328
-
end
329
-
# Don't evaluate `${CCACHE}` at all if not allowed in the first place.
0 commit comments