forked from mongodb/js-bson
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworking build scripts, added package and install.js
- Loading branch information
Showing
4 changed files
with
74 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,27 @@ | ||
NODE = node | ||
NPM = npm | ||
NODEUNIT = node_modules/nodeunit/bin/nodeunit | ||
DOX = node_modules/dox/bin/dox | ||
name = all | ||
|
||
total: build_native | ||
|
||
build_native: | ||
$(MAKE) -C ./external-libs/bson all | ||
$(MAKE) -C ./ext all | ||
|
||
build_native_debug: | ||
$(MAKE) -C ./external-libs/bson all_debug | ||
$(MAKE) -C ./ext all_debug | ||
|
||
build_native_clang: | ||
$(MAKE) -C ./external-libs/bson clang | ||
$(MAKE) -C ./ext clang | ||
|
||
build_native_clang_debug: | ||
$(MAKE) -C ./external-libs/bson clang_debug | ||
$(MAKE) -C ./ext clang_debug | ||
|
||
clean_native: | ||
$(MAKE) -C ./external-libs/bson clean | ||
|
||
test: build_native | ||
@echo "\n == Run All tests minus replicaset tests==" | ||
$(NODE) dev/tools/test_all.js --noreplicaset --boot | ||
|
||
test_junit: build_native | ||
@echo "\n == Run All tests minus replicaset tests==" | ||
$(NODE) dev/tools/test_all.js --junit --noreplicaset | ||
|
||
test_nodeunit_pure: | ||
@echo "\n == Execute Test Suite using Pure JS BSON Parser == " | ||
@$(NODEUNIT) test/ test/gridstore test/bson | ||
|
||
test_js: | ||
@$(NODEUNIT) $(TESTS) | ||
|
||
test_nodeunit_replicaset_pure: | ||
@echo "\n == Execute Test Suite using Pure JS BSON Parser == " | ||
@$(NODEUNIT) test/replicaset | ||
|
||
test_nodeunit_native: | ||
@echo "\n == Execute Test Suite using Native BSON Parser == " | ||
@TEST_NATIVE=TRUE $(NODEUNIT) test/ test/gridstore test/bson | ||
|
||
test_nodeunit_replicaset_native: | ||
@echo "\n == Execute Test Suite using Native BSON Parser == " | ||
@TEST_NATIVE=TRUE $(NODEUNIT) test/replicaset | ||
|
||
test_all: build_native | ||
@echo "\n == Run All tests ==" | ||
$(NODE) dev/tools/test_all.js --boot | ||
|
||
test_all_junit: build_native | ||
@echo "\n == Run All tests ==" | ||
$(NODE) dev/tools/test_all.js --junit --boot | ||
$(MAKE) -C ./ext clean | ||
|
||
clean: | ||
rm ./external-libs/bson/bson.node | ||
rm -r ./external-libs/bson/build | ||
|
||
generate_docs: | ||
$(NODE) dev/tools/build-docs.js | ||
make --directory=./docs/sphinx-docs --file=Makefile html | ||
rm ./ext/bson.node | ||
rm -r ./ext/build | ||
|
||
.PHONY: total |
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,41 @@ | ||
var spawn = require('child_process').spawn, | ||
exec = require('child_process').exec; | ||
|
||
process.stdout.write("================================================================================\n"); | ||
process.stdout.write("= =\n"); | ||
process.stdout.write("= To install with C++ bson parser do <npm install mongodb --mongodb:native> =\n"); | ||
process.stdout.write("= =\n"); | ||
process.stdout.write("================================================================================\n"); | ||
|
||
// Check if we want to build the native code | ||
var build_native = process.env['npm_package_config_native'] != null ? process.env['npm_package_config_native'] : 'false'; | ||
build_native = build_native == 'true' ? true : false; | ||
|
||
// If we are building the native bson extension ensure we use gmake if available | ||
if(build_native) { | ||
// Check if we need to use gmake | ||
exec('which gmake', function(err, stdout, stderr) { | ||
// Set up spawn command | ||
var make = null; | ||
// No gmake build using make | ||
if(err != null) { | ||
make = spawn('make', ['total']); | ||
} else { | ||
make = spawn('gmake', ['total']); | ||
} | ||
|
||
// Execute spawn | ||
make.stdout.on('data', function(data) { | ||
process.stdout.write(data); | ||
}) | ||
|
||
make.stderr.on('data', function(data) { | ||
process.stdout.write(data); | ||
}) | ||
|
||
make.on('exit', function(code) { | ||
process.stdout.write('child process exited with code ' + code + "\n"); | ||
}) | ||
}); | ||
} | ||
|
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,26 @@ | ||
{ "name" : "bson" | ||
, "description" : "A bson parser for node.js and the browser" | ||
, "keywords" : ["mongodb", "bson", "parser"] | ||
, "version" : "0.0.1" | ||
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>" | ||
, "contributors" : [] | ||
|
||
, "repository" : { "type" : "git" | ||
, "url" : "git@github.com:christkv/bson.git" } | ||
, "bugs" : { "mail" : "node-mongodb-native@googlegroups.com" | ||
, "url" : "https://github.com/christkv/bson/issues" } | ||
, "os" : [ "linux" | ||
, "darwin" | ||
, "freebsd" ] | ||
, "devDependencies": { | ||
, "nodeunit": "0.7.3" | ||
, "gleak": "0.2.3" | ||
} | ||
, "config": { "native" : false } | ||
, "main": "./lib/bson/index" | ||
, "directories" : { "lib" : "./lib/bson" } | ||
, "engines" : { "node" : ">=0.6.0" } | ||
, "scripts": { "install" : "node install.js" } | ||
, "licenses" : [ { "type" : "Apache License, Version 2.0" | ||
, "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ] | ||
} |