-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild_iOS.sh
67 lines (51 loc) · 1.73 KB
/
build_iOS.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
cd "`dirname \"$0\"`"
export REPOROOT=$(pwd)
export GOPATH=$REPOROOT/.build
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH
set -v
go version
mkdir -p $GOPATH
go get -v github.com/lightninglabs/falafel
go get -v golang.org/x/tools/cmd/goimports
go get -v golang.org/x/tools/go/packages
go get -v golang.org/x/mobile/cmd/gomobile
go get -d -v github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
go get -d -v github.com/lightningnetwork/lnd
# install grpc
curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
unzip protoc-3.4.0-osx-x86_64.zip -d protoc
export PATH=$PWD/protoc/bin:$PATH
# install protoc-gen-swift and protoc-gen-swiftgrpc
git clone https://github.com/grpc/grpc-swift.git
cd grpc-swift
make plugin
cd $REPOROOT
export PATH=$PWD/grpc-swift:$PATH
# install protoc-gen-zap
git clone https://github.com/LN-Zap/protoc-gen-zap.git
cd protoc-gen-zap
make
cd $REPOROOT
export PATH=$PWD/protoc-gen-zap:$PATH
# lnd
gomobile init
cd $GOPATH/src/github.com/lightningnetwork/lnd
git checkout v0.9.0-beta
git apply $REPOROOT/patches/user_agent_name.patch
git apply $REPOROOT/patches/user_agent_version.patch
make GOPATH=$GOPATH IOS_BUILD_DIR=$REPOROOT ios
cd $REPOROOT
zip --symlinks -r Lndmobile.framework.zip Lndmobile.framework
# Generate the protos.
mkdir generated
OUT=generated
protoc -I/usr/local/include -I.\
-I$GOPATH/src/github.com/lightningnetwork/lnd/lnrpc \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--swift_out=$OUT \
--zap_out=$OUT \
--swiftgrpc_out=Sync=false,Server=false:$OUT \
$GOPATH/src/github.com/lightningnetwork/lnd/lnrpc/rpc.proto
zip -j -r Lndmobile-swift-generated.zip generated