Skip to content

Autodetect target OS and target Arch #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ $(foreach bin,$(REQUIRED_BINS),\

ifeq ($(TARGET_OS), linux)
LIB_ENV_VAR = LD_LIBRARY_PATH
SEARCH_LIB = libllama_go.so
else
LIB_ENV_VAR = DYLD_LIBRARY_PATH
SEARCH_LIB = libllama_go.dylib
endif

.PHONY: default all build_release build setup clean setup \
Expand Down Expand Up @@ -71,7 +73,7 @@ search-release-$(SEARCH_VERSION)/README.md: download_models_for_semrouter

build_search_lib search-release-$(SEARCH_VERSION)/build/lib/$(SEARCH_LIB): search-release-$(SEARCH_VERSION)/README.md
-mkdir -p "search-release-$(SEARCH_VERSION)/build"
cd "search-release-$(SEARCH_VERSION)/build" && cmake -DCMAKE_BUILD_TYPE=Release ..
cd "search-release-$(SEARCH_VERSION)/build" && cmake -DGGML_NATIVE=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release ..
cd "search-release-$(SEARCH_VERSION)/build" && cmake --build . --config Release

tyk-release-$(TYK_VERSION)/$(SEARCH_LIB): search-release-$(SEARCH_VERSION)/build/lib/$(SEARCH_LIB)
Expand All @@ -91,7 +93,7 @@ start_redis: deploy/docker-compose.yaml

build_plugin plugins/$(FULL_PLUGIN_NAME).so: plugins/*.go plugins/go.mod tyk-release-$(TYK_VERSION)/go.mod
cd plugins && go mod tidy -go=$$(go mod edit -json ../tyk-release-$(TYK_VERSION)/go.mod | jq -r .Go)
GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -C plugins -trimpath -buildmode=plugin -o $(FULL_PLUGIN_NAME).so .
CGO_ENABLED='1' GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -C plugins -trimpath -buildmode=plugin -o $(FULL_PLUGIN_NAME).so .

install_plugin tyk-release-$(TYK_VERSION)/middleware/agent-bridge-plugin.so: plugins/$(FULL_PLUGIN_NAME).so
cp plugins/$(FULL_PLUGIN_NAME).so ./tyk-release-$(TYK_VERSION)/middleware/agent-bridge-plugin.so
Expand Down
Loading