llama-cpp-bindings-build 0.35.0

Build scripts of llama-cpp-native, which builds llama.cpp with CMake, and llama-cpp-bindings-sys, which generates the bindings and compiles the C++ wrapper
mod host_triple_error;

use std::env;
use std::fs;
use std::path::PathBuf;

use crate::host_triple_error::HostTripleError;

fn main() -> Result<(), HostTripleError> {
    println!("cargo:rerun-if-changed=build.rs");

    env::var("TARGET")
        .map_err(HostTripleError::TargetUnreadable)
        .and_then(|target| {
            env::var("OUT_DIR")
                .map_err(HostTripleError::OutDirUnreadable)
                .and_then(|out_dir| {
                    fs::write(PathBuf::from(out_dir).join("host_triple"), target)
                        .map_err(HostTripleError::HostTripleUnwritable)
                })
        })
}