1
1
.PHONY : statusgo all test clean help
2
- .PHONY : statusgo-android statusgo-ios
2
+ .PHONY : statusgo-android statusgo-ios statusgo-ios-library statusgo-android-library
3
3
.PHONY : build-libwaku test-libwaku clean-libwaku rebuild-libwaku
4
4
5
5
# Clear any GOROOT set outside of the Nix shell
40
40
detected_OS := $(strip $(shell uname) )
41
41
endif
42
42
43
+ ifeq ($(ARCH ) ,x86_64)
44
+ MOBILE_GOARCH := amd64
45
+ else
46
+ MOBILE_GOARCH := $(ARCH )
47
+ endif
48
+
43
49
ifeq ($(detected_OS ) ,Darwin)
44
50
GOBIN_SHARED_LIB_EXT := dylib
45
51
LIBWAKU_EXT := so
@@ -211,11 +217,13 @@ statusgo-ios: ##@cross-compile Build status-go for iOS
211
217
github.com/status-im/status-go/mobile
212
218
@echo " iOS framework cross compilation done in build/bin/Statusgo.xcframework"
213
219
214
- statusgo-library : generate
215
- statusgo-library : $(LIBWAKU ) # #@cross-compile Build status-go as static library for current platform
220
+ statusgo-c-bindings :
216
221
# # cmd/library/README.md explains the magic incantation behind this
217
222
mkdir -p build/bin/statusgo-lib
218
223
go run cmd/library/* .go > build/bin/statusgo-lib/main.go
224
+
225
+ statusgo-library : generate
226
+ statusgo-library : statusgo-c-bindings $(LIBWAKU ) # #@cross-compile Build status-go as static library for current platform
219
227
@echo " Building static library..."
220
228
go build \
221
229
-tags ' $(BUILD_TAGS)' \
@@ -229,10 +237,7 @@ statusgo-library: $(LIBWAKU) ##@cross-compile Build status-go as static library
229
237
build-libwaku : $(LIBWAKU )
230
238
231
239
statusgo-shared-library : generate
232
- statusgo-shared-library : $(LIBWAKU ) # #@cross-compile Build status-go as shared library for current platform
233
- # # cmd/library/README.md explains the magic incantation behind this
234
- mkdir -p build/bin/statusgo-lib
235
- go run cmd/library/* .go > build/bin/statusgo-lib/main.go
240
+ statusgo-shared-library : statusgo-c-bindings $(LIBWAKU ) # #@cross-compile Build status-go as shared library for current platform
236
241
@echo " Building shared library..."
237
242
@echo " Tags: $( BUILD_TAGS) "
238
243
$(GOBIN_SHARED_LIB_CFLAGS ) $(GOBIN_SHARED_LIB_CGO_LDFLAGS ) go build \
@@ -250,6 +255,27 @@ endif
250
255
@echo "Shared library built:"
251
256
@ls -la build/bin/libstatus.*
252
257
258
+ statusgo-android-library : ANDROID_NDK_ROOT ?= /opt/android-sdk/ndk/27.2.12479018 ANDROID_API ?= 28 HOST_OS ?= linux ARCH ?= arm64
259
+ statusgo-android-library : CC ?= $(ANDROID_NDK_ROOT ) /toolchains/llvm/prebuilt/$(HOST_OS ) -x86_64/bin/aarch64-linux-android$(ANDROID_API ) -clang
260
+ statusgo-android-library : GOFLAGS ?= "" CGO_CFLAGS ?= "-Os -flto" CGO_LDFLAGS ?= "-Os -flto" CGO_ENABLED ?= 1 GOOS ?= android GOARCH ?= $(MOBILE_GOARCH )
261
+ statusgo-android-library : generate statusgo-c-bindings $(LIBWAKU ) # #@cross-compile Build status-go as Android mobile library
262
+ @echo " Building Android mobile library..."
263
+ go build -buildmode=c-shared -tags ' gowaku_no_rln nowatchdog disable_torrent' \
264
+ -ldflags=" -checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" \
265
+ -o " build/bin/libstatus.so" ./build/bin/statusgo-lib
266
+ @echo " Android library built"
267
+
268
+ statusgo-ios-library : IPHONE_SDK ?= iphoneos IOS_TARGET ?= 13.0 ARCH ?= arm64
269
+ statusgo-ios-library : CC ?= $(shell xcrun --sdk $(IPHONE_SDK ) --find clang)
270
+ statusgo-ios-library : CGO_CFLAGS ?= -Os -flto -arch $(ARCH ) -isysroot $(shell xcrun --sdk $(IPHONE_SDK ) --show-sdk-path) -miphoneos-version-min=$(IOS_TARGET ) -fembed-bitcode
271
+ statusgo-ios-library : CGO_LDFLAGS ?= -Os -flto GOFLAGS ?= "" CGO_ENABLED ?= 1 GOOS ?= ios GOARCH ?= $(MOBILE_GOARCH )
272
+ statusgo-ios-library : generate statusgo-c-bindings $(LIBWAKU ) # #@cross-compile Build status-go as iOS mobile library
273
+ @echo " Building iOS mobile library..."
274
+ go build -buildmode=c-archive -tags ' gowaku_no_rln nowatchdog disable_torrent' \
275
+ -ldflags=" -checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" \
276
+ -o " build/bin/libstatus.a" ./build/bin/statusgo-lib
277
+ @echo " iOS library built"
278
+
253
279
docker-image : SHELL := /bin/sh
254
280
docker-image : BUILD_TARGET ?= cmd
255
281
docker-image : # #@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
0 commit comments