mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
faiss, new recipe (#11873)
* faiss, new recipe * Update dev-libs/faiss/faiss-1.10.0.recipe Co-authored-by: OscarL <oscar.lesta@gmail.com> * Update dev-libs/faiss/faiss-1.10.0.recipe Co-authored-by: OscarL <oscar.lesta@gmail.com> --------- Co-authored-by: OscarL <oscar.lesta@gmail.com>
This commit is contained in:
111
dev-libs/faiss/faiss-1.10.0.recipe
Normal file
111
dev-libs/faiss/faiss-1.10.0.recipe
Normal file
@@ -0,0 +1,111 @@
|
||||
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="1"
|
||||
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="65b5493d6b8cb992f104677cab255a9b71ef1e1d2ea3b1500dc995c68b429949"
|
||||
|
||||
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:liblapack$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:liblapack$secondaryArchSuffix
|
||||
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
|
||||
|
||||
packageEntries python$pythonPackage \
|
||||
$prefix/lib/python* \
|
||||
$libDir/libfaiss_python_callbacks.so
|
||||
}
|
||||
Reference in New Issue
Block a user