• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1mraa NPM pkg                        {#npmpkg}
2============
3
4What you are looking at is a tarball made after 'make npmpkg' has been run on
5our build system. It contains a few prebuilt files in order to build easily
6with node-gyp on most systems. Note that this is not the preffered way of
7building libmraa and if you'd like to contribute, please learn how the build
8system works and get your sources from git.
9
10Any patches for mraajsJAVASCRIPT_wrap.cxx or version.c will be ignored as these
11are automatically generated files. When you execute a build from node-gyp/npm
12you do not generate the mraajsJAVASCRIPT_wrap.cxx file but rather use one that
13we have generated for you.
14
15Recreating tarball
16------------------
17
18You can run the following commands to 'generate' this tarball from a checkout
19of mraa.  It's important to not leave a .git directory as npm will then
20consider the tarball contains a full git tree. You also you need a top level
21dir which matches the npm pkg name so we create one with a symlink and add the
22'h' flag to tar to follow symlinks.
23
24~~~~~~~~~~~~~{.sh}
25mkdir build
26cd build
27cmake -DBUILDSWIGNODE=ON  ..
28make npmpkg
29ln -s ../ mraa
30tar hczv --exclude='build*' --exclude='.gitignore' --exclude='.git' --exclude='build*/*' --exclude='.git/*' -f mraa.tar.gz mraa
31~~~~~~~~~~~~~
32
33Building with node-gyp
34----------------------
35
36You can build with node-gyp using the binding.gyp file, obviously this requires
37either the prebuilt tarball from npm or to do the above to generate it with the
38npmpkg target. Note the --target='' flag will not work since binding.gyp will
39do a check for the running node v8 version, you'll also need to run that
40version (or close to) in your $PATH.
41
42~~~~~~~~~~~{.sh}
43node-gyp configure --python=/usr/bin/python2
44node-gyp build --python=/usr/bin/python2 --verbose
45~~~~~~~~~~~
46
47Note that no cross compilation is available without modifying the --arch flag
48manually. If you want to cross compile, it's recommended to use cmake.
49
50