Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

libusb is now located through pkg-config

- pkg-config resolves path to libusb.h and .so
- usb.revision stores git revision of node-usb
  • Loading branch information...
commit 1c28ca47f0d1c4c8c5ccad1fee0772bfe761a389 1 parent 75013a6
Christopher Klein authored
Showing with 16 additions and 16 deletions.
  1. +4 −0 src/node_usb.h
  2. +1 −1  src/usb.cc
  3. +1 −0  tests/node-usb-test.js
  4. +10 −15 wscript
View
4 src/node_usb.h
@@ -19,6 +19,10 @@
#define NODE_USB_VERSION "0.1"
+#ifndef NODE_USB_REVISION
+ #define NODE_USB_REVISION "unknown"
+#endif
+
using namespace v8;
using namespace node;
View
2  src/usb.cc
@@ -144,7 +144,7 @@ namespace NodeUsb {
Usb *self = new Usb();
// wrap self object to arguments
self->Wrap(args.This());
-
+ args.This()->Set(V8STR("revision"),V8STR(NODE_USB_REVISION));
return args.This();
}
View
1  tests/node-usb-test.js
@@ -5,6 +5,7 @@ var instance = usb_driver.create()
assert.notEqual(instance, undefined, "instance must be undefined");
assert.ok((instance.LIBUSB_CLASS_PER_INTERFACE != undefined), "Constants must be defined");
+assert.notEqual(instance.revision, "unknown", "Revision should not unknown");
assert.equal(instance.isLibusbInitalized, false, "isLibusbInitalized must be false");
assert.equal(instance.close(), false, "close() must be false because driver is not opened");
View
25 wscript
@@ -1,12 +1,12 @@
+import os
import Options, Utils
-from os import unlink, symlink, chdir
+from os import unlink, symlink, chdir, popen
from os.path import exists
srcdir = '.'
blddir = 'build'
VERSION = '0.1'
-
-# def options(ctx):
+REVISION = popen("git log | head -n1 | awk '{printf \"%s\", $2}'").readline()
def set_options(opt):
opt.tool_options("compiler_cxx")
@@ -18,27 +18,22 @@ def configure(conf):
conf.check_tool("compiler_cc")
conf.check_tool('node_addon')
- conf.check_cfg(package='libusb-1.0', mandatory=1, args='--cflags --libs')
+ conf.check_cfg(package='libusb-1.0', uselib_store='USB10', mandatory=1, args='--cflags --libs')
conf.env.append_unique('CPPFLAGS', ["-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE"])
conf.env.append_unique('CXXFLAGS', ["-Wall"])
-
- # libusb lbiraries
- conf.check(lib='usb-1.0', libpath=['/lib', '/usr/local/lib/', '/usr/lib']);
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = 'usb_bindings'
obj.source = './src/node_usb.cc ./src/usb.cc ./src/device.cc ./src/interface.cc ./src/endpoint.cc'
- # TODO include path hard linked; should be build option
- obj.includes = '/usr/include /usr/include/libusb-1.0'
- obj.uselib = ["USB-1.0"]
- obj.lib = ["usb-1.0"]
+ obj.includes = bld.env['CPPPATH_USB10']
+ obj.lib = bld.env['LIB_USB10']
obj.name = "node-usb"
- obj.linklags = ['/usr/lib/libusb-1.0a']
-
- if (Options.options.debug != False) and (Options.options.debug == 'true'):
- obj.defines = ['ENABLE_DEBUG=1']
+ obj.defines = ['NODE_USB_REVISION="' + REVISION + '"']
+ if (Options.options.debug != False) and (Options.options.debug == 'true'):
+ obj.defines.append('ENABLE_DEBUG=1')
+
def shutdown():
t = 'usb_bindings.node';
Please sign in to comment.
Something went wrong with that request. Please try again.