forked from grumdrig/node-sqlite
/
wscript
39 lines (33 loc) · 1.32 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Options
from os import unlink, symlink
from os.path import exists
srcdir = "."
blddir = "build"
VERSION = "0.0.1"
def set_options(opt):
opt.tool_options("compiler_cxx")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
if not conf.check_cfg(package='sqlite3', args='--cflags --libs', uselib_store='SQLITE3'):
if not conf.check(lib="sqlite3", libpath=['/usr/local/lib', '/opt/local/lib'], uselib_store="SQLITE3"):
conf.fatal('Missing sqlite3');
conf.env.append_value('LIBPATH_SQLITE3', '/opt/local/lib');
# conf.check_cfg(package='profiler', args='--cflags --libs', uselib_store='SQLITE3')
# conf.env.append_value('LIBPATH_PROFILER', '/usr/local/lib')
# conf.env.append_value('LIB_PROFILER', 'profiler')
def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-Wall"]
obj.target = "sqlite3_bindings"
obj.source = "src/sqlite3_bindings.cc src/database.cc src/statement.cc"
obj.uselib = "SQLITE3 PROFILER"
t = 'sqlite3_bindings.node'
def shutdown():
# HACK to get binding.node out of build directory.
# better way to do this?
if Options.commands['clean']:
if exists(t): unlink(t)
else:
if exists('build/default/' + t) and not exists(t):
symlink('build/default/' + t, t)