git: a5f8a7bf9b1a - main - security/agave: Unbundle protobuf

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Fri, 24 Jul 2026 17:45:59 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a5f8a7bf9b1aa9f2eded5870a86eed0614bf4e59

commit a5f8a7bf9b1aa9f2eded5870a86eed0614bf4e59
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-07-21 05:43:23 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-07-21 05:43:23 +0000

    security/agave: Unbundle protobuf
    
    PR:             293210
    Requested by:   Robert Clausecker <fuz@FreeBSD.org>
---
 security/agave/Makefile                            |  6 ++--
 security/agave/distinfo                            |  4 +--
 security/agave/files/patch-Cargo.lock              | 34 ++++++++++++++++++++++
 security/agave/files/patch-Cargo.toml              | 10 +++++++
 security/agave/files/patch-dev-bins_Cargo.lock     | 26 +++++++++++++++++
 security/agave/files/patch-programs_sbf_Cargo.lock | 26 +++++++++++++++++
 .../patch-storage-bigtable_build-proto_Cargo.toml  | 10 +++++++
 .../patch-storage-bigtable_build-proto_src_main.rs | 16 ++++++++++
 .../agave/files/patch-storage-proto_Cargo.toml     | 12 ++++++++
 security/agave/files/patch-storage-proto_build.rs  | 16 ++++++++++
 10 files changed, 155 insertions(+), 5 deletions(-)

diff --git a/security/agave/Makefile b/security/agave/Makefile
index 65100747029b..e68c9bd7d746 100644
--- a/security/agave/Makefile
+++ b/security/agave/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	agave
 DISTVERSIONPREFIX=	v
 DISTVERSION=	4.1.2
+PORTREVISION=	1
 CATEGORIES=	security
 PKGNAMESUFFIX=	-blockchain
 
@@ -17,6 +18,7 @@ BROKEN_i386=		fails on 32-bit systems: https://github.com/solana-labs/solana/iss
 
 BUILD_DEPENDS=	protoc:devel/protobuf
 LIB_DEPENDS=	libhidapi.so:comms/hidapi \
+		libprotobuf.so:devel/protobuf \
 		librocksdb.so:databases/rocksdb \
 		libzstd.so:archivers/zstd
 
@@ -516,7 +518,6 @@ CARGO_CRATES=	Inflector-0.11.4 \
 		prost-derive-0.14.3 \
 		prost-types-0.14.3 \
 		protobuf-3.7.2 \
-		protobuf-src-1.1.0+21.5 \
 		protobuf-support-3.7.2 \
 		protosol-6.1.0 \
 		pulldown-cmark-0.13.1 \
@@ -952,7 +953,8 @@ CARGO_CRATES=	Inflector-0.11.4 \
 XARCH=		${ARCH:S/amd64/x86_64/:tu}
 
 MAKE_ENV=	${XARCH}_UNKNOWN_FREEBSD_OPENSSL_INCLUDE_DIR=${OPENSSLINC} \
-		${XARCH}_UNKNOWN_FREEBSD_OPENSSL_LIB_DIR=${OPENSSLLIB}
+		${XARCH}_UNKNOWN_FREEBSD_OPENSSL_LIB_DIR=${OPENSSLLIB} \
+		PROTOC=${LOCALBASE}/bin/protoc
 
 BINARY_ALIAS=	llvm-config=${LOCALBASE}/bin/${LLVM_CONFIG}
 
diff --git a/security/agave/distinfo b/security/agave/distinfo
index 88ff4f931aa9..ce799aa3eb36 100644
--- a/security/agave/distinfo
+++ b/security/agave/distinfo
@@ -1,4 +1,4 @@
-TIMESTAMP = 1783962570
+TIMESTAMP = 1784608023
 SHA256 (rust/crates/Inflector-0.11.4.crate) = fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3
 SIZE (rust/crates/Inflector-0.11.4.crate) = 17438
 SHA256 (rust/crates/adler2-2.0.1.crate) = 320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa
@@ -981,8 +981,6 @@ SHA256 (rust/crates/prost-types-0.14.3.crate) = 8991c4cbdb8bc5b11f0b074ffe286c30
 SIZE (rust/crates/prost-types-0.14.3.crate) = 49368
 SHA256 (rust/crates/protobuf-3.7.2.crate) = d65a1d4ddae7d8b5de68153b48f6aa3bba8cb002b243dbdbc55a5afbc98f99f4
 SIZE (rust/crates/protobuf-3.7.2.crate) = 211978
