%if 0%{!?version:1} %global version 2.0.0 %endif %if 0%{!?tag_version:1} %global tag_version 2.0.0 %endif %if 0%{!?git_commit:1} %global git_commit 6336e23 %endif %undefine _debugsource_packages Name: milvus Version: %{version} Release: 1%{?dist} Summary: An vector database License: ASL 2.0 URL: https://milvus.io/ BuildRequires: systemd-rpm-macros BuildRequires: zlib-devel git python3-devel make automake gcc gcc-c++ gcc-gfortran BuildRequires: cmake >= 3.18 golang >= 1.15 tbb-devel openblas-devel boost-devel ExclusiveArch: x86_64 Source0: https://github.com/milvus-io/milvus-rpm/archive/refs/tags/v%{tag_version}.tar.gz#/milvus-%{tag_version}.tar.gz %description Milvus is an open-source vector database for unstructured data. %debug_package %prep mkdir -p %{_builddir} tar -xf %{SOURCE0} -C %{_builddir}/ %build # build install milvus cd %{_builddir}/milvus-rpm-%{tag_version} tar -xf milvus-%{tag_version}.tar.gz tar -xf vendor.tar.gz mv vendor milvus-%{tag_version} cd %{_builddir}/milvus-rpm-%{tag_version}/milvus-%{tag_version} ## remove rpath config cmakeRpathFiles=( "internal/core/CMakeLists.txt" "internal/core/src/index/CMakeLists.txt" ) for cmakeRpathFile in "${cmakeRpathFiles[@]}"; do # remove all set(CMAKE_INSTALL_RPATH.* lines sed -i '/^set( CMAKE_INSTALL_RPATH/d' "$cmakeRpathFile" # add CMAKE_SKIP_BUILD_RPATH & CMAKE_SKIP_INSTALL_RPATH sed -i 's/# This will set RPATH to all excutable TARGET/set( CMAKE_SKIP_BUILD_RPATH TRUE )/g' "$cmakeRpathFile" sed -i 's/# self-installed dynamic libraries will be correctly linked by excutable/set( CMAKE_SKIP_INSTALL_RPATH TRUE )/g' "$cmakeRpathFile" done goRpathFiles=( "internal/indexnode/index.go" "internal/indexnode/indexnode.go" "internal/querynode/cgo_helper.go" "internal/querynode/collection.go" "internal/querynode/collection_replica.go" "internal/querynode/load_index_info.go" "internal/querynode/partition.go" "internal/querynode/plan.go" "internal/querynode/query_node.go" "internal/querynode/reduce.go" "internal/querynode/segment.go" ) for goRpathFiles in "${goRpathFiles[@]}"; do # remove -Wl,-rpath=${SRCDIR}/../core/output/lib configs sed -i 's/-Wl,-rpath=${SRCDIR}\/..\/core\/output\/lib//g' "$goRpathFiles" done # remove set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) for libNGT sed -i '/set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)/d' internal/core/src/index/thirdparty/NGT/CMakeLists.txt # use go mod sed -i 's/GO111MODULE=on \$(GO) build/GO111MODULE=on \$(GO) build -mod vendor/g' Makefile sed -i '$d' scripts/cwrapper_rocksdb_build.sh export MILVUS_FIU_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/1.00.tar.gz' export MILVUS_OPENTRACING_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/v1.5.1.tar.gz' export MILVUS_PROTOBUF_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/protobuf-cpp-3.9.0.zip' export MILVUS_YAMLCPP_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/yaml-cpp-0.6.3.tar.gz' export MILVUS_ROCKSDB_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/v6.15.2.tar.gz' export MILVUS_ARROW_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache-arrow-6.0.1.tar.gz' export ARROW_THRIFT_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache_arrow_dep/thrift-0.13.0.tar.gz' export ARROW_JEMALLOC_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache_arrow_dep/jemalloc-5.2.1.tar.bz2' export ARROW_XSIMD_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache_arrow_dep/aeec9c872c8b475dedd7781336710f2dd2666cb2.tar.gz' export ARROW_UTF8PROC_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache_arrow_dep/v2.6.1.tar.gz' export ARROW_BOOST_URL='%{_builddir}/milvus-rpm-%{tag_version}/download_thirdparty/apache_arrow_dep/boost_1_75_0.tar.gz' export LD_LIBRARY_PATH=${PWD}/internal/core/output/lib/ make %{?_smp_mflags} install -e BUILD_TAGS=v%{tag_version} -e GIT_COMMIT=%{git_commit} %install # dir mkdir -p %{buildroot}%{_bindir}/ mkdir -p %{buildroot}%{_libdir}/milvus mkdir -p %{buildroot}%{_sysconfdir}/milvus/configs/advanced mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ mkdir -p %{buildroot}%{_mandir}/man1 mkdir -p %{buildroot}%{_unitdir} cd %{_builddir}/milvus-rpm-%{tag_version}/milvus-%{tag_version} # bin echo 'export MILVUSCONF=/etc/milvus/configs/' > %{buildroot}%{_bindir}/milvus echo 'milvus-server $@' >> %{buildroot}%{_bindir}/milvus sed -i -e '1i#!/bin/bash' %{buildroot}%{_bindir}/milvus chmod 755 %{buildroot}%{_bindir}/milvus install -p -m 755 bin/milvus %{buildroot}%{_bindir}/milvus-server # lib strip lib/libmilvus_indexbuilder.so.2.0 install -p -m 755 lib/libmilvus_indexbuilder.so.2.0 %{buildroot}%{_libdir}/milvus/libmilvus_indexbuilder.so.2.0 strip lib/libmilvus_segcore.so.2.0 install -p -m 755 lib/libmilvus_segcore.so.2.0 %{buildroot}%{_libdir}/milvus/libmilvus_segcore.so.2.0 install -p -m 755 /usr/lib64/libopenblas.so %{buildroot}%{_libdir}/milvus/libopenblas.so.0 install -p -m 755 /usr/lib64/libtbb.so.2 %{buildroot}%{_libdir}/milvus/libtbb.so.2 strip lib/libfiu.so.1.00 install -p -m 755 lib/libfiu.so.1.00 %{buildroot}%{_libdir}/milvus/libfiu.so.0 strip lib/libngt.so.1.12.0 install -p -m 755 lib/libngt.so.1.12.0 %{buildroot}%{_libdir}/milvus/libngt.so.1 install -p -m 755 /usr/lib64/libgfortran.so.5.0.0 %{buildroot}%{_libdir}/milvus/libgfortran.so.5 # conf install -p -m 644 configs/milvus.yaml %{buildroot}%{_sysconfdir}/milvus/configs/milvus.yaml install -p -m 644 configs/advanced/etcd.yaml %{buildroot}%{_sysconfdir}/milvus/configs/advanced/etcd.yaml cd %{_builddir}/milvus-rpm-%{tag_version} #bin install -p -m 755 scripts/milvus-dependencies %{buildroot}%{_bindir}/milvus-dependencies # service install -p -m 644 rpm/services/milvus-dependencies.service %{buildroot}%{_unitdir}/milvus-dependencies.service install -p -m 644 rpm/services/milvus-etcd.service %{buildroot}%{_unitdir}/milvus-etcd.service install -p -m 644 rpm/services/milvus-minio.service %{buildroot}%{_unitdir}/milvus-minio.service install -p -m 644 rpm/services/milvus.service %{buildroot}%{_unitdir}/milvus.service # ldconf echo '/usr/lib64/milvus' >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/milvus.conf chmod 644 %{buildroot}%{_sysconfdir}/ld.so.conf.d/milvus.conf #doc install -p -m 644 rpm/man/milvus.1.gz %{buildroot}%{_mandir}/man1/milvus.1.gz install -p -m 644 rpm/man/milvus-server.1.gz %{buildroot}%{_mandir}/man1/milvus-server.1.gz install -p -m 644 rpm/man/milvus-dependencies.1.gz %{buildroot}%{_mandir}/man1/milvus-dependencies.1.gz %post # update ld, systemd cache #ldconfig #systemctl daemon-reload %systemd_post %{_unitdir}/*.service %preun # disable service before remove #systemctl stop milvus #systemctl disable milvus %systemd_preun %{_unitdir}/*.service %postun # update ld, systemd cache #ldconfig #systemctl daemon-reload %systemd_postun_with_restart %{_unitdir}/*.service %files %{_bindir}/* %dir %{_libdir}/milvus %{_libdir}/milvus/* %dir /usr/lib/systemd %dir /usr/lib/systemd/system %{_unitdir}/* %dir %{_sysconfdir}/milvus %dir %{_sysconfdir}/milvus/configs %dir %{_sysconfdir}/milvus/configs/advanced %config(noreplace) %{_sysconfdir}/milvus/configs/milvus.yaml %config(noreplace) %{_sysconfdir}/milvus/configs/advanced/etcd.yaml %config(noreplace) %{_sysconfdir}/ld.so.conf.d/milvus.conf %doc milvus-rpm-%{tag_version}/milvus-%{tag_version}/README.md %license milvus-rpm-%{tag_version}/milvus-%{tag_version}/LICENSE %{_mandir}/man1/milvus.1.gz %{_mandir}/man1/milvus-server.1.gz %{_mandir}/man1/milvus-dependencies.1.gz %changelog * Wed Mar 2 2022 Yunmei Li - 2.0.0-1 - Initial version of the package