building.md: Add instructions for cpack
[contrib/mraa.git] / docs / npm.md
index bdced1d..defe7ec 100644 (file)
@@ -15,11 +15,11 @@ we have generated for you.
 Recreating tarball
 ------------------
 
-From a checkout of mraa you can do the following to 'generate' this tarball.
-It's important to not leave a .git directory as npm will then consider the
-tarball contains a full git tree. Also you need a top level dir which matches
-the npm pkg name so we create one with a symlink and add the 'h' flag to tar to
-follow simlinks.
+You can run the following commands to 'generate' this tarball from a checkout
+of mraa.  It's important to not leave a .git directory as npm will then
+consider the tarball contains a full git tree. You also you need a top level
+dir which matches the npm pkg name so we create one with a symlink and add the
+'h' flag to tar to follow symlinks.
 
 ~~~~~~~~~~~~~{.sh}
 mkdir build
@@ -29,3 +29,21 @@ make npmpkg
 ln -s ../ mraa
 tar hczv --exclude='build*' --exclude='.gitignore' --exclude='.git' --exclude='build*/*' --exclude='.git/*' -f mraa.tar.gz mraa
 ~~~~~~~~~~~~~
+
+Building with node-gyp
+----------------------
+
+You can build with node-gyp using the binding.gyp file, obviously this requires
+either the prebuilt tarball from npm or to do the above to generate it with the
+npmpkg target. Note the --target='' flag will not work since binding.gyp will
+do a check for the running node v8 version, you'll also need to run that
+version (or close to) in your $PATH.
+
+~~~~~~~~~~~{.sh}
+node-gyp configure --python=/usr/bin/python2
+node-gyp build --python=/usr/bin/python2 --verbose
+~~~~~~~~~~~
+
+Note that no cross compilation is available without modifying the --arch flag
+manually. If you want to cross compile, it's recommended to use cmake.
+