-SHA256 (rust/crates/protobuf-src-1.1.0+21.5.crate) = c7ac8852baeb3cc6fb83b93646fb93c0ffe5d14bf138c945ceb4b9948ee0e3c1
-SIZE (rust/crates/protobuf-src-1.1.0+21.5.crate) = 6792235
 SHA256 (rust/crates/protobuf-support-3.7.2.crate) = 3e36c2f31e0a47f9280fb347ef5e461ffcd2c52dd520d8e216b52f93b0b0d7d6
 SIZE (rust/crates/protobuf-support-3.7.2.crate) = 11725
 SHA256 (rust/crates/protosol-6.1.0.crate) = acef24e715f0ce9ac6491004da1c35c919c60517f976f61e0f05f34d22e873ec
diff --git a/security/agave/files/patch-Cargo.lock b/security/agave/files/patch-Cargo.lock
new file mode 100644
index 000000000000..d9aec8c9e579
--- /dev/null
+++ b/security/agave/files/patch-Cargo.lock
@@ -0,0 +1,34 @@
+--- Cargo.lock.orig	2026-07-21 04:26:20 UTC
++++ Cargo.lock
+@@ -5498,7 +5498,6 @@ dependencies = [
+ name = "proto"
+ version = "4.1.2"
+ dependencies = [
+- "protobuf-src",
+  "tonic-prost-build",
+ ]
+ 
+@@ -5514,15 +5513,6 @@ dependencies = [
+ ]
+ 
+ [[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 = "protobuf-support"
+ version = "3.7.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+@@ -10529,7 +10519,6 @@ dependencies = [
+  "bs58",
+  "enum-iterator",
+  "prost 0.14.3",
+- "protobuf-src",
+  "serde",
+  "solana-account-decoder",
+  "solana-hash 4.3.0",
diff --git a/security/agave/files/patch-Cargo.toml b/security/agave/files/patch-Cargo.toml
new file mode 100644
index 000000000000..fa7b6a415d5f
--- /dev/null
+++ b/security/agave/files/patch-Cargo.toml
@@ -0,0 +1,10 @@
+--- Cargo.toml.orig	2026-07-21 04:26:20 UTC
++++ Cargo.toml
+@@ -317,7 +317,6 @@ prost-types = "0.14.3"
+ proptest = "1.11"
+ prost = "0.14.3"
+ prost-types = "0.14.3"
+-protobuf-src = "1.1.0"
+ protosol = "=6.1.0"
+ qualifier_attr = { version = "0.2.2", default-features = false }
+ quinn = "0.11.9"
diff --git a/security/agave/files/patch-dev-bins_Cargo.lock b/security/agave/files/patch-dev-bins_Cargo.lock
new file mode 100644
index 000000000000..4c65188363f8
--- /dev/null
+++ b/security/agave/files/patch-dev-bins_Cargo.lock
@@ -0,0 +1,26 @@
+--- dev-bins/Cargo.lock.orig	2026-07-21 04:26:20 UTC
++++ dev-bins/Cargo.lock
+@@ -4934,15 +4934,6 @@ dependencies = [
+ ]
+ 
+ [[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 = "protobuf-support"
+ version = "3.7.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+@@ -9028,7 +9019,6 @@ dependencies = [
+  "bincode",
+  "bs58",
+  "prost 0.14.3",
+- "protobuf-src",
+  "serde",
+  "solana-account-decoder",
+  "solana-hash 4.3.0",
diff --git a/security/agave/files/patch-programs_sbf_Cargo.lock b/security/agave/files/patch-programs_sbf_Cargo.lock
new file mode 100644
index 000000000000..f2fe34bbee2b
--- /dev/null
+++ b/security/agave/files/patch-programs_sbf_Cargo.lock
@@ -0,0 +1,26 @@
+--- programs/sbf/Cargo.lock.orig	2026-07-21 04:26:20 UTC
++++ programs/sbf/Cargo.lock
+@@ -4705,15 +4705,6 @@ dependencies = [
+ ]
+ 
+ [[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 = "protobuf-support"
+ version = "3.7.2"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+@@ -9373,7 +9364,6 @@ dependencies = [
+  "bincode",
+  "bs58",
+  "prost",
+- "protobuf-src",
+  "serde",
+  "solana-account-decoder",
+  "solana-hash 4.3.0",
diff --git a/security/agave/files/patch-storage-bigtable_build-proto_Cargo.toml b/security/agave/files/patch-storage-bigtable_build-proto_Cargo.toml
new file mode 100644
index 000000000000..0f838ea87cf5
--- /dev/null
+++ b/security/agave/files/patch-storage-bigtable_build-proto_Cargo.toml
@@ -0,0 +1,10 @@
+--- storage-bigtable/build-proto/Cargo.toml.orig	2026-07-21 04:26:20 UTC
++++ storage-bigtable/build-proto/Cargo.toml
+@@ -15,7 +15,3 @@ tonic-prost-build = { workspace = true }
+ [dependencies]
+ tonic-prost-build = { workspace = true }
+ 
+-# windows users should install the protobuf compiler manually and set the PROTOC
+-# envar to point to the installed binary
+-[target."cfg(not(windows))".dependencies]
+-protobuf-src = { workspace = true }
diff --git a/security/agave/files/patch-storage-bigtable_build-proto_src_main.rs b/security/agave/files/patch-storage-bigtable_build-proto_src_main.rs
new file mode 100644
index 000000000000..d31612b57dd1
--- /dev/null
+++ b/security/agave/files/patch-storage-bigtable_build-proto_src_main.rs
@@ -0,0 +1,16 @@
+--- storage-bigtable/build-proto/src/main.rs.orig	2026-07-21 04:26:20 UTC
++++ storage-bigtable/build-proto/src/main.rs
+@@ -1,13 +1,4 @@ fn main() -> Result<(), std::io::Error> {
+ fn main() -> Result<(), std::io::Error> {
+-    const PROTOC_ENVAR: &str = "PROTOC";
+-    // Safety: env is checked and updated before any threads might exist
+-    if std::env::var(PROTOC_ENVAR).is_err() {
+-        #[cfg(not(windows))]
+-        unsafe {
+-            std::env::set_var(PROTOC_ENVAR, protobuf_src::protoc())
+-        }
+-    }
+-
+     let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+ 
+     let out_dir = manifest_dir.join("../proto");
diff --git a/security/agave/files/patch-storage-proto_Cargo.toml b/security/agave/files/patch-storage-proto_Cargo.toml
new file mode 100644
index 000000000000..056fa2a9b8a5
--- /dev/null
+++ b/security/agave/files/patch-storage-proto_Cargo.toml
@@ -0,0 +1,12 @@
+--- storage-proto/Cargo.toml.orig	2026-07-21 04:26:20 UTC
++++ storage-proto/Cargo.toml
+@@ -42,9 +42,6 @@ tonic-prost-build = { workspace = true }
+ 
+ # windows users should install the protobuf compiler manually and set the PROTOC
+ # envar to point to the installed binary
+-[target."cfg(not(windows))".build-dependencies]
+-protobuf-src = { workspace = true }
+-
+ [dev-dependencies]
+ enum-iterator = { workspace = true }
+ test-case = { workspace = true }
diff --git a/security/agave/files/patch-storage-proto_build.rs b/security/agave/files/patch-storage-proto_build.rs
new file mode 100644
index 000000000000..61ca4a8e2632
--- /dev/null
+++ b/security/agave/files/patch-storage-proto_build.rs
@@ -0,0 +1,16 @@
+--- storage-proto/build.rs.orig	2026-07-21 04:26:20 UTC
++++ storage-proto/build.rs
+@@ -1,13 +1,4 @@ fn main() -> Result<(), std::io::Error> {
+ fn main() -> Result<(), std::io::Error> {
+-    const PROTOC_ENVAR: &str = "PROTOC";
+-    // Safety: env is checked and updated before any threads might exist
+-    if std::env::var(PROTOC_ENVAR).is_err() {
+-        #[cfg(not(windows))]
+-        unsafe {
+-            std::env::set_var(PROTOC_ENVAR, protobuf_src::protoc())
+-        }
+-    }
+-
+     let proto_base_path = std::path::PathBuf::from("proto");
+     let proto_files = [
+         "confirmed_block.proto",