add linux arm64 target #26

Merged
dan merged 3 commits from linarm into main 2023-07-24 20:45:46 +00:00
3 changed files with 31 additions and 6 deletions

View File

@ -21,7 +21,7 @@ steps:
- export GOSUMDB="off"
- name: build-linux
image: golang:1.19.1
image: openpriv/golangxarm:1.19.1
volumes:
- name: deps
path: /go

View File

@ -7,8 +7,17 @@ DEFAULT_GOAL: linux
all: linux android windows
ARCH := $(shell uname -m)
ARM_X_CC := aarch64-linux-gnu-gcc
# determine if the x64 cross arm64 compiler is available so we can add that target
LINUX_X_ARM=
ifneq (,$(shell which $(ARM_X_CC)))
LINUX_X_ARM = libCwtch.x.so
endif
linux: EXPERIMENTS ?= serverExperiment
linux: libCwtch.so
linux: libCwtch.so $(LINUX_X_ARM)
macos: EXPERIMENTS ?= serverExperiment
macos: libCwtch.x64.dylib libCwtch.arm64.dylib
@ -20,7 +29,6 @@ windows: EXPERIMENTS ?= serverExperiment
windows: libCwtch.dll
lib.go: generate/generate_bindings.go spec
go run generate/generate_bindings.go --experiments "$(EXPERIMENTS)"
@ -29,8 +37,21 @@ libCwtch.so: lib.go
./switch-ffi.sh
go build -trimpath -ldflags "-buildid=autobindings-$(shell git describe --tags) -X main.buildVer=autobindings-$(shell git describe --tags) -X main.buildDate=$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so
mkdir -p build/linux
mv libCwtch.so build/linux/
mv libCwtch.h build/linux/
ifeq ($(ARCH),x86_64)
mv libCwtch.so build/linux/libCwtch.x64.so
else ifeq ($(ARCH),aarch64)
mv libCwtch.so build/linux/libCwtch.arm64.so
endif
mv libCwtch.h build/linux/libCwtch.h
libCwtch.x.so: lib.go
./switch-ffi.sh
mkdir -p build/linux
ifeq ($(ARCH),x86_64)
env CGO_ENABLED=1 CC=$(ARM_X_CC) GOARCH=arm64 go build -trimpath -ldflags "-buildid=autobindings-v0.0.3-22-g20065b2 -X main.buildVer=autobindings-v0.0.3-22-g20065b2 -X main.buildDate=2023-05-01-21-41" -buildmode c-shared -o libCwtch.x.so
mv libCwtch.x.so build/linux/libCwtch.arm64.so
mv libCwtch.x.h build/linux/libCwtch.h
endif
libCwtch.x64.dylib: lib.go
./switch-ffi.sh
@ -66,7 +87,7 @@ clean-autobindings:
rm -f lib.go
clean:
rm -fr lib.go cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.*.dylib build
rm -fr lib.go cwtch.aar cwtch_go.apk libCwtch.*.h libCwtch.*.so cwtch-sources.jar libCwtch.dll libCwtch.*.dylib build
# iOS - for testing purposes only for now, not officially supported

View File

@ -59,6 +59,10 @@ Other directives:
- `LD_LIBRARY_PATH` set to point to `libCwtch.so`
- or drop a symlink into `/usr/lib`
### Cross compile arm 64
Needs `sudo apt install gcc-aarch64-linux-gnu`
## Android
- copy `cwtch.aar` into `flutter_app/android/cwtch`