diff --git a/Cargo.toml b/Cargo.toml index f82d816..430e07c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,20 @@ version = "12.9.0" edition = "2021" description = "Rust bindings for Icebug graph analytics" license = "MIT" +repository = "https://github.com/Ladybug-Memory/icebug-rust" +homepage = "https://github.com/Ladybug-Memory/icebug" +documentation = "https://docs.rs/icebug" +keywords = ["graph", "analytics", "arrow", "bindings", "networkit"] +categories = ["api-bindings", "algorithms", "science"] +include = [ + "/Cargo.toml", + "/README.md", + "/build.rs", + "/include", + "/scripts/download-icebug.sh", + "/src", + "/tests", +] links = "networkit" [dependencies] diff --git a/build.rs b/build.rs index ea75949..e8c5085 100644 --- a/build.rs +++ b/build.rs @@ -6,7 +6,7 @@ fn main() { let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); let icebug_dir = env::var_os("ICEBUG_DIR") .map(PathBuf::from) - .unwrap_or_else(|| manifest_dir.join("vendor")); + .unwrap_or_else(|| default_icebug_dir(&manifest_dir)); println!("cargo:rerun-if-env-changed=ICEBUG_DIR"); println!("cargo:rerun-if-env-changed=ICEBUG_VERSION"); @@ -100,6 +100,7 @@ fn ensure_icebug_vendor(manifest_dir: &PathBuf, icebug_dir: &PathBuf) { let script = manifest_dir.join("scripts/download-icebug.sh"); let status = Command::new("bash") .arg(script) + .env("ICEBUG_VENDOR_DIR", icebug_dir) .current_dir(manifest_dir) .status() .expect("failed to run scripts/download-icebug.sh"); @@ -108,3 +109,11 @@ fn ensure_icebug_vendor(manifest_dir: &PathBuf, icebug_dir: &PathBuf) { panic!("scripts/download-icebug.sh failed with status {status}"); } } + +fn default_icebug_dir(manifest_dir: &PathBuf) -> PathBuf { + if manifest_dir.join(".cargo_vcs_info.json").exists() { + PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("icebug") + } else { + manifest_dir.join("vendor") + } +} diff --git a/scripts/download-icebug.sh b/scripts/download-icebug.sh index 91fb823..d55a337 100755 --- a/scripts/download-icebug.sh +++ b/scripts/download-icebug.sh @@ -5,7 +5,7 @@ set -euo pipefail REPO="Ladybug-Memory/icebug" -VENDOR_DIR="$(cd "$(dirname "$0")/.." && pwd)/vendor" +VENDOR_DIR="${ICEBUG_VENDOR_DIR:-$(cd "$(dirname "$0")/.." && pwd)/vendor}" DEFAULT_TAG="12.9" if [[ "${1:-}" != "" ]]; then