--- cargo-crates/protobuf-src-1.1.0+21.5/build.rs.orig	2026-02-18 01:45:33 UTC
+++ cargo-crates/protobuf-src-1.1.0+21.5/build.rs
@@ -1,38 +1,9 @@
-// Copyright Materialize, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License in the LICENSE file at the
-// root of this repository, or online at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// FreeBSD: Use system protobuf instead of building from source
 use std::env;
-use std::error::Error;
-use std::fs;
-use std::path::PathBuf;
 
-fn main() -> Result<(), Box<dyn Error>> {
-    let out_dir = PathBuf::from(env::var("OUT_DIR")?);
-    let install_dir = out_dir.join("install");
-    fs::create_dir_all(&install_dir)?;
-
-    autotools::Config::new("protobuf")
-        .disable("maintainer-mode", None)
-        .out_dir(&install_dir)
-        .build();
-
-    // Move the build directory out of the installation directory.
-    let _ = fs::remove_dir_all(out_dir.join("build"));
-    fs::rename(install_dir.join("build"), out_dir.join("build"))?;
-
-    println!("cargo:rustc-env=INSTALL_DIR={}", install_dir.display());
-    println!("cargo:CXXBRIDGE_DIR0={}/include", install_dir.display());
-    Ok(())
+fn main() {
+    let prefix = env::var("LOCALBASE").unwrap_or_else(|_| "/usr/local".to_string());
+    println!("cargo:rustc-env=INSTALL_DIR={}", prefix);
+    println!("cargo:CXXBRIDGE_DIR0={}/include", prefix);
+    println!("cargo:rerun-if-env-changed=LOCALBASE");
 }
