I am using node-gyp
to create a Node.js addon and my binding.gyp
contains some variables as follows:
...
"link_settings": {
"libraries": [
"-lboost_program_options",
"-lboost_log",
],
"ldflags": [
"-L<@(boost_root)/stage/lib",
"-Wl,-rpath,<@(boost_root)/stage/lib",
]
},
...
(complete gyp file from here ). I use node-gyp configure --boost_root=/PATH/TO/BOOST build
to build the C++
sources. The problem arises when I run npm install
since it just calls node-gyp rebuild
without any parameters.
Is there any way to do any of the following?
- Not run
node-gyp
rebuild when runningnpm install
- Pass parameters to
node-gyp
when runningnpm install
After a lenghty discussion with @robertklep, I found out that passing the path as a command line flag also solves the problem:
however as he mentioned it is not known what happens if another package requires my package and tries to pass the parameter to it.UPDATE:
As it turns out this solution can be applied also if another package uses original package:
or if you have installed from directly from the package manager and now want to install it through the depending package: