cargo-php-sys-build 0.1.0

Generate pregenerated Rust bindings for php-all-sys from vendored PHP headers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::{env, fs::File, io::Write, path::PathBuf};

pub static CHECK_C: &[u8] = include_bytes!("check.c");
pub static WRAPPER_H: &[u8] = include_bytes!("wrapper.h");

fn output_file(filename: &str, contents: &[u8]) -> anyhow::Result<PathBuf> {
    let out_path = PathBuf::from(env::var("OUT_DIR")?).join(filename);
    File::create(&out_path)?.write_all(contents)?;
    Ok(out_path)
}

pub fn render_check_c() -> anyhow::Result<PathBuf> {
    output_file("check.c", CHECK_C)
}

pub fn render_wrapper_h() -> anyhow::Result<PathBuf> {
    output_file("wrapper.h", WRAPPER_H)
}