[source]
git = "https://gitlab.redox-os.org/redox-os/cargo.git"
upstream = "https://github.com/rust-lang/cargo.git"
branch = "redox-2023-01-21"

[build]
template = "custom"
dependencies = [
    "curl",
    "libssh2",
    "nghttp2",
    "openssl1",
    "zlib",
]
script = """
export LIBSSH2_SYS_USE_PKG_CONFIG=1
export LIBZ_SYS_STATIC=1
export DEP_NGHTTP2_ROOT="${COOKBOOK_SYSROOT}"
export DEP_OPENSSL_ROOT="${COOKBOOK_SYSROOT}"
export DEP_Z_ROOT="${COOKBOOK_SYSROOT}"
# Force linking system nghttp2
"${COOKBOOK_CARGO}" rustc \
    --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
    --release \
    --bin cargo \
    -- \
    -L "${COOKBOOK_SYSROOT}/lib" \
    -C link-arg="-lnghttp2"
mkdir -pv "${COOKBOOK_STAGE}/bin"
cp -v "target/${TARGET}/release/cargo" "${COOKBOOK_STAGE}/bin/cargo"
"""
