-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial gyp.js support #962
Conversation
Can you explain why the need for all the Windows changes in here? Without a solid test suite and the lack of Windows expertise around here this PR is likely going to be very difficult to land given how heavy-handed it is with those changes. |
Ah, I see #951, I'm guessing that what it's all about? you should open one PR per concern to increase the likelihood of getting changes in, if gyp.js doesn't have any reason to depend on the node.lib location changes then they don't belong together in a PR. |
On Windows I wonder, is anybody use As I understand I also added a Other changes are just README update and branches in
|
…ndows Using `target_arch` in addon.gypi to link against Node.js library. This variable was written into build/config.gypi on the `configure` stage. Do not copy node.lib into node_root_dir/Release or node_root_dir/Debug on Windows, link it from node_root_dir/target_arch directory. Removed unused copyNodeLib() function Removed unused `copy_dev_lib` variable introduced in commit @84d24189735e19350a93aaf9f6a327bb4c52349e
$ node-gyp configure --gypjs | ||
``` | ||
|
||
It is also possible to set `npm_config_gypjs` environment variable to turn on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest all-capitals env var name: NPM_CONFIG_GYPJS
, or do we use lower-case now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment variables named with prefix npm_config_
are mapped to gyp.opts
object. Thus, npm_config_gypjs
variable will set gyp.opts.gypjs
that used later. As I know an environment variable names are case-sensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. My bad then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though, they are case sensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this after #1185
Set path to node lib in `$(Configuration)` dir when `--nodedir` option is supplied, otherwise use value of `target_arch` variable.
Is there anything left before we can move forward on this? cc @rvagg |
@@ -92,7 +92,7 @@ | |||
'-luuid.lib', | |||
'-lodbc32.lib', | |||
'-lDelayImp.lib', | |||
'-l"<(node_root_dir)/$(ConfigurationName)/<(node_lib_file)"' | |||
'-l"<(node_lib_file)"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(ConfigurationName) is a MSBuild macro unknown for Ninja. So I changed it to target_arch
variable. But this won't work with --nodedir
option on Windows. As a result node_lib_file
contains full path to the node.lib now.
See comments in PR #964. Actually that request should be merged before this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record #964 landed
Update from me: |
Ahem, ping? |
Let's do some @pmed can you rebase this off master and squash it down to just the essential commits (or just one commit if that makes sense), it doesn't apply neatly to the current master. |
right, just leave that one out of the squash and we'll deal with it separately |
See issue nodejs#960 Added initial `gyp.js` support with --gypjs command line option. Environment variable `npm_config_gypjs` also turns this option on. Update configure and build usage strings depending on `npm_config_gypjs` environment variable. Set `npm_config_gypjs` env variable if `--gypjs` command-line option was set to affect usage text for `configure` and `build` commands. Update usage strings if `--gypjs` command-line option was supplied Trying to load gyp.js module only if --gypjs command-line option was supplied.
ping @rvagg |
implementation in JavaScript. It generates [`Ninja`](https://ninja-build.org/) | ||
build files and requires no Python installation. | ||
|
||
In this case you will need to install [`Ninja`](https://ninja-build.org/) build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmed this is no longer the case. I would say "For fast and incremental builds ninja
build too should be installed, otherwise a default JavaScript shim will be used to build your addon".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though, node-gyp
will probably need to be modified to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or alternatively npm install -g ninja.js
may be recommended, if binary is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be a blocker for this PR, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a fallback to ninja.js
in doWhich()
checks, when ninja was not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using ninja.js directly instead?
El 2/8/2016 11:22, "Pavel Medvedev" [email protected] escribió:
In README.md
#962 (comment):@@ -106,6 +106,37 @@ you can require the
.node
file with Node and run your tests!
Note: To create a Debug build of the bindings file, pass the--debug
(or
-d
) switch when running either theconfigure
,build
orrebuild
command.+#### Usage without Python
+
+There is agyp.js
project, a GYP
+implementation in JavaScript. It generatesNinja
+build files and requires no Python installation.
+
+In this case you will need to installNinja
buildThere should be a fallback to ninja.js in doWhich() checks, when ninja
was not found.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node-gyp/pull/962/files/1e8a221ef69573949fc288102f1ba4bb7d048a7e#r73122036,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAgfvjh510_d3fOgLcPJXTY51EP1ACYgks5qbww6gaJpZM4I5EHk
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current status of ninja.js
is "work-in-progress", and I've never tried it. Maybe later, in next PR after @indutny will release ninja.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it in next PR indeed. ninja.js
is kind of working, but we don't want to delay this thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW I don't know how to spawn ninja.js
as a command-line utility in cross-platfrom way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry too much about it. I'll send a PR once this will land.
@rvagg ping |
any update? |
Hello everyone! I'd like to ping @nodejs/addon-api and @nodejs/node-gyp . Let's get this one resolved. |
I'd love to see this go in! |
any update? This is a great idea, why progress so slow |
@bnoordhuis anything I/someone can do to see this land? Asking you since you're generally the goto |
In all honesty, I like the concept of gyp.js but it's not going to be a drop-in replacement anytime soon and I don't really see the point of merging it into node-gyp. |
@bnoordhuis the point of merging it under the flag is to bring it to the point where it is going to be a drop-in replacement. Right now, as far we are aware gyp.js works pretty good on all of the addons that we tested. Having this flag will allow us to fix remaining bugs (if there are any), and move forward. That being said, I don't see any downside of having potentially good functionality under a flag. |
Perhaps we can document it as "not supported"/"don't depend on it", meaning we can drop it at any release? |
I agree, this totally makes sense. @bnoordhuis care to take another look at this? cc @rvagg too |
Can you sell me on it? The reason it's not a drop-in replacement is that gyp allows arbitrary python expressions (and people use that) while gyp.js does not and probably never will. Also, ninja instead of make. |
@bnoordhuis there is naive What particular python expressions are you referring to? It does support logical expressions, comparisons, and quite a lot other things that are supported too: https://github.com/indutny/gyp.js/blob/master/test/py-compile-condition-test.js . This could be extended very easily to make it support most of the common use cases. The selling points:
|
In terms of logic; I feel we should not aim for "full" compatibility (whatever that means). I don't think we need to treat |
Even with this target in mind, we still can make some of the edge-cases work with gyp.js . It should be pretty easy |
Okay, that speaks in gyp.js's favor. :-) |
@bnoordhuis Mmm.. supporting that expression doesn't seem to be really painful, we kind of support half of it already. |
@bnoordhuis though, I'm sure that it may be simplified to something that is already supported, or just expanded in terms of supported expressions. |
In any case, this PR will need to be rebased. |
Yet another selling point for |
@pmed are you interested with moving this forward? I'd be happy to help. |
Superseded by #1092 |
Added a command-line switch
--gypjs
to use https://github.com/indutny/gyp.js instead of gyp.Removed copyNodeLib() on Windows in favor to use
target_arch
variable from generated configuration filebuild/config.gypi
Fixes: #960