Skip to content

Commit

Permalink
chore(build): add options to build from source on linux (yetone#98)
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
  • Loading branch information
aarnphm authored Aug 19, 2024
1 parent 78213d8 commit 2a0311f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif

LUA_VERSIONS := luajit lua51
BUILD_DIR := build
BUILD_FROM_SOURCE := false

all: luajit

Expand All @@ -30,16 +31,23 @@ define download_release
curl -L https://github.com/gptlang/lua-tiktoken/releases/latest/download/tiktoken_core-$1-$2.$(EXT) -o $(BUILD_DIR)/tiktoken_core.$(EXT)
endef

ifneq ($(filter arm64 aarch64,$(ARCH)),)
ifeq ($(BUILD_FROM_SOURCE), true)
$(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)
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):
Expand Down

0 comments on commit 2a0311f

Please sign in to comment.