diff --git a/Makefile b/Makefile index 272406b..7dbd582 100644 --- a/Makefile +++ b/Makefile @@ -21,34 +21,16 @@ luajit: $(BUILD_DIR)/tiktoken_core.$(EXT) lua51: $(BUILD_DIR)/tiktoken_core-lua51.$(EXT) define build_from_source - git clone https://github.com/gptlang/lua-tiktoken.git $(BUILD_DIR)/lua-tiktoken-temp + git clone --branch v0.2.2 --depth 1 https://github.com/gptlang/lua-tiktoken.git $(BUILD_DIR)/lua-tiktoken-temp cd $(BUILD_DIR)/lua-tiktoken-temp && cargo build --features=$1 cp $(BUILD_DIR)/lua-tiktoken-temp/target/debug/libtiktoken_core.$(EXT) $(BUILD_DIR)/tiktoken_core.$(EXT) rm -rf $(BUILD_DIR)/lua-tiktoken-temp endef -define download_release - curl -L https://github.com/gptlang/lua-tiktoken/releases/latest/download/tiktoken_core-$1-$(ARCH)-$2.$(EXT) -o $(BUILD_DIR)/tiktoken_core.$(EXT) -endef - -ifeq ($(BUILD_FROM_SOURCE), true) - $(BUILD_DIR)/tiktoken_core.$(EXT): $(BUILD_DIR) +$(BUILD_DIR)/tiktoken_core.$(EXT): $(BUILD_DIR) $(call build_from_source,luajit) - $(BUILD_DIR)/tiktoken_core-lua51.$(EXT): $(BUILD_DIR) +$(BUILD_DIR)/tiktoken_core-lua51.$(EXT): $(BUILD_DIR) $(call build_from_source,lua51) -else - ifneq ($(filter arm64 aarch64,$(ARCH)),) - $(BUILD_DIR)/tiktoken_core.$(EXT): $(BUILD_DIR) - $(call build_from_source,luajit) - $(BUILD_DIR)/tiktoken_core-lua51.$(EXT): $(BUILD_DIR) - $(call build_from_source,lua51) - else - $(BUILD_DIR)/tiktoken_core.$(EXT): $(BUILD_DIR) - $(call download_release,$(OS),luajit) - $(BUILD_DIR)/tiktoken_core-lua51.$(EXT): $(BUILD_DIR) - $(call download_release,$(OS),lua51) - endif -endif $(BUILD_DIR): mkdir -p $(BUILD_DIR) diff --git a/README.md b/README.md index 8b05e3e..9317fbd 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ For Windows users, change the build command to the following: > [!IMPORTANT] > > If your neovim doesn't use LuaJIT, then change `build` to `make lua51`. By default running make will install luajit. -> For ARM-based setup, make sure to also install cargo as we will have to build the tiktoken_core from source. +> Avante.nvim will now requires cargo to build tiktoken_core from source. > [!NOTE] >