Skip to content

Commit

Permalink
move to waf build system
Browse files Browse the repository at this point in the history
- remove tools in favor of monkey patching js helper methods (simpler build)
- makefile uses npm where appropriate
  • Loading branch information
defunctzombie committed Dec 18, 2011
1 parent 33eca02 commit dce791e
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 706 deletions.
20 changes: 2 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
src/*.o
src/natives.h
src/*.a
src/*.node
*.a
*.node
.scon*
config.log
src/*.os
libxmljs
tools/*.pyc
benchmarks
experiments
notes
TODO
**/*.swp
*.log
**/*.swo
.lock-wscript
*.swp
build/
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
SCONS=scons

node:
@$(SCONS) libxmljs.node
target=./build/Release/libxmljs.node

node-debug:
@$(SCONS) libxmljs.node debug=1
all: $(target)

build/:
node-waf configure

$(target): build/ src/*.cc src/*.h
node-waf build

clean:
@$(SCONS) -c
@$(SCONS) -c libxmljs.node
rm -rf build

test-verbose:
node --expose_gc spec/tacular.js --verbose
test: $(target)
npm test

test:
node --expose_gc spec/tacular.js
115 changes: 0 additions & 115 deletions SConstruct

This file was deleted.

6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = require('./build/Release/libxmljs');

// attach javascipt helpers to bound classes
require('./lib/xml_element');
require('./lib/xml_document');
require('./lib/xml_sax_parser');
2 changes: 2 additions & 0 deletions src/xml_document.js → lib/xml_document.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var libxml = require('../build/Release/libxmljs');

libxml.Document.prototype.node = function() {
args = libxml.Element.Arguments(arguments);
return this.root(new libxml.Element(this, args[0], args[1], args[2], args[3]));
Expand Down
2 changes: 2 additions & 0 deletions src/xml_element.js → lib/xml_element.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var libxml = require('../build/Release/libxmljs');

// name, attrs, content, callback
libxml.Element.Arguments = function(args) {
var ret_args = null;
Expand Down
2 changes: 2 additions & 0 deletions src/xml_sax_parser.js → lib/xml_sax_parser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var libxml = require('../build/Release/libxmljs');

libxml.SaxCallbacks = function() {
var callbackList = {};

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
, "description" : "libxml bindings for v8 javascript engine"
, "version" : "0.4.3"
, "scripts" :
{ "preinstall" : "make node"
, "preuninstall" : "make clean"
, "test" : "make test"
{ "install" : "node-waf configure build"
, "preuninstall" : "node-waf clean"
, "test" : "node --expose_gc spec/tacular.js"
}
, "repository" :
{ "type" : "git"
Expand All @@ -16,6 +16,6 @@
{ "mail" : ""
, "url" : "http://github.com/polotek/libxmljs/issues"
}
, "main" : "./libxmljs"
, "main" : "./index"
, "engines" : { "node" : ">=0.1.90" }
}
2 changes: 1 addition & 1 deletion spec/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.gc = (typeof gc == 'undefined') ? function() {} : gc;

exports.libxml = require('../libxmljs');
exports.libxml = require('../index');

exports.clone = function(obj) {
if(obj == null || typeof(obj) != 'object')
Expand Down
2 changes: 1 addition & 1 deletion spec/tacular.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ with(require('sys')) {
var specCount = 0;
var specStack = [];
var specFailures = [];
var specVerbose = process.ARGV.join(";").match(/;(--verbose|-v)/);
var specVerbose = process.argv.join(";").match(/;(--verbose|-v)/);

var describe = function(name, func) {
specStack.push(name);
Expand Down
18 changes: 0 additions & 18 deletions src/libxmljs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ ExecuteString(v8::Handle<v8::String> source,
return scope.Close(result);
}

static void
ExecuteNativeJS(const char* filename,
const char* data) {
v8::HandleScope scope;
v8::TryCatch try_catch;
ExecuteString(v8::String::New(data), v8::String::New(filename));
if (try_catch.HasCaught()) {
puts("There is an error in Node's built-in javascript");
puts("This should be reported as a bug!");
ReportException(&try_catch);
exit(1);
}
}

void
UpdateV8Memory() {
v8::V8::AdjustAmountOfExternalAllocatedMemory(-current_xml_memory);
Expand Down Expand Up @@ -188,10 +174,6 @@ InitializeLibXMLJS(v8::Handle<v8::Object> target) {

v8::Context::Scope context_scope(context);
context->Global()->Set(v8::String::NewSymbol("libxml"), target);

ExecuteNativeJS("xml_sax_parser.js", native_xml_sax_parser);
ExecuteNativeJS("xml_document.js", native_xml_document);
ExecuteNativeJS("xml_element.js", native_xml_element);
}

// used by node.js to initialize libraries
Expand Down
1 change: 0 additions & 1 deletion src/libxmljs.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class LibXMLJS {

} // namespace libxmljs

#include "natives.h"
#include "object_wrap.h"

#endif // SRC_LIBXMLJS_H_
Loading

0 comments on commit dce791e

Please sign in to comment.