github.com/decred/dcrlnd@v0.7.6/mobile/README.md (about)

     1  # UNSUPPORTED IN DCRLND
     2  
     3  This is currently unsupported in Decred's port of lnd (dcrlnd) due to missing
     4  support for SPV.
     5  
     6  ## Building mobile libraries
     7  
     8  ### Prerequisites
     9  #### protoc
    10  Install the dependencies for generating protobuf definitions as stated in
    11  [lnrpc docs]( ../lnrpc/README.md#generate-protobuf-definitions)
    12  
    13  #### gomobile
    14  Follow [gomobile](https://github.com/golang/go/wiki/Mobile) in order to install
    15  `gomobile` and dependencies.
    16  
    17  Remember to run `gomobile init` (otherwise the `lnd` build might just hang).
    18  
    19  Note that `gomobile` only supports building projects from `GOPATH` at this
    20  point.
    21  
    22  #### falafel
    23  Install [`falafel`](https://github.com/lightninglabs/falafel):
    24  ```
    25  go get -u -v github.com/lightninglabs/falafel
    26  ```
    27  
    28  ### Building `lnd` for iOS
    29  ```
    30  make ios
    31  ```
    32  
    33  ### Building `lnd` for Android
    34  ```
    35  make android
    36  ```
    37  
    38  `make mobile` will build both iOS and Android libs.
    39  
    40  ### Libraries
    41  After the build has succeeded, the libraries will be found in
    42  `mobile/build/ios/Lndmobile.framework` and
    43  `mobile/build/android/Lndmobile.aar`. Reference your platforms' SDK
    44  documentation for how to add the library to your project.
    45  
    46  #### Generating proto definitions for your language.
    47  In order to call the methods in the generated library, the serialized proto for
    48  the given RPC call must be provided. Similarly, the response will be a
    49  serialized proto.
    50  
    51  ##### iOS
    52  
    53  In order to generate protobuf definitions for iOS, add `--swift_out=.` to the
    54  first `protoc` invocation found in [`gen_protos.sh`](../lnrpc/gen_protos.sh).
    55  
    56  Then, some changes to [Dockerfile]((../lnrpc/Dockerfile)) need to be done in
    57  order to use the [Swift protobuf](https://github.com/apple/swift-protobuf)
    58  plugin with protoc:
    59  
    60  1. Replace the base image with `FROM swift:focal` so that Swift can be used.
    61  2. `clang-format='1:7.0*'` is unavailable in Ubuntu Focal. Change that to
    62  `clang-format='1:10.0*`.
    63  3. On the next line, install Go and set the environment variables by adding the
    64  following commands:
    65  
    66  ```
    67  RUN apt-get install -y wget \
    68      && wget -c https://golang.org/dl/go1.17.2.linux-amd64.tar.gz -O - \
    69      | tar -xz -C /usr/local
    70  ENV GOPATH=/go
    71  ENV PATH=$PATH:/usr/local/go/bin:/go/bin
    72  ```
    73  
    74  4. At the end of the file, just above `CMD`, add the following `RUN` command.
    75  This will download and compile the latest tagged release of Swift protobuf.
    76  
    77  ```
    78  RUN git clone https://github.com/apple/swift-protobuf.git \
    79  && cd swift-protobuf \ 
    80  && git checkout $(git describe --tags --abbrev=0) \
    81  && swift build -c release \
    82  && mv .build/release/protoc-gen-swift /bin
    83  ```
    84  
    85  Finally, run `make rpc`.
    86  
    87  ##### Android
    88  
    89  In order to generate protobuf definitions for Android, add `--java_out=.`
    90  to the first `protoc` invocation found in
    91  [`gen_protos.sh`](../lnrpc/gen_protos.sh). Then, run `make rpc`.
    92  
    93  ### Options
    94  Similar to lnd, subservers can be conditionally compiled with the build by
    95  setting the tags argument:
    96  
    97  ```
    98  make ios
    99  ```
   100  
   101  To support subservers that have APIs with name conflicts, pass the "prefix"
   102  flag. This will add the subserver name as a prefix to each method name:
   103  
   104  ```
   105  make ios
   106  ```
   107  
   108  ### API docs
   109  TODO(halseth)