diff --git a/.bazelrc b/.bazelrc index 108c8fa56b9e..8c1e20d4f46c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -61,5 +61,6 @@ build:release --copt -mllvm --copt -inline-threshold=2500 build:release --linkopt=-flto build --@seastar//:openssl=True +build --keep_going try-import %workspace%/user.bazelrc diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 53b76f17b2b9..f29bd458b8e7 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -116,7 +116,7 @@ "moduleExtensions": { "//bazel:extensions.bzl%non_module_dependencies": { "general": { - "bzlTransitiveDigest": "+/wwwL1d2C7jKsyzYXQACKjRp7Y8aKLoFqSNJ9x+I/c=", + "bzlTransitiveDigest": "a72e4ALcji2RGOJvJ4dDpXN/55qa2jQuSgxMhRaSPZI=", "usagesDigest": "bsXDsdl5Gq0iZDf6R9bhf3oHUM35HAGF1usXoFeQrF0=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -147,9 +147,9 @@ "ruleClassName": "http_archive", "attributes": { "build_file": "@@//bazel/thirdparty:libpciaccess.BUILD", - "sha256": "9938b18509553452c6e13f79e16cbaffec9ea67119aa2de5d75e83c4f67ff400", - "strip_prefix": "libpciaccess-libpciaccess-0.16", - "url": "https://vectorized-public.s3.amazonaws.com/dependencies/libpciaccess-0.16.tar.bz2" + "sha256": "d0d0d53c2085d21ab37ae5989e55a3de13d4d80dc2c0a8d5c77154ea70f4783c", + "strip_prefix": "libpciaccess-2ec2576cabefef1eaa5dd9307c97de2e887fc347", + "url": "https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/archive/2ec2576cabefef1eaa5dd9307c97de2e887fc347/libpciaccess-2ec2576cabefef1eaa5dd9307c97de2e887fc347.tar.gz" } }, "numactl": { diff --git a/bazel/internal.bzl b/bazel/internal.bzl index 34587a72d003..bea32223a82f 100644 --- a/bazel/internal.bzl +++ b/bazel/internal.bzl @@ -4,6 +4,13 @@ scripts in the `bazel/` directory. """ def redpanda_copts(): + """ + Add common options to redpanda targets. + + Returns: + Options to be added to target. + """ + # TODO Bazel prefers -iquote "path" style includes in many cases. However, # our source tree uses bracket style for dependencies. We need a way # to bridge this gap until we decide to fully switch over to Bazel at which @@ -11,4 +18,11 @@ def redpanda_copts(): # need to be updated to include abseil explicitly when this is removed. copts = [] copts.append("-Iexternal/abseil-cpp~") + + copts.append("-Werror") + copts.append("-Wall") + copts.append("-Wextra") + copts.append("-Wno-missing-field-initializers") + copts.append("-Wimplicit-fallthrough") + return copts diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 4bce599f6d3f..a3f701a67ab1 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -67,9 +67,9 @@ def data_dependency(): http_archive( name = "libpciaccess", build_file = "//bazel/thirdparty:libpciaccess.BUILD", - sha256 = "9938b18509553452c6e13f79e16cbaffec9ea67119aa2de5d75e83c4f67ff400", - strip_prefix = "libpciaccess-libpciaccess-0.16", - url = "https://vectorized-public.s3.amazonaws.com/dependencies/libpciaccess-0.16.tar.bz2", + sha256 = "d0d0d53c2085d21ab37ae5989e55a3de13d4d80dc2c0a8d5c77154ea70f4783c", + strip_prefix = "libpciaccess-2ec2576cabefef1eaa5dd9307c97de2e887fc347", + url = "https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/archive/2ec2576cabefef1eaa5dd9307c97de2e887fc347/libpciaccess-2ec2576cabefef1eaa5dd9307c97de2e887fc347.tar.gz", ) http_archive( diff --git a/bazel/thirdparty/libpciaccess.BUILD b/bazel/thirdparty/libpciaccess.BUILD index 0b06303e012a..95ac8154b978 100644 --- a/bazel/thirdparty/libpciaccess.BUILD +++ b/bazel/thirdparty/libpciaccess.BUILD @@ -1,22 +1,71 @@ -load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") - -filegroup( - name = "srcs", - srcs = glob(["**"]), -) - -configure_make( +cc_library( name = "libpciaccess", - autoreconf = True, - autoreconf_options = ["-ivf"], - configure_in_place = True, - configure_options = [ - "--disable-shared", - "--enable-static", + srcs = [ + "src/common_bridge.c", + "src/common_capability.c", + "src/common_device_name.c", + "src/common_init.c", + "src/common_interface.c", + "src/common_io.c", + "src/common_iterator.c", + "src/common_map.c", + "src/linux_devmem.h", + "src/pciaccess_private.h", + ] + select({ + "@platforms//os:linux": [ + "src/common_vgaarb.c", + "src/linux_devmem.c", + "src/linux_sysfs.c", + ], + "//conditions:default": [], + }), + hdrs = [ + "include/pciaccess.h", + ], + copts = [ + "-Wpointer-arith", + "-Wmissing-declarations", + "-Wformat=2", + "-Wstrict-prototypes", + "-Wmissing-prototypes", + "-Wnested-externs", + "-Wbad-function-cast", + "-Wold-style-definition", + "-Wdeclaration-after-statement", + "-Wunused", + "-Wuninitialized", + "-Wshadow", + "-Wmissing-noreturn", + "-Wmissing-format-attribute", + "-Wredundant-decls", + "-Werror=implicit", + "-Werror=nonnull", + "-Werror=init-self", + "-Werror=main", + "-Werror=missing-braces", + "-Werror=sequence-point", + "-Werror=return-type", + "-Werror=trigraphs", + "-Werror=array-bounds", + "-Werror=write-strings", + "-Werror=address", + "-Werror=int-to-pointer-cast", ], - lib_source = ":srcs", - out_static_libs = ["libpciaccess.a"], + local_defines = [ + 'PCIIDS_PATH=\\"/usr/share/hwdata\\"', + "HAVE_ZLIB=1", + "HAVE_MTRR=1", + "HAVE_ERR_H=1", + "HAVE_INTTYPES_H=1", + "HAVE_STDINT_H=1", + "HAVE_STRINGS_H=1", + "HAVE_STRING_H=1", + ], + strip_include_prefix = "include", visibility = [ "//visibility:public", ], + deps = [ + "@zlib", + ], )