@@ -3,13 +3,8 @@ LIBS_DIR := $(abspath ./libs)
33
44# Flags for CGO to find the headers and the shared library
55UNAME_S := $(shell uname -s)
6- ifeq ($(UNAME_S ) ,Darwin)
7- CGO_CFLAGS := -I$(LIBS_DIR)
8- CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,@executable_path
9- else
10- CGO_CFLAGS := -I$(LIBS_DIR)
11- CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
12- endif
6+ CGO_CFLAGS := -I$(LIBS_DIR )
7+ CGO_LDFLAGS := -L$(LIBS_DIR ) -lcodex -Wl,-rpath,$(LIBS_DIR )
138
149ifeq ($(OS ) ,Windows_NT)
1510 BIN_NAME := example.exe
2015# Configuration for fetching the right binary
2116OS ?= "linux"
2217ARCH ?= "amd64"
23- VERSION ?= "v0.0.20 "
18+ VERSION ?= "v0.0.21 "
2419DOWNLOAD_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION ) /codex-${OS}-${ARCH}.zip"
2520
2621all : run
@@ -30,21 +25,13 @@ fetch:
3025 curl -fSL --create-dirs -o $(LIBS_DIR ) /codex-${OS} -${ARCH} .zip ${DOWNLOAD_URL}
3126 unzip -o -qq $(LIBS_DIR ) /codex-${OS} -${ARCH} .zip -d $(LIBS_DIR )
3227 rm -f $(LIBS_DIR ) /* .zip
33- # Update the path to the shared library on macOS
34- # ifeq ($(UNAME_S),Darwin)
35- # install_name_tool -id @rpath/libcodex.dylib $(LIBS_DIR)/libcodex.dylib
36- # endif
3728
3829build :
3930 CGO_ENABLED=1 CGO_CFLAGS=" $( CGO_CFLAGS) " CGO_LDFLAGS=" $( CGO_LDFLAGS) " go build -o $(BIN_NAME ) main.go
4031
4132run :
4233ifeq ($(OS ) ,Windows_NT)
4334 pwsh -File $(CURDIR)/.github/scripts/run-windows.ps1 -BinaryName $(BIN_NAME)
44- else ifeq ($(UNAME_S),Darwin)
45- # Instead of relying on install_name_tool, we can define DYLD_LIBRARY_PATH
46- # DYLD_LIBRARY_PATH=$(LIBS_DIR) ./$(BIN_NAME)
47- ./$(BIN_NAME)
4835else
4936 ./$(BIN_NAME)
5037endif
0 commit comments