diff --git a/Cargo.lock b/Cargo.lock index b5b9fa2..f55b5b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -390,6 +390,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "autotools" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8da1805e028a172334c3b680f93e71126f2327622faef2ec3d893c0a4ad77" +dependencies = [ + "cc", +] + [[package]] name = "axum" version = "0.6.18" @@ -1702,6 +1711,7 @@ dependencies = [ "enum-iterator", "prost", "prost-types", + "protobuf-src", "serde", "solana-account-decoder", "solana-sdk", @@ -2340,6 +2350,15 @@ dependencies = [ "prost", ] +[[package]] +name = "protobuf-src" +version = "1.1.0+21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7ac8852baeb3cc6fb83b93646fb93c0ffe5d14bf138c945ceb4b9948ee0e3c1" +dependencies = [ + "autotools", +] + [[package]] name = "qstring" version = "0.7.2" diff --git a/Cargo.toml b/Cargo.toml index ea79c6c..af1da3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ lru = "0.12.0" once_cell = "1.17.1" prost = "0.12.1" prost-types = "0.12.1" +protobuf-src = "1.1.0" rand = "0.8" serde = "1.0.160" serde_derive = "1.0.160" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index de973f1..1ab3b55 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -17,6 +17,7 @@ solana-transaction-status = { workspace = true } tonic = { workspace = true } [build-dependencies] +protobuf-src = { workspace = true } tonic-build = { workspace = true } [dev-dependencies] diff --git a/proto/build.rs b/proto/build.rs index dada299..76e4cc6 100644 --- a/proto/build.rs +++ b/proto/build.rs @@ -1,6 +1,12 @@ use tonic_build::configure; fn main() { + const PROTOC_ENVAR: &str = "PROTOC"; + if std::env::var(PROTOC_ENVAR).is_err() { + #[cfg(not(windows))] + std::env::set_var(PROTOC_ENVAR, protobuf_src::protoc()); + } + configure() .type_attribute( "TransactionErrorType",