Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support building on fedora #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion generated_types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,19 @@ fn generate_grpc_types(root: &Path) -> Result<()> {
.bytes([".influxdata.iox.catalog_cache.v1"]);

let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin");

// distributions which obtain `google/protobuf/{duration,timestamp}.proto` from rpm package:
// `protobuf-devel` (eg: centos, fedora, etc), require a `--proto_path=/usr/include` protoc arg
let protobuf_devel_include_path = PathBuf::from("/usr/include");
let includes = vec![
root,
protobuf_devel_include_path.as_path(),
];
tonic_build::configure()
.file_descriptor_set_path(&descriptor_path)
// protoc in ubuntu builder needs this option
.protoc_arg("--experimental_allow_proto3_optional")
.compile_with_config(config, &proto_files, &[root])?;
.compile_with_config(config, &proto_files, &includes)?;

let descriptor_set = std::fs::read(descriptor_path)?;

Expand Down
15 changes: 14 additions & 1 deletion grpc-binary-logger-proto/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
//! Compiles Protocol Buffers into native Rust types.
//! <https://github.com/grpc/grpc/blob/master/doc/binary-logging.md>

use std::env;
use std::io::Result;
use std::path::PathBuf;

fn main() -> Result<()> {
tonic_build::compile_protos("proto/grpc/binlog/v1/binarylog.proto")
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("proto");
let proto_files = vec![
root.join("grpc/binlog/v1/binarylog.proto"),
];
// distributions which obtain `google/protobuf/{duration,timestamp}.proto` from rpm package:
// `protobuf-devel` (eg: centos, fedora, etc), require a `--proto_path=/usr/include` protoc arg
let protobuf_devel_include_path = PathBuf::from("/usr/include");
let includes = vec![
root,
protobuf_devel_include_path,
];
tonic_build::configure().compile(&proto_files, &includes)
}