Permalink
Browse files

Converted to using gyp as build tool, locked to 0.6.X or higher

  • Loading branch information...
1 parent ccb70f4 commit 25829d25360e6742ddf264eea6ce378a7064f346 @christkv christkv committed Aug 27, 2012
Showing with 33 additions and 29 deletions.
  1. +6 −20 Makefile
  2. +1 −0 Readme.md
  3. +17 −0 binding.gyp
  4. +2 −2 ext/bson.cc
  5. +2 −2 ext/index.js
  6. +3 −3 install.js
  7. +2 −2 package.json
View
@@ -1,31 +1,17 @@
NODE = node
NPM = npm
NODEUNIT = node_modules/nodeunit/bin/nodeunit
-name = all
-total: build_native
+all: clean node_gyp
-test: build_native
+test: clean node_gyp
$(NODEUNIT) ./test/node
TEST_NATIVE=TRUE $(NODEUNIT) ./test/node
-build_native:
- $(MAKE) -C ./ext all
-
-build_native_debug:
- $(MAKE) -C ./ext all_debug
-
-build_native_clang:
- $(MAKE) -C ./ext clang
-
-build_native_clang_debug:
- $(MAKE) -C ./ext clang_debug
-
-clean_native:
- $(MAKE) -C ./ext clean
+node_gyp: clean
+ node-gyp configure build
clean:
- rm ./ext/bson.node
- rm -r ./ext/build
+ node-gyp clean
-.PHONY: total
+.PHONY: all
View
@@ -0,0 +1 @@
+A JS/C++ Bson parser for node, used in the MongoDB Native driver
View
@@ -0,0 +1,17 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'bson',
+ 'sources': [ 'ext/bson.cc' ],
+ 'cflags!': [ '-fno-exceptions' ],
+ 'cflags_cc!': [ '-fno-exceptions' ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'xcode_settings': {
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
+ }
+ }]
+ ]
+ }
+ ]
+}
View
@@ -477,7 +477,7 @@ Handle<Value> BSONDeserializer::DeserializeValue(BsonType type)
case BSON_TYPE_CODE_W_SCOPE:
{
- uint32_t length = ReadUInt32();
+ ReadUInt32();
const Local<Value>& code = ReadString();
const Handle<Value>& scope = DeserializeDocument();
Local<Value> argv[] = { code, scope->ToObject() };
@@ -770,7 +770,7 @@ Handle<Value> BSON::BSONDeserialize(const Arguments &args)
// Let's define the buffer size
char* data = (char *)malloc(len);
- ssize_t written = DecodeWrite(data, len, args[0], BINARY);
+ DecodeWrite(data, len, args[0], BINARY);
try
{
View
@@ -1,4 +1,4 @@
-var bson = require('./bson');
+var bson = require('../build/Release/bson');
exports.BSON = bson.BSON;
exports.Long = require('../lib/bson/long').Long;
exports.ObjectID = require('../lib/bson/objectid').ObjectID;
@@ -17,4 +17,4 @@ exports.BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1;
exports.BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;
exports.BSON.BSON_BINARY_SUBTYPE_UUID = 3;
exports.BSON.BSON_BINARY_SUBTYPE_MD5 = 4;
-exports.BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
+exports.BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
View
@@ -19,9 +19,9 @@ if(build_native) {
var make = null;
// No gmake build using make
if(err != null) {
- make = spawn('make', ['total'], {cwd:process.env['PWD']});
+ make = spawn('make', ['node_gyp'], {cwd:process.env['PWD']});
} else {
- make = spawn('gmake', ['total'], {cwd:process.env['PWD']});
+ make = spawn('gmake', ['node_gyp'], {cwd:process.env['PWD']});
}
// Execute spawn
@@ -36,6 +36,6 @@ if(build_native) {
make.on('exit', function(code) {
process.stdout.write('child process exited with code ' + code + "\n");
})
- });
+ });
}
View
@@ -1,7 +1,7 @@
{ "name" : "bson"
, "description" : "A bson parser for node.js and the browser"
, "keywords" : ["mongodb", "bson", "parser"]
-, "version" : "0.1.1"
+, "version" : "0.1.2"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"
, "contributors" : []
@@ -16,7 +16,7 @@
, "config": { "native" : false }
, "main": "./lib/bson/index"
, "directories" : { "lib" : "./lib/bson" }
-, "engines" : { "node" : ">=0.4.0" }
+, "engines" : { "node" : ">=0.6.0" }
, "scripts": { "install" : "node install.js", "test" : "make test" }
, "licenses" : [ { "type" : "Apache License, Version 2.0"
, "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ]

0 comments on commit 25829d2

Please sign in to comment.