From 2b82eafff4ebe9692b0ceb0e918ad47b2e22d6c3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Feb 2014 18:51:57 +0800 Subject: [PATCH] :memo: Update docs on using native modules. --- docs/README.md | 2 +- docs/development/build-instructions-linux.md | 2 +- ...ative-modules.md => use-native-modules.md} | 25 +++++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) rename docs/{build-native-modules.md => use-native-modules.md} (63%) diff --git a/docs/README.md b/docs/README.md index 60ac64d9c54a..671e1fd4bcfd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,7 +3,7 @@ ## Guides * [Quick start](quick-start.md) -* [Build native modules](build-native-modules.md) +* [Use native modules](use-native-modules.md) ## Development diff --git a/docs/development/build-instructions-linux.md b/docs/development/build-instructions-linux.md index 73d7a0723f4d..9556b56acb54 100644 --- a/docs/development/build-instructions-linux.md +++ b/docs/development/build-instructions-linux.md @@ -54,7 +54,7 @@ Then you need to install `gcc-multilib` and `g++-multilib`, on Ubuntu you can do this: ```bash -sudo apt-get install gcc-multilib g++-multilib +$ sudo apt-get install gcc-multilib g++-multilib ``` ## Tests diff --git a/docs/build-native-modules.md b/docs/use-native-modules.md similarity index 63% rename from docs/build-native-modules.md rename to docs/use-native-modules.md index feb5514c8255..ae7481183d51 100644 --- a/docs/build-native-modules.md +++ b/docs/use-native-modules.md @@ -1,15 +1,24 @@ -# Build native modules +# Use native modules Since atom-shell is using a different V8 version from the official node, you need to build native module against atom-shell's headers to use them. -You need to use node-gyp to compile native modules, you can install node-gyp -via npm if you hadn't: +The [apm](https://github.com/atom/apm) provided a easy way to do this, after +installing it you could use it to install dependencies just like using `npm`: ```bash -$ npm install -g node-gyp +$ cd /path/to/atom-shell/project/ +$ apm install . ``` +But you should notice that `apm install module` wont' work because it will +install a user package for [Atom](https://github.com/atom/atom) instead. + +Apart from `apm`, you can also use `node-gyp` and `npm` to manually build the +native modules. + +## The node-gyp way + First you need to check which node release atom-shell is carrying via `process.version` (at the time of writing it is v0.10.5), then you can configure and build native modules via following commands: @@ -23,13 +32,7 @@ The `HOME=~/.atom-shell-gyp` changes where to find development headers. The `--target=0.10.5` is specifying node's version. The `--dist-url=...` specifies where to download the headers. -## Use npm to build native modules - -Under most circumstances you would want to use npm to install modules, if -you're using npm >= v1.2.19 (because [a -patch](https://github.com/TooTallNate/node-gyp/commit/afbcdea1ffd25c02bc88d119b10337852c44d400) -is needed to make `npm_config_disturl` work) you can use following code to -download and build native modules against atom-shell's headers: +## The npm way ```bash export npm_config_disturl=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist