Skip to content

Instantly share code, notes, and snippets.

@konobi
Created March 26, 2016 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konobi/472cee240cc6743a068b to your computer and use it in GitHub Desktop.
Save konobi/472cee240cc6743a068b to your computer and use it in GitHub Desktop.
diff --git a/c2d.gyp b/c2d.gyp
index 0c2bdbb..38f4797 100644
--- a/c2d.gyp
+++ b/c2d.gyp
@@ -29,5 +29,18 @@
],
}],
],
- }],
+ },
+ {
+ "target_name": "copy_binary",
+ "type":"none",
+ "dependencies" : [ "core2dump" ],
+ "copies":
+ [
+ {
+ 'destination': '<(module_root_dir)/bin/',
+ 'files': ['<(module_root_dir)/build/Release/core2dump']
+ }
+ ]
+ }
+ ],
}
diff --git a/npm/locate.js b/npm/locate.js
deleted file mode 100644
index aac82e9..0000000
--- a/npm/locate.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Locate result of the build
-
-var fs = require('fs');
-var path = require('path');
-
-var paths = [
- ['build'],
- ['build', 'Release'],
- ['build', 'Debug'],
- ['out', 'Release'],
- ['out', 'Debug'],
- ['build', 'default']
-];
-
-var exenames = [ 'core2dump', 'core2dump.exe' ];
-
-var root = path.resolve(__dirname, '..');
-
-for (var i = 0; i < paths.length; i++) {
- for (var j = 0; j < exenames.length; j++) {
- var exename = exenames[j];
- var filename = path.resolve.apply(path, [root].concat(paths[i], exename));
-
- try {
- fs.statSync(filename);
- } catch(e) {
- continue;
- }
-
- var out = path.resolve(root, 'npm', exename);
- console.error('Found binary %s', filename);
- try {
- fs.unlinkSync(out);
- } catch (e) {
- }
- console.error('Linking binary %s to %s', filename, out);
- try {
- fs.symlinkSync(filename, out);
- } catch (e) {
- // Ignore errors
- }
- process.exit(0);
- }
-}
-
-console.error('Build result not found');
-process.exit(1);
diff --git a/package.json b/package.json
index 5744bc1..d90b789 100644
--- a/package.json
+++ b/package.json
@@ -3,11 +3,10 @@
"version": "0.3.1",
"description": "Core 2 Dump",
"bin": {
- "core2dump": "npm/core2dump"
+ "core2dump": "bin/core2dump"
},
"main": "index.js",
"scripts": {
- "preinstall": "node-gyp configure && node-gyp rebuild && node ./npm/locate.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment