Opened 18 months ago

Last modified 18 months ago

#71884 assigned defect

bat declares unnecessary dependency on libgit2 because it uses vendored copy

Reported by: neverpanic (Clemens Lang) Owned by: l2dy (Zero King)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: herbygillot (Herby Gillot)
Port: bat

Description

bat does not actually use the system libgit2, because it is too old. The libgit2-sys crate's build.rs file at work/.home/.cargo/macports/libgit2-sys-0.17.0+1.8.1/build.rs contains:

/// Tries to use system libgit2 and emits necessary build script instructions.
fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
    let mut cfg = pkg_config::Config::new();
    match cfg.range_version("1.8.1".."1.9.0").probe("libgit2") {
        Ok(lib) => {
            for include in &lib.include_paths {
                println!("cargo:root={}", include.display());
            }
            Ok(lib)
        }
        Err(e) => {
            println!("cargo:warning=failed to probe system libgit2: {e}");
            Err(e)
        }
    }
}

The corresponding pkg-config invocation is

PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "libgit2" "libgit2 >= 1.8.1" "libgit2 < 1.9.0"

which returns nothing, because libgit2 in MacPorts is at 1.7.2.

As a consequence, bat builds with the vendored copy of libgit2-sys instead.

Please either update libgit2 to a version compatible with bat, or always switch to the vendored copy and remove the libgit2 library dependency.

Change History (2)

comment:1 Changed 18 months ago by neverpanic (Clemens Lang)

Cc: herbygillot added
Owner: set to l2dy
Status: newassigned

comment:2 Changed 18 months ago by neverpanic (Clemens Lang)

NB: You can set build.env-append LIBGIT2_NO_VENDOR=1 to force bat's build to fail if it doesn't use the system copy of libgit2.

Note: See TracTickets for help on using tickets.