mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-12-25 19:32:44 +01:00
192 lines
6.0 KiB
Diff
192 lines
6.0 KiB
Diff
diff --git a/.bazelrc b/.bazelrc
|
|
index 554440cfe..53485cb97 100644
|
|
--- a/.bazelrc
|
|
+++ b/.bazelrc
|
|
@@ -1 +1 @@
|
|
-build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
|
|
+build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
|
|
diff --git a/MODULE.bazel b/MODULE.bazel
|
|
index 7d6c7f2fe..513c29fa3 100644
|
|
--- a/MODULE.bazel
|
|
+++ b/MODULE.bazel
|
|
@@ -50,13 +50,14 @@ bazel_dep(name = "bazel_jar_jar", version = "0.1.7")
|
|
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
|
bazel_dep(name = "googleapis", repo_name = "com_google_googleapis", version = "0.0.0-20240326-1c8d509c5")
|
|
bazel_dep(name = "grpc-proto", repo_name = "io_grpc_grpc_proto", version = "0.0.0-20240627-ec30f58")
|
|
-# Protobuf 25.5+ is incompatible with Bazel 7 with bzlmod
|
|
-bazel_dep(name = "protobuf", repo_name = "com_google_protobuf", version = "24.4")
|
|
bazel_dep(name = "rules_cc", version = "0.0.9")
|
|
bazel_dep(name = "rules_java", version = "5.3.5")
|
|
bazel_dep(name = "rules_jvm_external", version = "6.0")
|
|
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
|
|
|
|
+system_protobuf = use_extension("//:repositories.bzl", "system_protobuf")
|
|
+use_repo(system_protobuf, "com_google_protobuf")
|
|
+
|
|
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
|
|
|
|
maven.install(
|
|
diff --git a/repositories.bzl b/repositories.bzl
|
|
index 47609ae76..42474cb83 100644
|
|
--- a/repositories.bzl
|
|
+++ b/repositories.bzl
|
|
@@ -1,6 +1,131 @@
|
|
"""External dependencies for grpc-java."""
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
+load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
|
+
|
|
+def _system_protobuf_repo_impl(ctx):
|
|
+ """Repository rule to create system protobuf repository."""
|
|
+ ctx.file("WORKSPACE", "workspace(name = \"{name}\")".format(name = ctx.name))
|
|
+
|
|
+ ctx.file("BUILD", """
|
|
+load("@rules_cc//cc:defs.bzl", "cc_library")
|
|
+
|
|
+package(default_visibility = ["//visibility:public"])
|
|
+
|
|
+cc_library(
|
|
+ name = "protobuf",
|
|
+ hdrs = glob([
|
|
+ "include/google/protobuf/**/*.h",
|
|
+ "include/google/protobuf/**/*.inc",
|
|
+ ]),
|
|
+ includes = ["include"],
|
|
+ linkopts = [
|
|
+ "-lprotobuf",
|
|
+ "-labsl_log_internal_check_op",
|
|
+ "-labsl_log_internal_message",
|
|
+ "-labsl_log_internal_nullguard",
|
|
+ "-labsl_raw_logging_internal",
|
|
+ "-labsl_strings",
|
|
+ "-labsl_throw_delegate",
|
|
+ "-labsl_hash",
|
|
+ "-labsl_raw_hash_set",
|
|
+ "-labsl_hashtablez_sampler",
|
|
+ "-labsl_synchronization",
|
|
+ "-labsl_time",
|
|
+ "-labsl_civil_time",
|
|
+ "-labsl_time_zone",
|
|
+ "-labsl_int128",
|
|
+ "-labsl_base",
|
|
+ "-labsl_spinlock_wait",
|
|
+ ],
|
|
+)
|
|
+
|
|
+cc_library(
|
|
+ name = "protobuf_lite",
|
|
+ hdrs = glob([
|
|
+ "include/google/protobuf/**/*.h",
|
|
+ "include/google/protobuf/**/*.inc",
|
|
+ ]),
|
|
+ includes = ["include"],
|
|
+ linkopts = [
|
|
+ "-lprotobuf-lite",
|
|
+ "-labsl_log_internal_check_op",
|
|
+ "-labsl_log_internal_message",
|
|
+ "-labsl_log_internal_nullguard",
|
|
+ "-labsl_raw_logging_internal",
|
|
+ "-labsl_strings",
|
|
+ "-labsl_throw_delegate",
|
|
+ "-labsl_base",
|
|
+ "-labsl_spinlock_wait",
|
|
+ ],
|
|
+)
|
|
+
|
|
+cc_library(
|
|
+ name = "protoc_lib",
|
|
+ hdrs = glob([
|
|
+ "include/google/protobuf/compiler/**/*.h",
|
|
+ ]),
|
|
+ includes = ["include"],
|
|
+ linkopts = [
|
|
+ "-lprotoc",
|
|
+ "-lprotobuf",
|
|
+ "-labsl_log_internal_check_op",
|
|
+ "-labsl_log_internal_message",
|
|
+ "-labsl_log_internal_nullguard",
|
|
+ "-labsl_raw_logging_internal",
|
|
+ "-labsl_strings",
|
|
+ "-labsl_throw_delegate",
|
|
+ "-labsl_hash",
|
|
+ "-labsl_raw_hash_set",
|
|
+ "-labsl_hashtablez_sampler",
|
|
+ "-labsl_synchronization",
|
|
+ "-labsl_time",
|
|
+ "-labsl_civil_time",
|
|
+ "-labsl_time_zone",
|
|
+ "-labsl_int128",
|
|
+ "-labsl_base",
|
|
+ "-labsl_spinlock_wait",
|
|
+ ],
|
|
+ deps = [":protobuf"],
|
|
+)
|
|
+
|
|
+# Java protobuf libraries (these will be provided by the maven overrides)
|
|
+java_library(
|
|
+ name = "protobuf_java",
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|
|
+
|
|
+java_library(
|
|
+ name = "protobuf_java_util",
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|
|
+
|
|
+java_library(
|
|
+ name = "protobuf_javalite",
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|
|
+
|
|
+# The protoc binary
|
|
+genrule(
|
|
+ name = "protoc",
|
|
+ outs = ["protoc_wrapper"],
|
|
+ cmd = "echo '#!/bin/bash\\\\nexec /usr/bin/protoc \\"$$@\\"' > $@ && chmod +x $@",
|
|
+ executable = True,
|
|
+)
|
|
+""")
|
|
+
|
|
+ # Create symlinks to system headers
|
|
+ ctx.symlink("/usr/include", "include")
|
|
+
|
|
+_system_protobuf_repo = repository_rule(
|
|
+ implementation = _system_protobuf_repo_impl,
|
|
+)
|
|
+
|
|
+def _system_protobuf_ext_impl(ctx):
|
|
+ """Module extension to register system protobuf repository."""
|
|
+ _system_protobuf_repo(name = "com_google_protobuf")
|
|
+
|
|
+system_protobuf = module_extension(implementation = _system_protobuf_ext_impl)
|
|
|
|
# For use with maven_install's artifacts.
|
|
# maven_install(
|
|
@@ -89,8 +214,6 @@ IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = {
|
|
|
|
def grpc_java_repositories():
|
|
"""Imports dependencies for grpc-java."""
|
|
- if not native.existing_rule("com_google_protobuf"):
|
|
- com_google_protobuf()
|
|
if not native.existing_rule("com_google_googleapis"):
|
|
http_archive(
|
|
name = "com_google_googleapis",
|
|
@@ -110,17 +233,6 @@ def grpc_java_repositories():
|
|
url = "https://github.com/bazeltools/bazel_jar_jar/releases/download/v0.1.6/bazel_jar_jar-v0.1.6.tar.gz",
|
|
)
|
|
|
|
-def com_google_protobuf():
|
|
- # proto_library rules implicitly depend on @com_google_protobuf//:protoc,
|
|
- # which is the proto-compiler.
|
|
- # This statement defines the @com_google_protobuf repo.
|
|
- http_archive(
|
|
- name = "com_google_protobuf",
|
|
- sha256 = "3cf7d5b17c4ff04fe9f038104e9d0cae6da09b8ce271c13e44f8ac69f51e4e0f",
|
|
- strip_prefix = "protobuf-25.5",
|
|
- urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.5/protobuf-25.5.tar.gz"],
|
|
- )
|
|
-
|
|
def io_grpc_grpc_proto():
|
|
http_archive(
|
|
name = "io_grpc_grpc_proto",
|