-
Notifications
You must be signed in to change notification settings - Fork 8
/
.bazelrc
709 lines (619 loc) · 35.1 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
# Global bazel options for toktok-stack.
import %workspace%/tools/bazelrc.boot
##############################################################################
#
# :: Bazel UI flags and globally enabled features.
#
##############################################################################
build --show_progress_rate_limit=0.5
build --workspace_status_command=tools/project/mkstamp.sh
build --check_licenses=true
#build --enable_workspace
build --process_headers_in_dependencies
# TODO(iphydf): needs bazel 7
#build --remote_build_event_upload=minimal
#build --remote_cache_compression
build --remote_download_outputs=minimal # use "all" to make YCM work
build --strict_filesets=true
build --strict_proto_deps=error
# TODO(iphydf): Enable once we have a more recent version of protobuf that
# supports --allowed_public_imports.
#build --strict_public_imports=strict
build --strict_system_includes=true
build --experimental_strict_fileset_output
build --experimental_strict_java_deps=error
build --enable_platform_specific_config
build --run_validations
build --watchfs
#build --local_resources=cpu=HOST_CPUS # TODO(iphydf): needs bazel 7
build --features=layering_check
build --experimental_inmemory_dotd_files
build --experimental_inmemory_jdeps_files
build --experimental_omitfp
build --experimental_remotable_source_manifests
build --experimental_remote_merkle_tree_cache
build --experimental_remote_require_cached
build --experimental_repository_cache_hardlinks
build --experimental_guard_against_concurrent_changes
build --experimental_import_deps_checking=warning
build --experimental_android_compress_java_resources=true
build --experimental_android_resource_shrinking=true
#build --experimental_desugar_java8_libs=true
build --incompatible_check_testonly_for_output_files
build --incompatible_config_setting_private_default_visibility
build --incompatible_default_to_explicit_init_py
build --incompatible_disable_native_android_rules
build --incompatible_dont_use_javasourceinfoprovider
build --incompatible_enable_apple_toolchain_resolution
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_exclusive_test_sandboxed
build --incompatible_remote_use_new_exit_code_for_lost_inputs
build --incompatible_sandbox_hermetic_tmp
build --incompatible_strict_action_env
build --incompatible_visibility_private_attributes_at_definition
# These don't work, yet.
#build --incompatible_stop_exporting_language_modules
#build --incompatible_disallow_struct_provider_syntax
#build --incompatible_no_rule_outputs_param
#build --incompatible_disable_starlark_host_transitions
# TODO(iphydf): Make this work somehow with clang.
#coverage --combined_report=lcov
#coverage --experimental_cc_coverage
#coverage --experimental_use_llvm_covmap
#coverage --experimental_generate_llvm_lcov
#coverage --instrument_test_targets
##############################################################################
#
# :: Execution strategy flags.
#
##############################################################################
# Use persistent workers for Java and Scala compilers (much faster).
build --strategy=Javac=worker
build --strategy=Scalac=worker
build --worker_sandboxing
build:libc++ --cxxopt='-stdlib=libc++'
build:libc++ --linkopt='-stdlib=libc++'
# Use remote caching. This is disabled by default, because unless you have a
# fairly fast connection (like on our CI systems), this is not very useful.
build:remote-grpc --remote_cache=grpc://code.tox.chat:9092
build:remote-http --remote_cache=https://code.tox.chat/bazel
build:remote --config=remote-grpc
# Use remote execution. Disabled by default, because we don't want everyone to
# use the remote executors (and they might be down sometimes).
#build:remote-exec --remote_executor=grpc://code.tox.chat:8980
build:remote-exec --remote_executor=grpc://10.100.0.1:8980
# The remote executor doesn't have everything available, so we consider it the
# same as cross compilation.
build:remote-exec --build_tag_filters=-no-cross,-qt,-macos,-windows
build:remote-exec --test_tag_filters=-no-cross,-qt,-macos,-windows
# Without this, the build farm needs to have *all* build artifacts in its CAS.
build:remote-exec --remote_download_outputs=all
##############################################################################
#
# :: C/C++ compiler flags.
#
##############################################################################
# Flags for systems with GNU linker or compatible.
build --host_linkopt='-fPIE'
build --host_linkopt='-Wl,-z,defs'
build --linkopt='-Wl,-z,noexecstack'
build --host_linkopt='-Wl,-z,noexecstack'
build --host_linkopt='-Wl,--warn-execstack'
build:local --linkopt='-Wl,--fatal-warnings'
build:local --host_linkopt='-Wl,--fatal-warnings'
build:strict --linkopt='-Wl,--detect-odr-violations'
build:strict --host_linkopt='-Wl,--detect-odr-violations'
build:strict --linkopt='-Wl,--gc-sections'
build:strict --host_linkopt='-Wl,--gc-sections'
build:strict --linkopt='-Wl,--rosegment'
build:strict --host_linkopt='-Wl,--rosegment'
build:strict --linkopt='-Wl,--warn-common'
build:strict --host_linkopt='-Wl,--warn-common'
# UBSan is always enabled, but by default in trap mode (no runtime needed).
build --copt='-fsanitize=undefined'
build --copt='-fsanitize-trap=all'
# Always enable assert() in tests.
build --per_file_copt='_test.cc?@-UNDEBUG'
# Optimize libsodium and opus even in debug mode.
# They are simply too slow (tests time out) otherwise.
build --per_file_copt='external/libsodium[:/]@-O3'
build --per_file_copt='external/opus[:/]@-O3'
# Fastbuild (default) mode.
build --strip=never
# Debug mode.
build:debug -c dbg
# Release mode.
build:release -c opt
build:release --strip=always
# NDEBUG disables asserts.
#build:release --copt='-Wno-unused-variable'
build:strace --run_under="/run/current-system/sw/bin/strace -f"
build:dynamic-analysis --jobs=4
build:dynamic-analysis --test_timeout=300
build:dynamic-analysis --per_file_copt='//c-toxcore[:/]@-g,-UNDEBUG'
build:valgrind --run_under="valgrind --track-origins=yes --error-exitcode=1 --fullpath-after=/proc/self/cwd/"
build:valgrind --config=dynamic-analysis
build:drmemory --run_under="drmemory --"
build:drmemory --config=dynamic-analysis
build:libfuzzer --per_file_copt="//c-toxcore[:/]@-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
build:libfuzzer --host_per_file_copt="//c-toxcore[:/]@-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer
build:libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer
build:honggfuzz --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:honggfuzz
build:honggfuzz --@rules_fuzzing//fuzzing:cc_engine_instrumentation=honggfuzz
build:asan-libfuzzer --config=libfuzzer --config=asan
build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan
build:sanitizer --config=debug
build:sanitizer --copt='-UNDEBUG'
build:sanitizer --copt='-O3'
# TODO(https://github.com/tweag/rules_nixpkgs/issues/430): Remove when released.
build:sanitizer --copt='-fno-sanitize-ignorelist'
build:sanitizer --per_file_copt='//c-toxcore[:/]@-O0'
build:sanitizer --per_file_copt='//c-toxcore[:/]@-fno-inline,-fno-omit-frame-pointer'
build:sanitizer --flaky_test_attempts=1
build:sanitizer --build_tag_filters=-no-san,-haskell,-windows,-macos
build:sanitizer --test_tag_filters=-no-san,-haskell,-windows,-macos
# Some of this is from "Can I run AddressSanitizer with more aggressive diagnostics enabled?"
# on https://github.com/google/sanitizers/wiki/AddressSanitizer#faq and some is from
# https://chromium.googlesource.com/external/github.com/grpc/grpc/+/4e9206f48c91e17f43856b016b12f59dd5118293/tools/bazel.rc
build:asan --config=sanitizer
build:asan --features=asan
build:asan --copt='-fsanitize=address'
build:asan --copt='-fsanitize-address-use-after-return=always'
build:asan --copt='-fsanitize-address-use-after-scope'
build:asan --linkopt='-fsanitize=address'
build:asan --test_env=ASAN_OPTIONS=color=always:detect_leaks=1:strict_string_checks=1:check_initialization_order=1:strict_init_order=1:external_symbolizer_path=/nix/store/h6rpdk8nb097diyqk1vsglw9chwgfsjr-llvm-18.1.8/bin/llvm-symbolizer
build:asan --test_env=LSAN_OPTIONS=report_objects=1
build:msan --config=sanitizer
# TODO(iphydf): Get an msan-enabled libc++ into Nix.
#build:msan --config=libc++
build:msan --copt='-fsanitize=memory'
build:msan --copt='-fsanitize-memory-track-origins=2'
build:msan --linkopt='-fsanitize=memory'
build:msan --test_env=MSAN_OPTIONS=color=always:external_symbolizer_path=/nix/store/h6rpdk8nb097diyqk1vsglw9chwgfsjr-llvm-18.1.8/bin/llvm-symbolizer
build:msan --per_file_copt='//toxic[:/]@-UAUDIO,-UVIDEO,-UPYTHON'
build:tsan --config=sanitizer
build:tsan --features=tsan
build:tsan --copt='-fsanitize=thread'
build:tsan --linkopt='-fsanitize=thread'
build:tsan --test_env=TSAN_OPTIONS=color=always,history_size=7,force_seq_cst_atomics=1:external_symbolizer_path=/nix/store/h6rpdk8nb097diyqk1vsglw9chwgfsjr-llvm-18.1.8/bin/llvm-symbolizer
build:ubsan --config=sanitizer
build:ubsan --features=ubsan
build:ubsan --copt='-fsanitize=nullability,undefined'
#build:ubsan --per_file_copt='//c-toxcore[:/]@-fsanitize=integer'
build:ubsan --copt='-fno-sanitize-recover=all'
build:ubsan --copt='-fno-sanitize-trap=all'
build:ubsan --linkopt='-fsanitize=integer,nullability,undefined'
# https://github.com/bazelbuild/bazel/issues/11122
build:ubsan --linkopt='-fsanitize-link-c++-runtime'
build:ubsan --per_file_copt='//c-toxcore[:/]@-D_DEBUG'
build:ubsan --test_env=UBSAN_OPTIONS=color=always,print_stacktrace=1:external_symbolizer_path=/nix/store/h6rpdk8nb097diyqk1vsglw9chwgfsjr-llvm-18.1.8/bin/llvm-symbolizer
# Link-time optimization.
build:lto --copt='-flto'
build:lto --linkopt='-flto'
build:android --crosstool_top=//external:android/crosstool
build:android --cpu=armeabi-v7a
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:android --verbose_failures
build:android --copt='-Wno-unused-macros'
build --per_file_copt='external/.*[-_]neon_dotprod\\.c$@-march=generic+dotprod'
build --per_file_copt='external/.*[-_]neon_i8mm\\.c$@-march=generic+dotprod+i8mm'
build --per_file_copt='external/.*[-_]sve\\.c$@-march=generic+dotprod+i8mm+sve'
build --per_file_copt='external/.*[-_]sve2\\.c$@-march=generic+dotprod+i8mm+sve+sve2'
build --per_file_copt='external/.*[-_]avx\\.c$@-mavx'
build --per_file_copt='external/.*[-_]avx2\\.c$@-mavx2'
build --per_file_copt='external/.*[-_]avx512f\\.c$@-mavx512f'
build --per_file_copt='external/.*[-_]sse\\.c$@-mssse3,-msse4'
build --per_file_copt='external/.*[-_]sse4\\.c$@-msse4,-msse4.1'
build --per_file_copt='external/.*[-_]sse41\\[email protected]'
build --per_file_copt='external/.*[-_]sse4_1\\[email protected]'
build --per_file_copt='external/.*[-_]ssse3\\.c$@-mssse3'
# Colour diagnostics, even though bazel uses non-tty pipes.
build --copt='-fdiagnostics-color=always'
# ABI and source behaviour options.
build --copt='-funsigned-char'
build --cxxopt='-fno-exceptions'
build --cxxopt='-fno-rtti'
build --cxxopt='-DGOOGLE_PROTOBUF_NO_RTTI'
# Disable deprecated Tox APIs.
#build --copt='-DTOX_HIDE_DEPRECATED'
# Enable trace logging for toxcore.
build --per_file_copt='//c-toxcore/@-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE'
build --per_file_copt='//c-toxcore/@-DMAX_VLA_SIZE=2048'
build --per_file_copt='//c-toxcore/@-Wframe-larger-than=20000'
# Disable most logging when running with flakynet (we get lots of warnings).
build:flakynet --per_file_copt='//c-toxcore/@-UMIN_LOGGER_LEVEL,-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_ERROR'
build:flakynet --run_under="//tools/debug:run_flakynet --headstart=1000 --syscalls=1 --flakiness=0.1"
build:oomer --custom_malloc="//tools/debug:oomer"
build:oomer --test_env=OOMER_MAX_ALLOCS=200
build:oomer --test_env=OOMER_FLAKY=0.005
build:oomer --test_env=OOMER_TIMEOUT=5
build:oomer --test_env=OOMER_VERBOSE=1
build:oomer --config=ubsan
# while true; do bazel run --config=mallocfail //c-toxcore/auto_tests:tox_one_test; done
build:mallocfail --custom_malloc="//tools/debug:mallocfail"
build:mallocfail --test_env=MALLOCFAIL_TIMEOUT=5
build:mallocfail --run_under="mallocfail"
build:mallocfail --config=ubsan
# Always build debugging tools with debug info.
build --per_file_copt='//tools/debug[:/]@-g'
test --test_output=errors
test --test_verbose_timeout_warnings=true
##############################################################################
#
# :: Warning flags (some compiler-specific).
#
##############################################################################
# Use GNU versions of the C standard, because runtime/cgo doesn't set feature
# flags correctly. We then override it in *all* per-file flags, which ends up
# not matching runtime/cgo/gcc_setenv.c for some reason.
build --cxxopt='-std=c++20'
build --host_cxxopt='-std=c++20'
build --conlyopt='-std=gnu17'
build --per_file_copt='\\.c$@-std=c17'
build --per_file_copt='@-Wall'
build --per_file_copt='@-Werror'
build --per_file_copt='@-Weverything'
build --per_file_copt='@-pedantic'
build --copt='-Wno-c++20-compat'
build --copt='-Wno-c++98-compat'
build --copt='-Wno-c++98-compat-pedantic'
build --copt='-Wno-conversion'
build --copt='-Wno-covered-switch-default'
build --copt='-Wno-disabled-macro-expansion'
build --copt='-Wno-documentation-deprecated-sync'
build --copt='-Wno-missing-field-initializers'
build --copt='-Wno-missing-noreturn'
build --copt='-Wno-padded'
build --copt='-Wno-reserved-id-macro'
build --copt='-Wno-switch-default'
build --copt='-Wno-unused-parameter'
build --copt='-Wno-vla'
build --copt='-ftrapv'
# snprintf and some others are marked unused, but are used in many places.
build --copt='-Wno-used-but-marked-unused'
# This isn't a useful warning and makes code uglier.
build --per_file_copt='@-Wno-missing-braces'
# __attribute__((nonnull)) warns about defensive null checks.
build --per_file_copt='@-Wno-tautological-pointer-compare'
# This warning triggers when system header macros introduce reserved
# identifiers, which is exactly the point of them being reserved.
build --copt='-Wno-reserved-identifier'
# This is a C89 requirement, we use C99.
build --copt='-Wno-declaration-after-statement'
# Useless warning, see https://stackoverflow.com/questions/77017567.
build --copt='-Wno-unsafe-buffer-usage'
# Used in absl, for some reason doesn't work with per_file_copt.
# TODO(iphydf): Find out why.
build --copt='-Wno-deprecated-builtins'
# TODO(iphydf): FIXME
build --copt='-Wno-unreachable-code-return'
# NO_FRAME_POINTER is set when compiling fuzzers (for some reason), causing absl to use the
# libunwind stack trace implementation, which is Google internal-only, so fails to compile in Open
# Source software.
build --per_file_copt='external/com_google_absl[:/]@-UNO_FRAME_POINTER,-fno-omit-frame-pointer'
build --per_file_copt='external/abseil-cpp~[:/]@-UNO_FRAME_POINTER,-fno-omit-frame-pointer'
# Compile toxcore as C++.
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-xc++,-std=c++20'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-alloca'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-c99-extensions'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-old-style-cast'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unreachable-code-return'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unused-macros'
# Cython code isn't very clean.
build --per_file_copt='//py_toxcore_c[:/]@-Wno-cast-align'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-cast-qual'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-conditional-uninitialized'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-extra-semi-stmt'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-missing-variable-declarations'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-old-style-cast'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-shadow'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-undef'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-unreachable-code'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-unused-macros'
build --per_file_copt='//py_toxcore_c[:/]@-Wno-zero-as-null-pointer-constant'
# https://github.com/cython/cython/issues/6586
build --per_file_copt='//py_toxcore_c[:/]@-fno-sanitize=enum'
# Protobuf generated code has so many warnings we just ignore all of them.
build --per_file_copt='\.pb\.cc$@-w'
# X11/Xfuncproto.h does this.
build --per_file_copt='//qtox[:/].*x11.cpp$@-Wno-variadic-macros'
# xproto's keysymdef.h causes this.
build --per_file_copt='//toxic:src/video_device.c@-Wno-documentation'
# Ignore super donators stuff. It's verbatim. We compile it, but don't care about cleanliness.
build --per_file_copt='//c-toxcore/super_donators@-Wno-comma,-Wno-extra-semi-stmt,-Wno-unreachable-code-return,-Wno-unused-result'
# Tests (Google Test) use global constructors and destructors and some other
# slightly unclean things.
build --per_file_copt='_bench\\.(cc|cpp)$@-Wno-weak-vtables,-Wno-zero-as-null-pointer-constant'
build --per_file_copt='_(test|bench)\\.(cc|cpp)$@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='_test\\.(cc|cpp)$@-Wno-c99-extensions'
build --per_file_copt='_test\\.(cc|cpp)$@-Wno-zero-as-null-pointer-constant'
build --per_file_copt='_test\\.cpp$@-Wno-extra-semi-stmt'
build --per_file_copt='_test\\.cpp$@-Wno-redundant-parens'
build --per_file_copt='_test\\.cpp$@-Wno-undefined-reinterpret-cast'
# Qt generated code.
build --per_file_copt='rcc_.*\\.cpp$@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='moc_.*\\.cpp$@-Wno-deprecated'
build --per_file_copt='moc_.*\\.cpp$@-Wno-extra-semi-stmt'
build --per_file_copt='moc_.*\\.cpp$@-Wno-gnu-zero-variadic-macro-arguments'
build --per_file_copt='moc_.*\\.cpp$@-Wno-redundant-parens'
build --per_file_copt='moc_.*\\.cpp$@-Wno-undefined-reinterpret-cast'
# TODO(iphydf): Fix these soon.
build --per_file_copt='//c-toxcore/toxcore:Messenger.c@-Wno-error=unused-but-set-variable'
build --per_file_copt='//toxins/toxvpn@-Wno-format'
build --per_file_copt='//toxins/toxvpn@-Wno-unaligned-access'
build --per_file_copt='//toxins/toxvpn@-Wno-unused-value'
build --per_file_copt='//toxins/toxvpn@-Wno-zero-as-null-pointer-constant'
build --per_file_copt='//toxins/toxvpn@-Wno-zero-length-array'
# TODO(iphydf): Fix these.
build --per_file_copt='//experimental@-Wno-switch-enum'
build --per_file_copt='//jvm-toxcore-c@-Wno-error=switch'
build --per_file_copt='//jvm-toxcore-c@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='//qtox@-Wno-documentation'
build --per_file_copt='//qtox@-Wno-double-promotion'
build --per_file_copt='//qtox@-Wno-float-equal'
build --per_file_copt='//qtox@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='//qtox@-Wno-implicit-fallthrough'
build --per_file_copt='//qtox@-Wno-inconsistent-missing-destructor-override'
build --per_file_copt='//qtox@-Wno-missing-prototypes'
build --per_file_copt='//qtox@-Wno-non-virtual-dtor'
build --per_file_copt='//qtox@-Wno-error=range-loop-analysis'
build --per_file_copt='//qtox@-Wno-shadow-field'
build --per_file_copt='//qtox@-Wno-suggest-destructor-override'
build --per_file_copt='//qtox@-Wno-suggest-override'
build --per_file_copt='//qtox@-Wno-switch-enum'
build --per_file_copt='//qtox@-Wno-undef'
build --per_file_copt='//qtox@-Wno-unused-but-set-variable'
build --per_file_copt='//qtox@-Wno-unused-macros'
build --per_file_copt='//toxic@-Wno-implicit-fallthrough'
build --per_file_copt='//toxic@-Wno-missing-variable-declarations'
build --per_file_copt='//toxic@-Wno-sign-compare'
build --per_file_copt='//toxic@-Wno-switch-enum'
build --per_file_copt='//toxic@-Wno-undef'
build --per_file_copt='//toxins@-Wno-cast-align'
build --per_file_copt='//toxins@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='//toxins@-Wno-missing-prototypes'
build --per_file_copt='//toxins@-Wno-missing-variable-declarations'
build --per_file_copt='//toxins@-Wno-non-virtual-dtor'
build --per_file_copt='//toxins@-Wno-old-style-cast'
build --per_file_copt='//toxins@-Wno-sign-compare'
build --per_file_copt='//toxins@-Wno-switch-enum'
build --per_file_copt='//toxins@-Wno-unreachable-code'
build --per_file_copt='//toxins@-Wno-unreachable-code-return'
build --per_file_copt='//toxins@-Wno-unused-result'
# Disable some clang warnings on various third party dependencies.
build --per_file_copt='external[:/]@-Wno-assign-enum'
build --per_file_copt='external[:/]@-Wno-bad-function-cast'
build --per_file_copt='external[:/]@-Wno-cast-align'
build --per_file_copt='external[:/]@-Wno-cast-qual'
build --per_file_copt='external[:/]@-Wno-comma'
build --per_file_copt='external[:/]@-Wno-conditional-uninitialized'
build --per_file_copt='external[:/]@-Wno-deprecated'
build --per_file_copt='external[:/]@-Wno-documentation'
build --per_file_copt='external[:/]@-Wno-documentation-unknown-command'
build --per_file_copt='external[:/]@-Wno-double-promotion'
build --per_file_copt='external[:/]@-Wno-duplicate-enum'
build --per_file_copt='external[:/]@-Wno-extra-semi-stmt'
build --per_file_copt='external[:/]@-Wno-float-equal'
build --per_file_copt='external[:/]@-Wno-format-nonliteral'
build --per_file_copt='external[:/]@-Wno-gcc-compat'
build --per_file_copt='external[:/]@-Wno-global-constructors,-Wno-exit-time-destructors'
build --per_file_copt='external[:/]@-Wno-implicit-fallthrough'
build --per_file_copt='external[:/]@-Wno-missing-prototypes'
build --per_file_copt='external[:/]@-Wno-missing-variable-declarations'
build --per_file_copt='external[:/]@-Wno-newline-eof'
build --per_file_copt='external[:/]@-Wno-old-style-cast'
build --per_file_copt='external[:/]@-Wno-shadow'
build --per_file_copt='external[:/]@-Wno-strict-prototypes'
build --per_file_copt='external[:/]@-Wno-switch-enum'
build --per_file_copt='external[:/]@-Wno-thread-safety-negative'
build --per_file_copt='external[:/]@-Wno-undef'
build --per_file_copt='external[:/]@-Wno-unreachable-code'
build --per_file_copt='external[:/]@-Wno-unreachable-code-break'
build --per_file_copt='external[:/]@-Wno-unreachable-code-return'
build --per_file_copt='external[:/]@-Wno-unused-macros'
build --per_file_copt='external[:/]@-Wno-weak-vtables'
build --per_file_copt='external[:/]@-Wno-zero-as-null-pointer-constant'
build --per_file_copt='external/boringssl[:/]@-Wno-c11-extensions'
build --per_file_copt='external/boringssl[:/]@-Wno-cast-function-type'
build --per_file_copt='external/boringssl[:/]@-Wno-extra-semi'
build --per_file_copt='external/boringssl[:/]@-Wno-gnu-binary-literal'
build --per_file_copt='external/boringssl[:/]@-Wno-overlength-strings'
build --per_file_copt='external/boringssl[:/]@-Wno-redundant-parens'
build --per_file_copt='external/boringssl[:/]@-Wno-tautological-value-range-compare'
build --per_file_copt='external/com_google_absl[:/]@-Wno-atomic-implicit-seq-cst'
build --per_file_copt='external/com_google_absl[:/]@-Wno-tautological-type-limit-compare'
build --per_file_copt='external/com_google_absl[:/]@-Wno-unused-template'
build --per_file_copt='external/abseil-cpp~[:/]@-Wno-tautological-type-limit-compare'
build --per_file_copt='external/abseil-cpp~[:/]@-Wno-unused-template'
build --per_file_copt='external/com_google_protobuf[:/]@-Wno-extra-semi'
build --per_file_copt='external/com_google_protobuf[:/]@-Wno-unused-function'
build --per_file_copt='external/com_google_protobuf[:/]@-Wno-unused-member-function'
build --per_file_copt='external/com_google_protobuf[:/]@-Wno-unused-template'
build --per_file_copt='external/protobuf~[:/]@-Wno-extra-semi'
build --per_file_copt='external/protobuf~[:/]@-Wno-inconsistent-missing-destructor-override'
build --per_file_copt='external/protobuf~[:/]@-Wno-suggest-destructor-override'
build --per_file_copt='external/protobuf~[:/]@-Wno-unused-function'
build --per_file_copt='external/protobuf~[:/]@-Wno-unused-member-function'
build --per_file_copt='external/protobuf~[:/]@-Wno-unused-template'
build --per_file_copt='external/curl~[:/]@-D_POSIX_C_SOURCE=200809L'
build --per_file_copt='external/curl~[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='external/ev[:/]@-Wno-bitwise-op-parentheses'
build --per_file_copt='external/ev[:/]@-Wno-comment'
build --per_file_copt='external/ev[:/]@-Wno-extra-semi'
build --per_file_copt='external/ev[:/]@-Wno-return-type'
build --per_file_copt='external/ev[:/]@-Wno-sign-compare'
build --per_file_copt='external/ev[:/]@-Wno-unused'
build --per_file_copt='external/ffmpeg/fftools[:/]@-Wno-single-bit-bitfield-constant-conversion'
build --per_file_copt='external/ffmpeg[:/]@-Wno-absolute-value'
build --per_file_copt='external/ffmpeg[:/]@-Wno-atomic-implicit-seq-cst'
build --per_file_copt='external/ffmpeg[:/]@-Wno-bool-operation'
build --per_file_copt='external/ffmpeg[:/]@-Wno-braced-scalar-init'
build --per_file_copt='external/ffmpeg[:/]@-Wno-cast-function-type'
build --per_file_copt='external/ffmpeg[:/]@-Wno-cpp'
build --per_file_copt='external/ffmpeg[:/]@-Wno-dangling-else'
build --per_file_copt='external/ffmpeg[:/]@-Wno-deprecated-declarations'
build --per_file_copt='external/ffmpeg[:/]@-Wno-deprecated-pragma'
build --per_file_copt='external/ffmpeg[:/]@-Wno-format-pedantic'
build --per_file_copt='external/ffmpeg[:/]@-Wno-implicit-const-int-float-conversion'
build --per_file_copt='external/ffmpeg[:/]@-Wno-incompatible-function-pointer-types-strict'
build --per_file_copt='external/ffmpeg[:/]@-Wno-incompatible-pointer-types-discards-qualifiers'
build --per_file_copt='external/ffmpeg[:/]@-Wno-overlength-strings'
build --per_file_copt='external/ffmpeg[:/]@-Wno-parentheses'
build --per_file_copt='external/ffmpeg[:/]@-Wno-pedantic'
build --per_file_copt='external/ffmpeg[:/]@-Wno-pointer-bool-conversion'
build --per_file_copt='external/ffmpeg[:/]@-Wno-pointer-sign'
build --per_file_copt='external/ffmpeg[:/]@-Wno-redundant-parens'
build --per_file_copt='external/ffmpeg[:/]@-Wno-shorten-64-to-32'
build --per_file_copt='external/ffmpeg[:/]@-Wno-sign-compare'
build --per_file_copt='external/ffmpeg[:/]@-Wno-sometimes-uninitialized'
build --per_file_copt='external/ffmpeg[:/]@-Wno-string-plus-int'
build --per_file_copt='external/ffmpeg[:/]@-Wno-switch'
build --per_file_copt='external/ffmpeg[:/]@-Wno-tautological-constant-out-of-range-compare'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unneeded-internal-declaration'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-const-variable'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-function'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused'
build --per_file_copt='external/libcap[:/]@-Wno-gnu-zero-variadic-macro-arguments'
build --per_file_copt='external/libcap[:/]@-Wno-sign-compare'
build --per_file_copt='external/libcap[:/]@-Wno-tautological-unsigned-enum-zero-compare'
build --per_file_copt='external/libcap[:/]@-Wno-unused-result'
build --per_file_copt='external/libcap[:/]@-Wno-variadic-macros'
build --per_file_copt='external/libconfig~[:/]@-D_POSIX_C_SOURCE=200809L'
build --per_file_copt='external/libidn2[:/]@-Wno-alloca'
build --per_file_copt='external/libidn2[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='external/libidn2[:/]@-Wno-pedantic'
build --per_file_copt='external/libidn2[:/]@-Wno-sign-compare'
build --per_file_copt='external/libidn2[:/]@-Wno-unused-const-variable'
build --per_file_copt='external/libqrencode[:/]@-Wno-tautological-unsigned-enum-zero-compare'
build --per_file_copt='external/libsodium[:/]@-Wno-unknown-pragmas'
build --per_file_copt='external/libsodium[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/libsodium[:/]@-Wno-unused-function'
build --per_file_copt='external/libsodium[:/]@-Wno-unused-variable'
build --per_file_copt='external/libvpx[:/]@-Wno-incompatible-pointer-types'
build --per_file_copt='external/libvpx[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/libvpx[:/]@-Wno-unused-variable'
build --per_file_copt='external/libxz[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='external/libxz[:/]@-Wno-unused-function'
build --per_file_copt='external/libzmq[:/]@-Wno-abstract-vbase-init'
build --per_file_copt='external/libzmq[:/]@-Wno-extra-semi'
build --per_file_copt='external/libzmq[:/]@-Wno-suggest-destructor-override'
build --per_file_copt='external/libzmq[:/]@-Wno-suggest-override'
build --per_file_copt='external/libzmq[:/]@-Wno-tautological-type-limit-compare'
build --per_file_copt='external/libzmq[:/]@-Wno-unused-variable'
build --per_file_copt='external/ncurses[:/]@-fno-sanitize=undefined'
build --per_file_copt='external/ncurses[:/]@-Wno-tautological-value-range-compare'
build --per_file_copt='external/ncurses[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/openal[:/]@-std=c++17'
build --per_file_copt='external/openal[:/]@-Wno-switch'
build --per_file_copt='external/openal[:/]@-Wno-undefined-func-template'
build --per_file_copt='external/openal[:/]@-Wno-unused-function'
build --per_file_copt='external/openal[:/]@-Wno-unused-value'
build --per_file_copt='external/pthread_w32[:/]@-Wno-cast-function-type'
build --per_file_copt='external/pthread_w32[:/]@-Wno-gnu-statement-expression-from-macro-expansion'
build --per_file_copt='external/pthread_w32[:/]@-Wno-pedantic'
build --per_file_copt='external/pthread_w32[:/]@-Wno-tautological-unsigned-zero-compare'
build --per_file_copt='external/sdl2[:/]@-Wno-alloca'
build --per_file_copt='external/sdl2[:/]@-Wno-atomic-implicit-seq-cst'
build --per_file_copt='external/sdl2[:/]@-Wno-cast-function-type'
build --per_file_copt='external/sdl2[:/]@-Wno-invalid-utf8'
build --per_file_copt='external/sdl2[:/]@-Wno-overlength-strings'
build --per_file_copt='external/sdl2[:/]@-Wno-pedantic'
build --per_file_copt='external/sdl2[:/]@-Wno-sign-compare'
build --per_file_copt='external/sdl2[:/]@-Wno-tautological-value-range-compare'
build --per_file_copt='external/sdl2[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/sqlcipher[:/]@-Wno-atomic-implicit-seq-cst'
build --per_file_copt='external/sqlcipher[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='external/sqlcipher[:/]@-Wno-empty-translation-unit'
build --per_file_copt='external/sqlcipher[:/]@-Wno-gnu-pointer-arith'
build --per_file_copt='external/sqlcipher[:/]@-Wno-sign-compare'
build --per_file_copt='external/sqlcipher[:/]@-Wno-unused'
build --per_file_copt='external/tcl[:/]@-Wno-cast-function-type-strict'
build --per_file_copt='external/tcl[:/]@-Wno-extra-semi'
build --per_file_copt='external/tcl[:/]@-Wno-flexible-array-extensions'
build --per_file_copt='external/tcl[:/]@-Wno-format-pedantic'
build --per_file_copt='external/tcl[:/]@-Wno-gnu-statement-expression-from-macro-expansion'
build --per_file_copt='external/tcl[:/]@-Wno-overlength-strings'
build --per_file_copt='external/tcl[:/]@-Wno-tautological-type-limit-compare'
build --per_file_copt='external/tcl[:/]@-Wno-tautological-value-range-compare'
build --per_file_copt='external/tcl[:/]@-Wno-typedef-redefinition'
build --per_file_copt='external/xcb[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/yasm[:/]@-Wno-c2x-compat'
build --per_file_copt='external/yasm[:/]@-Wno-cast-function-type'
build --per_file_copt='external/yasm[:/]@-Wno-gnu-null-pointer-arithmetic'
build --per_file_copt='external/yasm[:/]@-Wno-null-pointer-subtraction'
build --per_file_copt='external/zlib~?[:/]@-include,unistd.h'
build --per_file_copt='third_party/libidn2[:/]@-Wno-missing-prototypes'
# Disable some default warnings also present in the host config.
build --per_file_copt='external/tcl[:/]@-Wno-unused'
build --host_per_file_copt='external/tcl[:/]@-Wno-unused'
build --per_file_copt='external/yasm[:/]@-Wno-misleading-indentation'
build --host_per_file_copt='external/yasm[:/]@-Wno-misleading-indentation'
build --per_file_copt='external/yasm[:/]@-Wno-unused-but-set-variable'
build --host_per_file_copt='external/yasm[:/]@-Wno-unused-but-set-variable'
# Hack to get absl to compile for arm64.
build:linux-arm64-musl --per_file_copt='external/com_google_absl/absl/base/internal/low_level_alloc.cc@-Doff64_t=long'
# LPTSTR cast for WSAStringToAddress is necessary.
build:windows-x86_64 --per_file_copt='//c-toxcore/toxcore:network.c@-Wno-cast-qual'
# libvpx warnings on Windows.
build:windows-x86_64 --per_file_copt='external/libvpx[:/]@-Wno-absolute-value'
build:windows-x86_64 --per_file_copt='external/com_google_absl[:/]@-Wno-cast-function-type'
build:windows-x86_64 --per_file_copt='external/com_google_absl[:/]@-Wno-unknown-pragmas'
build:windows-x86_64 --per_file_copt='external/com_google_absl/absl/base/internal/thread_identity.cc@-U__MINGW32__'
build:windows-x86_64 --per_file_copt='external/com_google_googletest[:/]@-Wno-suggest-override'
build:windows-x86_64 --per_file_copt='external/com_google_googletest[:/]@-Wno-unused-const-variable'
build:windows-x86_64 --per_file_copt='external/com_google_googletest[:/]@-Wno-unused-member-function'
# Needed for absl symbolize.
build:windows-x86_64 --linkopt='-ldbghelp'
build:windows-x86_64 --per_file_copt='external/libzmq[:/]@-Wno-cast-function-type'
build:windows-x86_64 --per_file_copt='external/libzmq[:/]@-Wno-unused-template'
build:windows-x86_64 --per_file_copt='external/bazel_tools[:/]@-Wno-sign-compare'
##############################################################################
#
# :: Continuous Integration and docker build flags
#
##############################################################################
# Continuous Integration platforms tend to not have IPv6.
build:ci --per_file_copt='//c-toxcore/auto_tests@-DUSE_IPV6=0'
build:ci --curses=no
build:ci --show_timestamps
build:ci --verbose_failures
build:ci --flaky_test_attempts=6 # try a bit harder - toxcore tests are flaky
##############################################################################
#
# :: Compilation targets (including cross compilation)
#
##############################################################################
build:nix --build_tag_filters=-windows,-macos
build:nix --test_tag_filters=-windows,-macos
# Non-Nix local toolchains. Nix-Haskell doesn't work with local toolchains.
build:local --build_tag_filters=-no-cross,-windows,-macos
build:local --test_tag_filters=-no-cross,-windows,-macos
build:zig-cross --copt=-fPIC
build:zig-cross --dynamic_mode=off
build:zig-cross --features=fully_static_link
# See: https://github.com/uber/hermetic_cc_toolchain/issues/134
build:zig-cross --sandbox_add_mount_pair=/tmp
build:zig-cross --per_file_copt='external/ffmpeg[:/]@-Wno-incompatible-function-pointer-types'
build:zig-cross --per_file_copt='external/sdl2[:/]@-DICONV_INBUF_NONCONST=1'
build:linux-arm64-musl --config=zig-cross
build:linux-arm64-musl --platforms=@zig_sdk//platform:linux_arm64
build:linux-arm64-musl --extra_toolchains=@zig_sdk//toolchain:linux_arm64_musl
build:linux-arm64-musl --build_tag_filters=-no-cross,-qt,-windows,-macos,-java
build:linux-arm64-musl --test_tag_filters=-no-cross,-qt,-windows,-macos,-java
build:linux-x86_64-musl --config=zig-cross
build:linux-x86_64-musl --platforms=@zig_sdk//platform:linux_amd64
build:linux-x86_64-musl --extra_toolchains=@zig_sdk//toolchain:linux_amd64_musl
build:linux-x86_64-musl --build_tag_filters=-no-cross,-qt,-windows,-macos
build:linux-x86_64-musl --test_tag_filters=-no-cross,-qt,-windows,-macos
build:linux-x86_64-musl --linkopt='-static'
build:windows-x86_64 --config=zig-cross
build:windows-x86_64 --linkopt="-lshlwapi"
build:windows-x86_64 --platforms=@zig_sdk//platform:windows_amd64
build:windows-x86_64 --extra_toolchains=@zig_sdk//toolchain:windows_amd64
build:windows-x86_64 --build_tag_filters=-no-cross,-qt,-macos,-java,-no-windows
build:windows-x86_64 --test_tag_filters=-no-cross,-qt,-macos,-java,-no-windows
try-import %workspace%/.bazelrc.local
# vim:set tw=120