# Re-enable autoloading for language-specific rules that were removed from
# Bazel 9 core. This is needed because many BCR modules haven't yet added
# explicit load() statements for rules_cc, rules_python, and rules_shell.
# This flag can be removed once all dependencies are updated for Bazel 9.
build --incompatible_autoload_externally=+cc_library,+cc_binary,+cc_test,+cc_shared_library,+cc_import,+cc_toolchain,+py_binary,+py_library,+py_test,+sh_binary,+sh_library,+sh_test

# Force -fPIC on C/C++ compilation so static archives can be linked into PIE
# binaries. Required because modern rustc defaults to producing PIE executables
# on x86_64-unknown-linux-gnu, and any static C++ library mixed into a Rust
# binary therefore has to be position-independent.
build --copt=-fPIC

# CI config: smaller binaries, shared repo cache, disk cache for artifacts.
build:ci -c opt
build:ci --strip=always
build:ci --copt=-g0
build:ci --repository_cache=~/.cache/bazel-repo-cache
build:ci --disk_cache=~/.cache/bazel-disk-cache

# workaround for goption.c:169:14: error: two or more data types in declaration specifiers on armv7
build:armv7-linux-gnueabihf --repo_env=BAZEL_CONLYOPTS="-std=gnu17"
build:aarch64-linux-gnu --repo_env=BAZEL_CONLYOPTS=""
build:aarch64-linux-musl --repo_env=BAZEL_CONLYOPTS=""
build:armv7-linux-musleabihf --repo_env=BAZEL_CONLYOPTS=""

# With our setup Bazel links every binary statically to `libframework.a` If you
# want to link dynamically to `libframework.so` use `--dynamic_mode=fully`.
# See https://bazel.build/docs/user-manual#dynamic-mode for more details. If
# linking dynamically, ensure that `libframework.so` is in the
# `LD_LIBRARY_PATH`.
#
# Not supported on musl targets.
# --dynamic_mode=default
