Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
kpango committed Jul 17, 2024
1 parent 6b5c021 commit 9a6a76b
Show file tree
Hide file tree
Showing 4 changed files with 595 additions and 11 deletions.
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ VERSION ?= $(eval VERSION := $(shell cat versions/VALD_VERSION))$(VERSION)

NGT_REPO = github.com/yahoojapan/NGT

NPM_GLOBAL_PREFIX := $(eval NPM_GLOBAL_PREFIX := $(shell npm prefix --location=global))$(NPM_GLOBAL_PREFIX)

TEST_NOT_IMPL_PLACEHOLDER = NOT IMPLEMENTED BELOW

TEMP_DIR := $(eval TEMP_DIR := $(shell mktemp -d))$(TEMP_DIR)
BINDIR ?= /usr/local/bin
LIB_PATH ?= /usr/local/bin
$(LIB_PATH):
mkdir -p $(LIB_PATH)

GOPRIVATE = $(GOPKG),$(GOPKG)/apis,$(GOPKG)-client-go
GOPROXY = "https://proxy.golang.org,direct"
GOPATH := $(eval GOPATH := $(shell go env GOPATH))$(GOPATH)
Expand All @@ -59,17 +69,11 @@ GO_CLEAN_DEPS := true
GOTEST_TIMEOUT = 30m
CGO_ENABLED = 1

RUST_HOME ?= /usr/local/lib/rust
RUST_HOME ?= $(LIB_PATH)/rust
RUSTUP_HOME ?= $(RUST_HOME)/rustup
CARGO_HOME ?= $(RUST_HOME)/cargo
RUST_VERSION := $(eval RUST_VERSION := $(shell cat versions/RUST_VERSION))$(RUST_VERSION)

NPM_GLOBAL_PREFIX := $(eval NPM_GLOBAL_PREFIX := $(shell npm prefix --location=global))$(NPM_GLOBAL_PREFIX)

TEST_NOT_IMPL_PLACEHOLDER = NOT IMPLEMENTED BELOW

TEMP_DIR := $(eval TEMP_DIR := $(shell mktemp -d))$(TEMP_DIR)

BUF_VERSION := $(eval BUF_VERSION := $(shell cat versions/BUF_VERSION))$(BUF_VERSION)
NGT_VERSION := $(eval NGT_VERSION := $(shell cat versions/NGT_VERSION))$(NGT_VERSION)
FAISS_VERSION := $(eval FAISS_VERSION := $(shell cat versions/FAISS_VERSION))$(FAISS_VERSION)
Expand Down Expand Up @@ -100,8 +104,6 @@ SWAP_DEPLOYMENT_TYPE ?= deployment
SWAP_IMAGE ?= ""
SWAP_TAG ?= latest

BINDIR ?= /usr/local/bin

UNAME := $(eval UNAME := $(shell uname -s))$(UNAME)
OS := $(eval OS := $(shell echo $(UNAME) | tr '[:upper:]' '[:lower:]'))$(OS)
ARCH := $(eval ARCH := $(shell uname -m))$(ARCH)
Expand Down Expand Up @@ -603,8 +605,8 @@ ngt/install: /usr/local/include/NGT/Capi.h

.PHONY: faiss/install
## install Faiss
faiss/install: /usr/local/lib/libfaiss.so
/usr/local/lib/libfaiss.so:
faiss/install: $(LIB_PATH)/libfaiss.so
$(LIB_PATH)/libfaiss.so:
curl -fsSL https://github.com/facebookresearch/faiss/archive/v$(FAISS_VERSION).tar.gz -o $(TEMP_DIR)/v$(FAISS_VERSION).tar.gz
tar zxf $(TEMP_DIR)/v$(FAISS_VERSION).tar.gz -C $(TEMP_DIR)/
cd $(TEMP_DIR)/faiss-$(FAISS_VERSION) && \
Expand Down
26 changes: 26 additions & 0 deletions Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,29 @@ rust/install: $(CARGO_HOME)/bin/cargo
$(CARGO_HOME)/bin/cargo:
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} sh -s -- --default-toolchain $(RUST_VERSION) -y
source "${CARGO_HOME}/env"

.PHONY: zlib/install
zlib/install: $(LIB_PATH)
curl -fsSL https://github.com/madler/zlib/releases/download/v$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz -o $(TEMP_DIR)/zlib-$(ZLIB_VERSION).tar.gz \
&& mkdir -p $(TEMP_DIR)/zlib \
&& tar -xzvf $(TEMP_DIR)/zlib-$(ZLIB_VERSION).tar.gz -C $(TEMP_DIR)/zlib --strip-components 1 \
&& cd $(TEMP_DIR)/zlib \
&& chmod a+x $(TEMP_DIR)/zlib/configure \
&& $(TEMP_DIR)/zlib/configure --prefix=$(LIB_PATH) --static \
&& make \
&& make install \
&& cd $(ROOTDIR) \
&& rm -rf $(TEMP_DIR)/zlib-$(ZLIB_VERSION).tar.gz $(TEMP_DIR)/zlib

.PHONY: hdf5/install
hdf5/install: $(LIB_PATH) \
zlib/install
mkdir -p $(TEMP_DIR)/hdf5
&& curl -fsSL https://github.com/HDFGroup/hdf5/releases/download/$(HDF5_VERSION)/hdf5.tar.gz -o $(TEMP_DIR)/hdf5.tar.gz \
&& tar -xzvf $(TEMP_DIR)hdf5.tar.gz -C $(TEMP_DIR)/hdf5 --strip-components 2 \
&& cd $(TEMP_DIR)/hdf5 \
&& $(TEMP_DIR)/hdf5/configure --enable-build-mode=production --enable-static-exec --disable-shared --prefix=$(TEMP_DIR)/hdf5 --with-zlib=$(TEMP_DIR)/hdf5/include,$(LIB_PATH) LDFLAGS="-Wl,-rpath,$(LIB_DIR)" \
&& make check \
&& make install \
&& cd $(ROOTDIR) \
&& rm -rf $(TEMP_DIR)/hdf5.tar.gz $(TEMP_DIR)hdf5
Loading

0 comments on commit 9a6a76b

Please sign in to comment.