-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for single-level module_path when packing (#371)
* Allow for single-level module_path when packing Prior to 0.7.1, a module_path of `./lib` would result in a package containing files like this (using `test/app8` as an example): lib/app8.node The switch to tar 3 in 0.7.1 causes the same package to end up like this: package.json app8.cc binding.gyp index.js README.md lib/app8.node which causes a problem during remote binary installation: node-pre-gyp ERR! Pre-built binaries not installable for PACKAGE@0.0.1 and node@8.3.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp) node-pre-gyp ERR! Hit error ENOTDIR: Cannot cd into '..dirs/package/lib' This commit fixes this problem and allows for single-level module_path values. * Compare apples to apples But don't compare Linux to Apple. * Use a platform-specific dynamic object extension This should work everywhere except AIX. * Fix Win32 file expectations This is based on what showed up during an Appveyor run. Someone with more Win32 module building experience should verify that these are expected and correct.
- Loading branch information
Showing
8 changed files
with
232 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
build/ | ||
lib/ | ||
node_modules | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Test app | ||
|
||
Demonstrates a simpler configuration that uses node-pre-gyp. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// v8 | ||
#include <v8.h> | ||
|
||
// node.js | ||
#include <node.h> | ||
#include <node_version.h> | ||
|
||
#if (NODE_MODULE_VERSION > 0x000B) | ||
|
||
static void get_hello(const v8::FunctionCallbackInfo<v8::Value>& args) | ||
{ | ||
v8::HandleScope scope(v8::Isolate::GetCurrent()); | ||
args.GetReturnValue().Set(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),"hello")); | ||
} | ||
|
||
#else | ||
|
||
static v8::Handle<v8::Value> get_hello(const v8::Arguments& args) | ||
{ | ||
v8::HandleScope scope; | ||
return scope.Close(v8::String::New("hello")); | ||
} | ||
|
||
#endif | ||
|
||
extern "C" { | ||
static void start(v8::Handle<v8::Object> target) { | ||
#if (NODE_MODULE_VERSION > 0x000B) | ||
v8::HandleScope scope(v8::Isolate::GetCurrent()); | ||
#else | ||
v8::HandleScope scope; | ||
#endif | ||
NODE_SET_METHOD(target, "hello", get_hello); | ||
} | ||
} | ||
|
||
NODE_MODULE(app8, start) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "<(module_name)", | ||
"sources": [ "<(module_name).cc" ], | ||
"product_dir": "<(module_path)", | ||
"xcode_settings": { | ||
"MACOSX_DEPLOYMENT_TARGET":"10.9", | ||
"CLANG_CXX_LIBRARY": "libc++" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var binary = require('node-pre-gyp'); | ||
var path = require('path') | ||
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); | ||
var binding = require(binding_path); | ||
|
||
require('assert').equal(binding.hello(),"hello"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "node-pre-gyp-test-app8", | ||
"author": "Dane Springmeyer <springmeyer>", | ||
"description": "node-pre-gyp test", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mapbox/node-pre-gyp.git" | ||
}, | ||
"license": "BSD-3-Clause", | ||
"version": "0.1.0", | ||
"main": "./index.js", | ||
"binary": { | ||
"module_name": "app8", | ||
"module_path": "./lib", | ||
"host": "https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com" | ||
}, | ||
"scripts": { | ||
"install": "node-pre-gyp install --fallback-to-build", | ||
"test": "node index.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters