@@ -20,6 +20,7 @@ GOLIST := go list $(PKG)/... | grep -v '/vendor/'
20
20
XARGS := xargs -L 1
21
21
22
22
LDFLAGS := -s -w -buildid=
23
+ LDFLAGS_MOBILE := -ldflags "$(call make_ldflags, ${tags}, -s -w) "
23
24
24
25
RM := rm -f
25
26
CP := cp
@@ -28,6 +29,18 @@ XARGS := xargs -L 1
28
29
29
30
LINT = $(LINT_BIN ) run -v --build-tags itest
30
31
32
+ PKG := github.com/lightninglabs/lightning-node-connect
33
+ MOBILE_PKG := $(PKG ) /mobile
34
+ MOBILE_BUILD_DIR :=${GOPATH}/src/$(PKG ) /build
35
+ IOS_BUILD_DIR := $(MOBILE_BUILD_DIR ) /ios
36
+ IOS_BUILD := $(IOS_BUILD_DIR ) /Lndmobile.xcframework
37
+ ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR ) /android
38
+ ANDROID_BUILD := $(ANDROID_BUILD_DIR ) /lnc-mobile.aar
39
+
40
+ GOMOBILE_BIN := $(GO_BIN ) /gomobile
41
+
42
+ RPC_TAGS := appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc
43
+
31
44
include make/testing_flags.mk
32
45
33
46
default : build
@@ -48,14 +61,36 @@ $(LINT_BIN):
48
61
49
62
build :
50
63
@$(call print, "Building lightning-node-connect.")
51
- $(GOBUILD ) $(PKG ) /...
64
+ $(GOBUILD ) -tags= " $( RPC_TAGS ) " $(PKG ) /...
52
65
53
66
wasm :
54
67
# The appengine build tag is needed because of the jessevdk/go-flags library
55
68
# that has some OS specific terminal code that doesn't compile to WASM.
56
- cd cmd/wasm-client; GOOS=js GOARCH=wasm go build -trimpath -ldflags=" $( LDFLAGS) " -tags=" appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc " -v -o wasm-client.wasm .
69
+ cd cmd/wasm-client; GOOS=js GOARCH=wasm go build -trimpath -ldflags=" $( LDFLAGS) " -tags=" $( RPC_TAGS ) " -v -o wasm-client.wasm .
57
70
$(CP ) cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm
58
71
72
+ apple :
73
+ @$(call print, "Building iOS and macOS cxframework ($(IOS_BUILD ) ) ." )
74
+ mkdir -p $(IOS_BUILD_DIR )
75
+ $(GOMOBILE_BIN ) bind -target=ios,iossimulator,macos -tags=" mobile $( DEV_TAGS) $( RPC_TAGS) " $(LDFLAGS_MOBILE ) -v -o $(IOS_BUILD ) $(MOBILE_PKG )
76
+
77
+ ios :
78
+ @$(call print, "Building iOS cxframework ($(IOS_BUILD ) ) ." )
79
+ mkdir -p $(IOS_BUILD_DIR )
80
+ $(GOMOBILE_BIN ) bind -target=ios,iossimulator -tags=" mobile $( DEV_TAGS) $( RPC_TAGS) " $(LDFLAGS_MOBILE ) -v -o $(IOS_BUILD ) $(MOBILE_PKG )
81
+
82
+ macos :
83
+ @$(call print, "Building macOS cxframework ($(IOS_BUILD ) ) ." )
84
+ mkdir -p $(IOS_BUILD_DIR )
85
+ $(GOMOBILE_BIN ) bind -target=macos -tags=" mobile $( DEV_TAGS) $( RPC_TAGS) " $(LDFLAGS_MOBILE ) -v -o $(IOS_BUILD ) $(MOBILE_PKG )
86
+
87
+ android :
88
+ @$(call print, "Building Android library ($(ANDROID_BUILD ) ) ." )
89
+ mkdir -p $(ANDROID_BUILD_DIR )
90
+ GOOS=js $(GOMOBILE_BIN ) bind -target=android -tags=" mobile $( DEV_TAGS) $( RPC_TAGS) " -androidapi 21 $(LDFLAGS_MOBILE ) -v -o $(ANDROID_BUILD ) $(MOBILE_PKG )
91
+
92
+ mobile : ios android
93
+
59
94
# =======
60
95
# TESTING
61
96
# =======
@@ -64,11 +99,11 @@ check: unit
64
99
65
100
unit :
66
101
@$(call print, "Running unit tests.")
67
- $(UNIT )
102
+ $(UNIT ) -tags= " $( RPC_TAGS ) "
68
103
69
104
unit-race :
70
105
@$(call print, "Running unit race tests.")
71
- env CGO_ENABLED=1 GORACE=" history_size=7 halt_on_errors=1" $(UNIT_RACE )
106
+ env CGO_ENABLED=1 GORACE=" history_size=7 halt_on_errors=1" $(UNIT_RACE ) -tags= " $( RPC_TAGS ) "
72
107
73
108
itest : itest-run
74
109
0 commit comments