Using pkg-config to find the libraries (+ some cleanup)

[?]
Jan 2, 2021, 8:49 PM
TKSHSYFM7M7CAFAJDZEZRPIIJF5PZF2GI3YRH7FEI632YQFS3AJQC

Dependencies

  • [2] HELRYMZK Manual bindings (Windows and Clang aren't very good friends), and getting rid of anyhow
  • [3] IH334Q5A Reboot
  • [4] UPRY2FEL Remove bindgen dependency

Change contents

  • replacement in default.nix at line 5
    [3.265968][3.13164:13240]()
    buildInputs = [ pkgconfig llvmPackages.libclang.lib cmake rust-bindgen ];
    [3.265968]
    [3.266031]
    buildInputs = [ pkgconfig llvmPackages.libclang.lib cmake rust-bindgen zstd xxHash ];
  • edit in build.rs at line 1
    [3.266097][3.13241:13283](),[3.13283][3.266136:266137](),[3.266136][3.266136:266137]()
    /*use std::env;
    use std::path::PathBuf;*/
  • replacement in build.rs at line 11
    [3.266447][3.266447:266536](),[3.266536][3.13284:13291](),[3.13291][3.266536:269439](),[3.266536][3.266536:269439](),[3.269439][3.13292:13300]()
    println!("cargo:rustc-link-lib=zstd");
    println!("cargo:rustc-link-lib=xxhash");
    /*
    let bindings = bindgen::Builder::default()
    .clang_arg("-Izstd/lib/common")
    .clang_arg("-Izstd/lib")
    .header("zstd/contrib/seekable_format/zstd_seekable.h")
    .whitelist_function("ZSTD_CStreamInSize")
    .whitelist_function("ZSTD_CStreamOutSize")
    .whitelist_function("ZSTD_seekable_createCStream")
    .whitelist_function("ZSTD_seekable_create")
    .whitelist_function("ZSTD_seekable_initCStream")
    .whitelist_function("ZSTD_seekable_initBuff")
    .whitelist_function("ZSTD_seekable_initFile")
    .whitelist_function("ZSTD_seekable_compressStream")
    .whitelist_function("ZSTD_seekable_decompress")
    .whitelist_function("ZSTD_seekable_endStream")
    .whitelist_function("ZSTD_seekable_free")
    .whitelist_function("ZSTD_seekable_freeCStream")
    .whitelist_function("ZSTD_DStreamOutSize")
    .whitelist_function("ZSTD_getErrorName")
    .whitelist_function("ZSTD_seekable_getNumFrames")
    .whitelist_function("ZSTD_seekable_getFrameCompressedOffset")
    .whitelist_function("ZSTD_seekable_getFrameCompressedSize")
    .whitelist_function("ZSTD_seekable_getFrameDecompressedOffset")
    .whitelist_function("ZSTD_seekable_getFrameDecompressedSize")
    .whitelist_function("ZSTD_seekable_decompressFrame")
    .whitelist_function("ZSTD_seekable_offsetToFrameIndex")
    .whitelist_function("ZSTD_isError")
    .whitelist_function("ZSTD_seekable_freeFrameLog")
    .whitelist_function("ZSTD_seekable_logFrame")
    .whitelist_function("ZSTD_seekable_createFrameLog")
    .whitelist_function("ZSTD_seekable_writeSeekTable")
    .whitelist_function("ZSTD_compress")
    .whitelist_function("xxh64")
    //
    .whitelist_function("ZSTD_createCStream")
    .whitelist_function("ZSTD_initCStream")
    .whitelist_function("ZSTD_freeCStream")
    .whitelist_function("ZSTD_flushStream")
    .whitelist_function("ZSTD_endStream")
    .whitelist_function("ZSTD_compressStream")
    .whitelist_function("ZSTD_compressStream2")
    .whitelist_function("ZSTD_CStreamInSize")
    .whitelist_function("ZSTD_CStreamOutSize")
    //
    .whitelist_function("ZSTD_createDStream")
    .whitelist_function("ZSTD_initDStream")
    .whitelist_function("ZSTD_freeDStream")
    .whitelist_function("ZSTD_decompressStream")
    .whitelist_type("ZSTD_inBuffer")
    .whitelist_type("ZSTD_outBuffer")
    .whitelist_type("ZSTD_frameLog")
    .whitelist_function("ZSTD_seekable_initAdvanced")
    .whitelist_type("ZSTD_seekable_customFile")
    .generate()
    .expect("Unable to generate bindings");
    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings
    .write_to_file(out_path.join("bindings.rs"))
    .expect("Couldn't write bindings!");
    */
    [3.266447]
    [3.269439]
    pkg_config::probe_library("libzstd").unwrap();
    pkg_config::probe_library("libxxhash").unwrap();
  • replacement in Cargo.toml at line 4
    [3.269755][2.5023:5041]()
    version = "0.1.5"
    [3.269755]
    [3.269773]
    version = "0.1.6"
  • edit in Cargo.toml at line 33
    [3.270490]
    pkg-config = "0.3"