Permalink
Browse files

updating binding.gyp to support mac platform, package.json for next v…

…ersion, remove node-waf
  • Loading branch information...
1 parent 5b68e2d commit 3d58a64db9b6f299a35737f70e0d5fd675bd839b @Woodya committed Jan 7, 2015
Showing with 50 additions and 22 deletions.
  1. +2 −0 .gitignore
  2. +9 −7 README.md
  3. +24 −0 binding.gyp
  4. +6 −6 package.json
  5. +9 −9 test.js
View
2 .gitignore
@@ -0,0 +1,2 @@
+build/
+gzbz2.node
View
16 README.md
@@ -16,13 +16,13 @@ npm install gzbz2
or
-node-waf configure [--no-bzip] [--no-gzip]
+waf way: node-waf configure [--no-bzip] [--no-gzip]
-node-waf build
+gyp way: node-gype configure (no idea how to conditionally configure..)
-This will put the gzbz2.node binary module in build/default.
+node-gyp build
-Note: on osx, you must run node-waf with python2.6 or greater for configure to work properly.
+Note: on osx, you must run node-waf with python2.6 or greater for configure to work properly. (unsure if this applies to node-gyp)
Quick Gzip example
------------------
@@ -80,7 +80,9 @@ Quick Gunzip Stream example
Versions
--------
-* 0.1.*:
+* 0.2.0:
+ * added ripcurld00d's updates for node-gyp & node\_event.h removal
+* 0.1.\*:
* added bzip2 support. same interface. Bzip/Bunzip objects, bzip specific init options
* bzip.init
* encoding (the output encoding, undefined/null means Buffers)
@@ -100,10 +102,10 @@ Versions
* deflate accepts a buffer or string[+encoding[default = 'utf8']], output will be a buffer or a string encoded according to init options
* also added two submodules gunzipstream, and bunzipstream
* use these to quickly/easily decompress a file while writing similar code to regular input streams
-* 0.0.*:
+* 0.0.\*:
* all string based, encodings in inflate/deflate methods, no init params
Authors
-------
* wave.to: developer of node-compress aka 0.0.1 version and the general framework
-* woody.anderson@gmail.com, fixed bugs/memory leaks, added 0.1.* features: buffers, bzip2, npm as gzbz2,
+* woody.anderson@gmail.com, fixed bugs/memory leaks, added 0.1.\* features: buffers, bzip2, npm as gzbz2,
View
24 binding.gyp
@@ -23,6 +23,30 @@
}
}
}
+ ],
+ ['OS=="mac"',
+ {
+ 'include_dirs': ['/opt/local/include'],
+ 'libraries': ['-L/opt/local/lib'],
+ 'cflags': [ '-Wall', '-O2', '-fexceptions' ],
+ 'cflags_cc!': [ '-fno-exceptions' ],
+ 'xcode_settings': {
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
+ 'GCC_ENABLE_CPP_RTTI': 'YES'
+ },
+ 'defines': [
+ '_FILE_OFFSET_BITS=64',
+ '_LARGEFILE_SOURCE',
+ 'WITH_GZIP',
+ 'WITH_BZIP'
+ ],
+ 'configurations': {
+ 'Debug': {
+ 'cflags': ['-O0', '-g3'],
+ 'cflags!': ['-O2']
+ }
+ }
+ }
]
]
},
View
12 package.json
@@ -5,7 +5,7 @@
"bugs": {
"url": "http://github.com/woodya/node-gzbz2/issues"
},
- "version": "0.1.4",
+ "version": "0.2.0",
"author": "Woody Anderson <woody.anderson@gmail.com>",
"contributors": [
"wave.to"
@@ -14,13 +14,13 @@
"type": "git",
"url": "git://github.com/woodya/node-gzbz2.git"
},
- "main": "build/default/gzbz2",
- "directories.lib": "build/default/",
+ "main": "build/Release/gzbz2.node",
+ "directories.lib": "build/Release/",
"scripts": {
- "build": "node-waf configure build",
- "test": "node-waf test",
+ "build": "node-gyp configure build",
+ "test": "node test.js",
"doc": "node-waf doc",
- "preinstall": "node-waf clean || true; node-waf configure build"
+ "preinstall": "node-gyp clean || true; node-gyp configure build"
},
"dependencies": {},
"devDependencies": {},
View
18 test.js
@@ -1,42 +1,42 @@
var gzbz2 = require("./gzbz2");
-var sys = require("sys");
+var util = require("util");
var fs = require("fs");
// Read in our test file
var testfile = process.argv[2] || "test.js";
var enc = process.argv[3];
var data = fs.readFileSync(testfile, enc);
-sys.puts("Got : " + data.length);
+util.puts("Got : " + data.length);
// Set output file
var fd = fs.openSync(testfile + ".gz", "w", 0644);
-sys.puts("File opened");
+util.puts("File opened");
// Create gzip stream
var gzip = new gzbz2.Gzip;
gzip.init({level:3});
// Pump data to be gzbz2
var gzdata = gzip.deflate(data, enc); // Do this as many times as required
-sys.puts("Compressed chunk size : " + gzdata.length);
+util.puts("Compressed chunk size : " + gzdata.length);
fs.writeSync(fd, gzdata, 0, gzdata.length, null);
// Get the last bit
var gzlast = gzip.end();
-sys.puts("Compressed chunk size: " + gzlast.length);
+util.puts("Compressed chunk size: " + gzlast.length);
fs.writeSync(fd, gzlast, 0, gzlast.length, null);
fs.closeSync(fd);
-sys.puts("File closed");
+util.puts("File closed");
// See if we can uncompress it ok
var gunzip = new gzbz2.Gunzip;
gunzip.init({encoding: enc});
var testdata = fs.readFileSync(testfile + ".gz");
-sys.puts("Test opened : " + testdata.length);
+util.puts("Test opened : " + testdata.length);
var inflated = gunzip.inflate(testdata, enc);
-sys.puts("GZ.inflate.length: " + inflated.length);
+util.puts("GZ.inflate.length: " + inflated.length);
gunzip.end(); // no return value
if (data.length != inflated.length) {
- sys.puts('error! input/output string lengths do not match');
+ util.puts('error! input/output string lengths do not match');
}

0 comments on commit 3d58a64

Please sign in to comment.