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