From 971ddc617ae8b801819f1aaa54e5b31006ebb2cd Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 13 Sep 2018 11:31:03 -0700 Subject: [PATCH] Native: fix build instructions to account for move to new repo --- packages/grpc-native-core/README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/grpc-native-core/README.md b/packages/grpc-native-core/README.md index 9b605e25..1dd78c8c 100644 --- a/packages/grpc-native-core/README.md +++ b/packages/grpc-native-core/README.md @@ -14,6 +14,16 @@ Install the gRPC NPM package npm install grpc ``` +## BUILD FROM SOURCE + +The following command can be used to build from source when installing the package from npm: + +``` +npm install grpc --build-from-source +``` + +The `--build-from-source` option will work even when installing another package that depends on `grpc`. To build only `grpc` from source, you can use the argument `--build-from-source=grpc`. + ## ABOUT ELECTRON The official electron documentation recommends to [build all of your native packages from source](https://electronjs.org/docs/tutorial/using-native-node-modules#modules-that-rely-on-node-pre-gyp). While the reasons behind this are technically good - many native extensions won't be packaged to work properly with electron - the gRPC source code is fairly difficult to build from source due to its complex nature, and we're also providing working electron pre-built binaries. Therefore, we recommend that you do not follow this model for using gRPC with electron. Also, for the same reason, `electron-rebuild` will always build from source. We advise you to not use this tool if you are depending on gRPC. Please note that there's not just one way to get native extensions running in electron, and that there's never any silver bullet for anything. The following instructions try to cater about some of the most generic ways, but different edge cases might require different methodologies. @@ -34,9 +44,12 @@ npm rebuild --build-from-source=sqlite3 --target=2.0.0 --runtime=electron --dist This way, if you depend on both `grpc` and `sqlite3`, only the `sqlite3` package will be rebuilt from source, leaving the `grpc` package to use its precompiled binaries. -## BUILD FROM SOURCE - 1. Clone [the grpc Git Repository](https://github.com/grpc/grpc). - 2. Run `npm install --build-from-source` from the repository root. +## BUILD IN GIT REPOSITORY + + 1. Clone [the grpc-node Git Repository](https://github.com/grpc/grpc-node). + 2. Run `git submodule update --init --recursive` from the repository root. + 3. Run `cd packages/grpc-native-core`. + 4. Run `npm install --build-from-source`. - **Note:** On Windows, this might fail due to [nodejs issue #4932](https://github.com/nodejs/node/issues/4932) in which case, you will see something like the following in `npm install`'s output (towards the very beginning):