postgresqlPackages.vectorchord: 0.4.2 -> 0.5.3 (#436031)

This commit is contained in:
dotlambda
2025-10-15 23:02:12 +00:00
committed by GitHub
3 changed files with 6 additions and 99 deletions
@@ -1,29 +0,0 @@
diff --git a/crates/simd/build.rs b/crates/simd/build.rs
index 12ce198..aed5588 100644
--- a/crates/simd/build.rs
+++ b/crates/simd/build.rs
@@ -17,17 +17,24 @@ use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo::rerun-if-changed=cshim");
+ println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
let target_arch = var("CARGO_CFG_TARGET_ARCH")?;
match target_arch.as_str() {
"aarch64" => {
let mut build = cc::Build::new();
build.file("./cshim/aarch64.c");
+ build.compiler("@clang@");
+ // read env var set by rustPlatform.bindgenHook
+ build.try_flags_from_environment("BINDGEN_EXTRA_CLANG_ARGS").expect("the BINDGEN_EXTRA_CLANG_ARGS environment variable must be specified and UTF-8");
build.opt_level(3);
build.compile("simd_cshim");
}
"x86_64" => {
let mut build = cc::Build::new();
build.file("./cshim/x86_64.c");
+ build.compiler("@clang@");
+ // read env var set by rustPlatform.bindgenHook
+ build.try_flags_from_environment("BINDGEN_EXTRA_CLANG_ARGS").expect("the BINDGEN_EXTRA_CLANG_ARGS environment variable must be specified and UTF-8");
build.opt_level(3);
build.compile("simd_cshim");
}
@@ -1,24 +0,0 @@
diff --git a/crates/algorithm/src/lib.rs b/crates/algorithm/src/lib.rs
index 853a280..f88acbf 100644
--- a/crates/algorithm/src/lib.rs
+++ b/crates/algorithm/src/lib.rs
@@ -13,6 +13,7 @@
// Copyright (c) 2025 TensorChord Inc.
#![feature(select_unpredictable)]
+#![feature(let_chains)]
#![allow(clippy::type_complexity)]
mod build;
diff --git a/src/lib.rs b/src/lib.rs
index 654b4d1..2b11d03 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,7 @@
// Copyright (c) 2025 TensorChord Inc.
#![allow(unsafe_code)]
+#![feature(let_chains)]
mod datatype;
mod index;
@@ -1,68 +1,34 @@
{
buildPgrxExtension,
cargo-pgrx_0_14_1,
clang,
cargo-pgrx_0_16_0,
fetchFromGitHub,
lib,
nix-update-script,
postgresql,
postgresqlTestExtension,
replaceVars,
rust-jemalloc-sys,
stdenv,
}:
let
# Follow upstream and use rust-jemalloc-sys on linux aarch64 and x86_64
# Additionally, disable init exec TLS, since it causes issues with postgres.
# https://github.com/tensorchord/VectorChord/blob/0.4.2/Cargo.toml#L43-L44
useSystemJemalloc =
stdenv.hostPlatform.isLinux && (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64);
rust-jemalloc-sys' = (
rust-jemalloc-sys.override (old: {
jemalloc = old.jemalloc.override { disableInitExecTls = true; };
})
);
in
buildPgrxExtension (finalAttrs: {
inherit postgresql;
cargo-pgrx = cargo-pgrx_0_14_1;
cargo-pgrx = cargo-pgrx_0_16_0;
pname = "vectorchord";
version = "0.4.2";
version = "0.5.3";
src = fetchFromGitHub {
owner = "tensorchord";
repo = "vectorchord";
tag = finalAttrs.version;
hash = "sha256-EdMuSNcWwCBsAY0e3d0WVug1KBWYWldvKStF6cf/uRs=";
hash = "sha256-+c1Uf/3rp+HuthDVPLloJF2MQPW3Xho897Z2eAnG6aM=";
};
patches = [
# Tell the `simd` crate to use the flags from the rust bindgen hook
(replaceVars ./0001-read-clang-flags-from-environment.diff {
clang = lib.getExe clang;
})
# Add feature flags needed for features not yet stabilised in rustc stable
./0002-add-feature-flags.diff
];
buildInputs = lib.optionals useSystemJemalloc [
rust-jemalloc-sys'
];
cargoHash = "sha256-8NwfsJn5dnvog3fexzLmO3v7/3+L7xtv+PHWfCCWoHY=";
cargoHash = "sha256-/EcQgQ6J9hg4BsniRX7OMwEYy5EtVeT6Q/+3mAkyCH8=";
# Include upgrade scripts in the final package
# https://github.com/tensorchord/VectorChord/blob/0.4.2/crates/make/src/main.rs#L224
# https://github.com/tensorchord/VectorChord/blob/0.5.0/crates/make/src/main.rs#L366
postInstall = ''
cp sql/upgrade/* $out/share/postgresql/extension/
'';
env = {
# Bypass rust nightly features not being available on rust stable
RUSTC_BOOTSTRAP = 1;
};
# This crate does not have the "pg_test" feature
usePgTestCheckFeature = false;
@@ -123,12 +89,6 @@ buildPgrxExtension (finalAttrs: {
};
meta = {
# PostgreSQL 18 is not yet supported
# Will be supported in the next release (likely 0.5.0), as it's already supported in the main branch
# Check after next package update.
broken = lib.warnIf (
finalAttrs.version != "0.4.2"
) "Is postgresql18Packages.vectorchord still broken?" (lib.versionAtLeast postgresql.version "18");
changelog = "https://github.com/tensorchord/VectorChord/releases/tag/${finalAttrs.version}";
description = "Scalable, fast, and disk-friendly vector search in Postgres, the successor of pgvecto.rs";
homepage = "https://github.com/tensorchord/VectorChord";