From c1f952fd45caea3e7a353171d9856336ce5bad38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 9 Feb 2011 18:02:11 -0500 Subject: [PATCH 1/3] copy the file directly in the wscript instead of requiring another script --- build.sh | 8 -------- wscript | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 9 deletions(-) delete mode 100755 build.sh diff --git a/build.sh b/build.sh deleted file mode 100755 index a96bafe..0000000 --- a/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# Author: Ivan Egorov (egorich.3.04@gmail.com). -# - -node-waf configure $* -node-waf build -cp ./build/default/compress-bindings.node ./lib/compress diff --git a/wscript b/wscript index bc16511..8ef6274 100644 --- a/wscript +++ b/wscript @@ -1,11 +1,18 @@ import Options from os import unlink, symlink, popen from os.path import exists +from shutil import copy2 as copy srcdir = "." blddir = "build" VERSION = "0.1.10" +TARGET = 'compress-bindings' +TARGET_FILE = '%s.node' % TARGET +built = 'build/default/%s' % TARGET_FILE +dest = 'lib/compress/%s' % TARGET_FILE + + def set_options(opt): opt.tool_options("compiler_cxx") @@ -46,7 +53,16 @@ def configure(conf): def build(bld): obj = bld.new_task_gen("cxx", "shlib", "node_addon") obj.cxxflags = ["-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall"] - obj.target = "compress-bindings" + obj.target = TARGET obj.source = "src/compress.cc" obj.defines = bld.env.DEFINES obj.uselib = bld.env.USELIB + + +def shutdown(): + if Options.commands['clean']: + if exists(dest): + unlink(dest) + else: + if exists(built): + copy(built, dest) From ed8bb35cccf5a0c61d709833c04fdd624b64d43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 28 Feb 2011 15:12:54 -0500 Subject: [PATCH 2/3] compiling works without this --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 972e3fd..64e4e04 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,5 @@ "engine": [ "node >=0.1.90" ], "directories": { "lib": "./lib/compress" - }, - "scripts": { - "install": "./build.sh" } } From 39b5c39140f8ad088503de66546a15c55c2b951f Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 2 Mar 2011 15:14:59 -0500 Subject: [PATCH 3/3] node v0.4 support for buffers --- src/zlib.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/zlib.h b/src/zlib.h index bfa6622..327ab3c 100644 --- a/src/zlib.h +++ b/src/zlib.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "utils.h" @@ -85,8 +86,13 @@ class ZipLib : ObjectWrap { Request(ZipLib *self, Local inputBuffer, Local callback) : kind_(RWrite), self_(self), buffer_(Persistent::New(inputBuffer)), +#if NODE_VERSION_AT_LEAST(0,3,0) + data_(Buffer::Data(inputBuffer->ToObject())), + length_(Buffer::Length(inputBuffer->ToObject())), +#else data_(GetBuffer(inputBuffer)->data()), length_(GetBuffer(inputBuffer)->length()), +#endif callback_(Persistent::New(callback)) {} @@ -109,9 +115,12 @@ class ZipLib : ObjectWrap { } } +#if NODE_VERSION_AT_LEAST(0,3,0) +#else static Buffer *GetBuffer(Local buffer) { - return ObjectWrap::Unwrap(buffer->ToObject()); + return ObjectWrap::Unwrap(buffer->ToObject()); } +#endif public: static Request* Write(Self *self, Local inputBuffer,