@@ -23,27 +23,33 @@ ARCH := $(shell uname -m)
2323
2424# Determine Ditto SDK platform string
2525ifeq ($(PLATFORM ) ,linux)
26- DITTO_PLATFORM = go- linux-$(ARCH )
26+ DITTO_PLATFORM = linux-$(ARCH )
2727else ifeq ($(PLATFORM),darwin)
28- DITTO_PLATFORM = go-macos-aarch64
28+ DITTO_PLATFORM = macos-aarch64
29+
30+ # avoid version mismatch warnings when linking
31+ export MACOSX_DEPLOYMENT_TARGET := 11.0
32+ export CGO_CFLAGS := -mmacosx-version-min=11.0
33+ export CGO_LDFLAGS := -mmacosx-version-min=11.0
2934else
3035 $(error Unsupported platform : $(PLATFORM ) )
3136endif
3237
33- DITTO_SDK_URL = https://software.ditto.live/$(DITTO_PLATFORM ) /Ditto/$(DITTO_SDK_VERSION ) /dist/Ditto .tar.gz
38+ DITTO_SDK_URL = https://software.ditto.live/go- $(DITTO_PLATFORM ) /Ditto/$(DITTO_SDK_VERSION ) /libs/libdittoffi- $( DITTO_PLATFORM ) .tar.gz
3439
3540# Build the application
3641.PHONY : build
3742build : go-sdk ditto-tasks-termui
3843
3944ditto-tasks-termui :
4045 @echo " Building ditto-tasks-termui..."
41- $(GO ) build -o ditto-tasks-termui
46+ $(GO ) mod tidy
47+ $(GO ) build -o ditto-tasks-termui -ldflags=' -extldflags "-L./go-sdk"'
4248
4349.PHONY : go-sdk
4450go-sdk : # # Downloads and installs the Ditto Go SDK library to go-sdk directory
45- @if [ ! -f go-sdk/libdittoffi.so ] && [ ! -f go-sdk/libdittoffi.dylib ] ; then \
46- @ echo " 📥 Downloading Ditto Go SDK v$( DITTO_SDK_VERSION) for $( DITTO_PLATFORM) ..."
51+ @ if [ ! -f go-sdk/libdittoffi.so ] && [ ! -f go-sdk/libdittoffi.dylib ] ; then \
52+ echo " 📥 Downloading Ditto Go SDK v$( DITTO_SDK_VERSION) for $( DITTO_PLATFORM) $( DITTO_SDK_URL ) ..." ; \
4753 mkdir -p go-sdk; \
4854 if curl -L -f $( DITTO_SDK_URL) | tar xz --strip-components=0 -C go-sdk/; then \
4955 echo " ✅ Ditto Go SDK v$( DITTO_SDK_VERSION) installed successfully" ; \
@@ -55,20 +61,20 @@ go-sdk: ## Downloads and installs the Ditto Go SDK library to go-sdk directory
5561 fi
5662
5763# Run the application (built binary)
58- .PHONY : BUILD_TYPE
64+ .PHONY : build
5965run : build
6066 @echo " Running ditto-tasks-termui..."
61- LD_LIBRARY_PATH=" $( pwd) /go-sdk" DYLD_LIBRARY_PATH=" $( pwd) /go-sdk" ./ditto-tasks-termui 2> /dev/null
67+ LD_LIBRARY_PATH=" $$ (pwd)/go-sdk" DYLD_LIBRARY_PATH=" $ $ (pwd)/go-sdk" ./ditto-tasks-termui 2> /dev/null
6268
6369# Run directly with Go
6470.PHONY : run-go
6571run-go :
6672 @echo " Running ditto tasks-termui with go run..."
67- LD_LIBRARY_PATH=" $( pwd) /go-sdk" DYLD_LIBRARY_PATH=" $( pwd) /go-sdk" $(GO ) run main.go 2> /dev/null
73+ LD_LIBRARY_PATH=" $$ (pwd)/go-sdk" DYLD_LIBRARY_PATH=" $ $ (pwd)/go-sdk" $(GO ) run main.go 2> /dev/null
6874
6975# Clean build artifacts
7076.PHONY : clean
7177clean :
7278 @echo " Cleaning ditto-tasks-termui and build artifacts..."
7379 rm -f ditto-tasks-termui
74- rm -f go-sdk
80+ rm -rf go-sdk
0 commit comments