mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
112 lines
3.0 KiB
Bash
112 lines
3.0 KiB
Bash
SUMMARY="A library for efficient similarity search and clustering of dense vectors"
|
|
DESCRIPTION="Faiss is a library for efficient similarity search and clustering of dense vectors. \
|
|
It contains algorithms that search in sets of vectors of any size, up to ones that possibly do \
|
|
not fit in RAM. It also contains supporting code for evaluation and parameter tuning. Faiss is \
|
|
written in C++ with complete wrappers for Python/numpy. Some of the most useful algorithms are \
|
|
implemented on the GPU. It is developed primarily at Meta's Fundamental AI Research \
|
|
*https://ai.facebook.com/* group."
|
|
HOMEPAGE="https://github.com/facebookresearch/faiss"
|
|
COPYRIGHT="2025 Facebook, Inc. and its affiliates."
|
|
LICENSE="MIT"
|
|
REVISION="2"
|
|
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
|
|
CHECKSUM_SHA256="65b5493d6b8cb992f104677cab255a9b71ef1e1d2ea3b1500dc995c68b429949"
|
|
PATCHES="faiss-$portVersion.patchset"
|
|
|
|
ARCHITECTURES="all !x86_gcc2"
|
|
SECONDARY_ARCHITECTURES="x86"
|
|
|
|
# For which version of Python will faiss bindings be created?
|
|
pythonVersion=3.10
|
|
pythonPackage=${pythonVersion//.}
|
|
|
|
PROVIDES="
|
|
faiss$secondaryArchSuffix = $portVersion
|
|
lib:libfaiss$secondaryArchSuffix
|
|
lib:libfaiss_avx2$secondaryArchSuffix
|
|
"
|
|
REQUIRES="
|
|
haiku$secondaryArchSuffix
|
|
lib:libgomp$secondaryArchSuffix
|
|
lib:libopenblas$secondaryArchSuffix
|
|
"
|
|
|
|
PROVIDES_devel="
|
|
faiss${secondaryArchSuffix}_devel = $portVersion
|
|
devel:libfaiss$secondaryArchSuffix
|
|
devel:libfaiss_avx2$secondaryArchSuffix
|
|
"
|
|
REQUIRES_devel="
|
|
faiss$secondaryArchSuffix == $portVersion base
|
|
"
|
|
|
|
BUILD_REQUIRES="
|
|
haiku${secondaryArchSuffix}_devel
|
|
devel:libopenblas$secondaryArchSuffix
|
|
"
|
|
BUILD_PREREQUIRES="
|
|
cmd:cmake
|
|
cmd:gcc$secondaryArchSuffix
|
|
cmd:make
|
|
cmd:pkg_config$secondaryArchSuffix
|
|
cmd:swig
|
|
cmd:python$pythonVersion
|
|
numpy_python$pythonPackage
|
|
setuptools_python$pythonPackage
|
|
"
|
|
|
|
eval "SUMMARY_python$pythonPackage=\"The Python $pythonVersion bindings for faiss\""
|
|
eval "PROVIDES_python$pythonPackage=\"
|
|
faiss_python$pythonPackage = $portVersion
|
|
lib:libfaiss_python_callbacks$secondaryArchSuffix
|
|
\""
|
|
eval "REQUIRES_python$pythonPackage=\"
|
|
faiss$secondaryArchSuffix == $portVersion base
|
|
haiku$secondaryArchSuffix
|
|
cmd:python$pythonVersion
|
|
\""
|
|
|
|
BUILD()
|
|
{
|
|
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
|
|
$cmakeDirArgs \
|
|
-DFAISS_ENABLE_GPU=OFF \
|
|
-DFAISS_ENABLE_PYTHON=ON \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DFAISS_OPT_LEVEL=avx2 \
|
|
-DBUILD_TESTING=OFF
|
|
|
|
make -C build $jobArgs
|
|
|
|
# Install Python's bindings module
|
|
cd build/faiss/python
|
|
|
|
python=python$pythonVersion
|
|
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
|
|
export PYTHONPATH=$installLocation:$PYTHONPATH
|
|
mkdir -p $installLocation
|
|
|
|
$python setup.py build install \
|
|
--root=/ --prefix=$prefix
|
|
}
|
|
|
|
INSTALL()
|
|
{
|
|
make -C build install
|
|
|
|
mv $prefix/lib/python$pythonVersion/vendor-packages/faiss/libfaiss_python_callbacks.so $libDir
|
|
|
|
prepareInstalledDevelLibs \
|
|
libfaiss \
|
|
libfaiss_avx2
|
|
fixPkgconfig
|
|
|
|
packageEntries devel \
|
|
$developDir \
|
|
$libDir/cmake
|
|
|
|
packageEntries python$pythonPackage \
|
|
$prefix/lib/python* \
|
|
$libDir/libfaiss_python_callbacks.so
|
|
}
|