Skip to content

Commit

Permalink
move from node-waf to node-gyp, adapting leveldb.gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
pconstr committed Jul 22, 2012
1 parent 88abb03 commit 7a51edd
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ BINARY=./lib/leveldb.node
PATH:=./node_modules/.bin:${PATH}

build:
if [ ! -d ./build ]; then node-waf configure; fi
node-waf build
if [ ! -d ./build ]; then node-gyp configure; fi
node-gyp build

coffee:
coffee --bare --compile --output lib src/coffee

clean:
node-waf clean
node-gyp clean
rm -rf tmp

distclean: clean
Expand Down
24 changes: 24 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"targets": [
{
"target_name": "leveldb",
"sources": [
"src/cpp/batch.cc",
"src/cpp/batch.h",
"src/cpp/binding.cc",
"src/cpp/comparator.cc",
"src/cpp/comparator.h",
"src/cpp/handle.cc",
"src/cpp/handle.h",
"src/cpp/helpers.h",
"src/cpp/iterator.cc",
"src/cpp/iterator.h",
"src/cpp/node_async_shim.h",
"src/cpp/options.h"
],
"dependencies": [
'deps/leveldb/leveldb.gyp:leveldb'
]
}
]
}
21 changes: 8 additions & 13 deletions deps/leveldb/leveldb.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
'target_defaults': {
'defines': [
'LEVELDB_PLATFORM_CHROMIUM=1',
'LEVELDB_PLATFORM_POSIX=1'
],
'include_dirs': [
'.',
Expand All @@ -20,6 +20,12 @@
'port/win',
],
}],
['OS == "mac"', {
'defines': [
'OS_MACOSX=1',
'PLATFORM=OS_MACOSX'
]
}],
['use_snappy', {
'defines': [
'USE_SNAPPY=1',
Expand All @@ -32,12 +38,6 @@
'target_name': 'leveldb',
'type': '<(library)',
'dependencies': [
# The base libary is a lightweight abstraction layer for things like
# threads and IO. http://src.chromium.org/viewvc/chrome/trunk/src/base/
'../../base/base.gyp:base',
# base::LazyInstance is a template that pulls in dynamic_annotations so
# we need to explictly link in the code for dynamic_annotations.
'../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
],
'conditions': [
['use_snappy', {
Expand Down Expand Up @@ -101,8 +101,6 @@
'include/leveldb/table_builder.h',
'include/leveldb/write_batch.h',
'port/port.h',
'port/port_chromium.cc',
'port/port_chromium.h',
'port/port_example.h',
'port/port_posix.cc',
'port/port_posix.h',
Expand All @@ -129,7 +127,6 @@
'util/crc32c.cc',
'util/crc32c.h',
'util/env.cc',
'util/env_chromium.cc',
'util/env_posix.cc',
'util/hash.cc',
'util/hash.h',
Expand All @@ -141,19 +138,17 @@
'util/status.cc',
],
'sources/': [
['exclude', '_(android|example|portable|posix)\\.cc$'],
['exclude', '_(android|example|portable)\\.cc$'],
],
},
{
'target_name': 'leveldb_testutil',
'type': '<(library)',
'dependencies': [
'../../base/base.gyp:base',
'leveldb',
],
'export_dependent_settings': [
# The tests use include directories from these projects.
'../../base/base.gyp:base',
'leveldb',
],
'sources': [
Expand Down
2 changes: 1 addition & 1 deletion src/coffee/index.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
leveldb = exports = module.exports = require './leveldb/handle'
binding = require './leveldb.node'
binding = require '../build/Release/leveldb.node'

leveldb.version = '0.6.4'
leveldb.bindingVersion = "#{binding.majorVersion}.#{binding.minorVersion}"
Expand Down
2 changes: 1 addition & 1 deletion src/coffee/leveldb/batch.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binding = require '../leveldb.node'
binding = require '../../build/Release/leveldb.node'

noop = ->

Expand Down
2 changes: 1 addition & 1 deletion src/coffee/leveldb/handle.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binding = require '../leveldb.node'
binding = require '../../build/Release/leveldb.node'
{Batch} = require './batch'
{Iterator} = require './iterator'

Expand Down
2 changes: 1 addition & 1 deletion src/coffee/leveldb/iterator.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binding = require '../leveldb.node'
binding = require '../../build/Release/leveldb.node'

###
Expand Down

0 comments on commit 7a51edd

Please sign in to comment.