Skip to content
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

Provide node-sqlite3 builds for node-webkit #251

Closed
Mithgol opened this issue Feb 6, 2014 · 20 comments
Closed

Provide node-sqlite3 builds for node-webkit #251

Mithgol opened this issue Feb 6, 2014 · 20 comments

Comments

@Mithgol
Copy link
Contributor

Mithgol commented Feb 6, 2014

After the (low priority) improvement mapbox/node-pre-gyp#14 lands, please consider providing node-sqlite3 pre-built for node-webkit (i.e. built with nw-gyp), at least for Windows where the build tools seem the most huge.

@springmeyer
Copy link
Contributor

I am unlikely to get to this without help. A big contribution would be helping to script the creation of binaries for linux on travis. That could be tested before mapbox/node-pre-gyp#14 lands and would help reveal how feasible this would be. Would you be able to do that? Just fork node-sqlite3 and try tweaking the .travis.yml to include a matrix for different node-webkit versions, download the right stuff, build, and run node-pre-gyp package testpackage. testpackage likely will not work without node-pre-gyp tweaks but the rest should.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Would you be able to do that?

It's possible, but not before I learn UN*X shell scripting — I'd have to know how if works, when export becomes necessary, why NVER variable is defined in addition to the above NODE_VERSION; things like those.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Ah, NVER is defined to contain the entire node -v output (while NODE_VERSION contains just major version, dot, minor version). Okay.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Okay, I've read and understood a bit of Apple's “Shell Scripting Primer” and thus I seem to know enough about export and if to understand the rest.

I've opened a pull request from my fork (#252) but I have yet to learn how node-pre-gyp package testpackage works and what it requires (in addition to node-pre-gyp itself) and thus it's not added to my fork's .travis.yml yet.

The rest seems fine: nw-gyp is installed and rebuilds node-sqlite3 for the 32bit node-webkit.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Okay, done.

As you have foreseen, node-pre-gyp package testpackage fails. It says the following:

Error: WARNING: ./lib/binding/ already exists and will be overwritten: pass --overwrite to confirm

I guess it's better to fail before mapbox/node-pre-gyp#14 is fixed; it needs node-webkit (or something similar) is the package's filename instead of node, otherwise --overwrite would be a disaster.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Basically, get_node_abi() needs a change to use node-webkit's version (instead of Node's) where necessary.

But before that node-pre-gyp has to get the desired node-webkit's version from the command line (probably in --target= form, similar to how nw-gyp takes it). In building mode node-pre-gyp would install (or expect) nw-gyp and run it if such version is provided.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

Alternatively it's possible to install the node-webkit-builds module and use it as a source of the latest version number of node-webkit.

(Some switch for node-pre-gyp would still be necessary to make it known that a node-webkit's version of some addon is built instead of Node's.)

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 6, 2014

On the other hand, a check for process.versions.modules is important.

I've requested a pull (IndigoUnited/node-webkit-builds#1) to make such a check possible in the future.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 12, 2014

@springmeyer ping

@springmeyer
Copy link
Contributor

@Mithgol - thanks for the ping. Just looking over your work and efforts. Amazing job, thank you. Here are some comments:

  • travis.yml additions look great. You've worked with travis single line restriction nicely. I think long term it will be better to move everything into scripts to be more readible, but this looks good for now.
  • --overwrite is needed unless you call node-pre-gyp clean before hand. No problem overwriting in this case. This need is perhaps a flaw in node-pre-gyp - will give this more thought.
  • Correct: get_node_abi() needs to somehow be sensitive to node-webkit and instead of hardcoding node-v perhaps using nw-v. How about node-pre-gyp handles --target=nw? You would need to pass it for every node-pre-gyp command.
  • process.versions.modules is critical - I'm unclear how it related to node-webkit vs the "node-webkit-builds". Can you share more details here?

@springmeyer
Copy link
Contributor

Realizing --target is respected by both nw-gyp and node-gyp to refer to the version of node or node-webkit... so we need some other option to tell node-pre-gyp to know its building for node-webkit.

@springmeyer
Copy link
Contributor

Okay, progress on mapbox/node-pre-gyp#14. think this is basically working with the caveat that process.versions.modules is still the node one and not node-webkit. See usage at https://github.com/springmeyer/node-pre-gyp/blob/master/test-node-webkit.sh

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 13, 2014

Realizing --target is respected by both nw-gyp and node-gyp to refer to the version of node or node-webkit... so we need some other option to tell node-pre-gyp to know its building for node-webkit.

Wow, I was not aware that node-gyp also supports --target. Now I understand that another option (such as --runtime in your mapbox/node-pre-gyp@370024a) was necessary.

process.versions.modules is critical - I'm unclear how it related to node-webkit vs the "node-webkit-builds". Can you share more details here?

I have to admit I was under a false impression and that made me think process.versions.modules was more important (for node-webkit) than I should have thought.

Basically, process.versions.modules on Node.js makes it possible to know if the next Node's version is compatible (in ABI sense) with modules built for the previous version.

On the other hand, as I should have remembered, it's safer to assume that node-webkit's ABI changes in every version (or at least changes more frequently than the value of process.versions.modules). That's why only process.versions['node-webkit'] is important on that platform.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 13, 2014

I've added a couple of commits to #252, but they seem to fail because of mapbox/node-pre-gyp#35.

@springmeyer
Copy link
Contributor

Okay, thanks for the details on versioning. I was able to assemble a crosswalk between nw version and node version to be able to look up the modules abi version. But yeah, I guess if that is not enough of a promise for node-WebKit then just using the major.minor.patch might be best. We will see.

@springmeyer
Copy link
Contributor

#252 is now merged. We are still not providing binaries, but are close to being able to. @Mithgol can you please create new issue(s) for the remaining work you see that is needed to get this working?

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 26, 2014

Created mapbox/node-pre-gyp#39 right now.

I am also going to create an issue for Windows building&testing&publishing of node-sqlite3 for Node.js and node-webkit.

Other then this couple of issues… no major obstacles. Unless I have forgotten something.

@Mithgol
Copy link
Contributor Author

Mithgol commented Feb 26, 2014

Created #261.

@Mithgol
Copy link
Contributor Author

Mithgol commented Mar 16, 2014

Since mapbox/node-pre-gyp#39 is closed (≈2 days ago), only #261 remains.

@springmeyer
Copy link
Contributor

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants