Commit c3e5f78f by Konstantin Käfer

Merge branch 'master' into node-v6-old

Conflicts:
	wscript
parents 3b410607 a5fe5d0a
.DS_Store .DS_Store
.lock-wscript
build/ build/
TODO TODO
wiki wiki
lib/sqlite3_bindings.node lib/sqlite3_bindings.node
deps/sqlite-autoconf-3070701 deps/sqlite-autoconf-3070800
\ No newline at end of file \ No newline at end of file
{ {
"name": "sqlite3", "name": "sqlite3",
"description": "Asynchronous, non-blocking SQLite3 bindings", "description": "Asynchronous, non-blocking SQLite3 bindings",
"version": "2.0.17", "version": "2.0.18",
"homepage": "http://github.com/developmentseed/node-sqlite3", "homepage": "http://github.com/developmentseed/node-sqlite3",
"author": "Konstantin Käfer <kkaefer@gmail.com>", "author": "Konstantin Käfer <kkaefer@gmail.com>",
"contributors": [ "contributors": [
......
...@@ -16,86 +16,116 @@ TARGET_FILE = '%s.node' % TARGET ...@@ -16,86 +16,116 @@ TARGET_FILE = '%s.node' % TARGET
built = 'build/Release/%s' % TARGET_FILE built = 'build/Release/%s' % TARGET_FILE
dest = 'lib/%s' % TARGET_FILE dest = 'lib/%s' % TARGET_FILE
BUNDLED_SQLITE3_VERSION = '3070701' BUNDLED_SQLITE3_VERSION = '3070800'
BUNDLED_SQLITE3 = 'sqlite-autoconf-%s' % BUNDLED_SQLITE3_VERSION BUNDLED_SQLITE3 = 'sqlite-autoconf-%s' % BUNDLED_SQLITE3_VERSION
BUNDLED_SQLITE3_TAR = 'sqlite-autoconf-%s.tar.gz' % BUNDLED_SQLITE3_VERSION BUNDLED_SQLITE3_TAR = 'sqlite-autoconf-%s.tar.gz' % BUNDLED_SQLITE3_VERSION
SQLITE3_TARGET = 'deps/%s' % BUNDLED_SQLITE3 SQLITE3_TARGET = 'deps/%s' % BUNDLED_SQLITE3
def set_options(ctx): sqlite3_test_program = '''
ctx.tool_options("compiler_cxx") #include "stdio.h"
ctx.add_option('--internal-sqlite', #ifdef __cplusplus
action='store_true', extern "C" {
default=True, #endif
help='Build dynamically against external install of libsqlite3 (default False - build uses internal copy)', #include <sqlite3.h>
dest='internal_sqlite') #ifdef __cplusplus
}
#endif
def configure(ctx):
ctx.check_tool('compiler_cxx') int
ctx.check_tool('node_addon') main() {
return 0;
if not Options.options.internal_sqlite: }
try: '''
ctx.check_cfg(package="sqlite3",
args='--libs --cflags',
uselib_store="SQLITE3", def set_options(opt):
mandatory=True) opt.tool_options("compiler_cxx")
except ConfigurationError: opt.add_option( '--with-sqlite3'
ctx.check(lib="sqlite3", , action='store'
libpath=['/usr/local/lib', '/opt/local/lib'], , default=None
uselib_store="SQLITE3", , help='Directory prefix containing sqlite "lib" and "include" files (default is to compile against internal copy of sqlite v%s' % BUNDLED_SQLITE3_VERSION
mandatory=True) , dest='sqlite3_dir'
)
Utils.pprint('YELLOW','Note: pass --internal-sqlite to compile and link against bundled sqlite (version %s)' % BUNDLED_SQLITE3_VERSION)
def _conf_exit(conf,msg):
conf.fatal('\n\n' + msg + '\n...check the build/config.log for details')
def _build_paths(conf,prefix):
if not os.path.exists(prefix):
_conf_exit(conf,'configure path of %s not found' % prefix)
norm_path = os.path.normpath(os.path.realpath(prefix))
if norm_path.endswith('lib') or norm_path.endswith('include'):
norm_path = os.path.dirname(norm_path)
return os.path.join('%s' % norm_path,'lib'),os.path.join('%s' % norm_path,'include')
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
o = Options.options
if not o.sqlite3_dir:
configure_internal_sqlite3(conf)
else: else:
configure_interal_sqlite3(ctx) lib, include = _build_paths(conf,o.sqlite3_dir)
if conf.check_cxx(lib='sqlite3',
def configure_interal_sqlite3(ctx): fragment=sqlite3_test_program,
os.chdir('deps') uselib_store='SQLITE3',
if not os.path.exists(BUNDLED_SQLITE3): libpath=lib,
os.system('tar xvf %s' % BUNDLED_SQLITE3_TAR) msg='Checking for libsqlite3 at %s' % lib,
os.chdir(BUNDLED_SQLITE3) includes=include):
cxxflags = '' Utils.pprint('GREEN', 'Sweet, found viable sqlite3 dependency at: %s ' % o.sqlite3_dir)
if os.environ.has_key('CFLAGS'): else:
cxxflags += os.environ['CFLAGS'] _conf_exit(conf,'sqlite3 libs/headers not found at %s' % o.sqlite3_dir)
cxxflags += ' '
if os.environ.has_key('CXXFLAGS'): linkflags = []
cxxflags += os.environ['CXXFLAGS'] if os.environ.has_key('LINKFLAGS'):
# LINKFLAGS appear to be picked up automatically... linkflags.extend(os.environ['LINKFLAGS'].split(' '))
if not os.path.exists('config.status'):
Utils.pprint('GREEN','Configuring internal SQLite...') if not o.sqlite3_dir and Options.platform == 'darwin':
os.system("CFLAGS='%s -DSQLITE_ENABLE_RTREE=1 -fPIC -O3 -DNDEBUG' ./configure --disable-dependency-tracking --enable-static --disable-shared" % cxxflags) linkflags.append('-Wl,-search_paths_first')
os.chdir('../../')
conf.env.append_value("LINKFLAGS", linkflags)
ctx.env.append_value("CPPPATH_SQLITE3", ['../deps/%s' % BUNDLED_SQLITE3])
ctx.env.append_value("LINKFLAGS", ['-L../deps/%s/.libs' % BUNDLED_SQLITE3, '-lsqlite3']) def configure_internal_sqlite3(conf):
Utils.pprint('GREEN','Note: will build against internal copy of sqlite3 v%s\n(pass --with-sqlite3=/usr/local to build against an external version)' % BUNDLED_SQLITE3_VERSION)
sys.stderr.write('Configured internal SQLite : ')
Utils.pprint('GREEN', 'ok') os.chdir('deps')
if not os.path.exists(BUNDLED_SQLITE3):
os.system('tar xf %s' % BUNDLED_SQLITE3_TAR)
def build_internal_sqlite3(): os.chdir(BUNDLED_SQLITE3)
if not Options.commands['clean'] and Options.options.internal_sqlite: cxxflags = ''
if not os.path.exists(SQLITE3_TARGET): if os.environ.has_key('CFLAGS'):
Utils.pprint('RED','Please re-run ./configure or node-waf configure') cxxflags += os.environ['CFLAGS']
sys.exit() cxxflags += ' '
os.chdir(SQLITE3_TARGET) if os.environ.has_key('CXXFLAGS'):
if not os.path.exists('libsqlite3.la'): cxxflags += os.environ['CXXFLAGS']
Utils.pprint('GREEN','Building internal SQLite...') # LINKFLAGS appear to be picked up automatically...
os.system('make libsqlite3.la') if not os.path.exists('config.status'):
else: cmd = "CFLAGS='%s -DSQLITE_ENABLE_RTREE=1 -fPIC -O3 -DNDEBUG' ./configure --enable-static --disable-shared" % cxxflags
Utils.pprint('GREEN','Internal SQLite already built.') if Options.platform == 'darwin':
os.chdir('../../') cmd += ' --disable-dependency-tracking'
os.system(cmd)
os.chdir('../../')
conf.env.append_value("CPPPATH_SQLITE3", ['../deps/%s' % BUNDLED_SQLITE3])
conf.env.append_value("LINKFLAGS", ['-L../deps/%s/.libs' % BUNDLED_SQLITE3, '-lsqlite3'])
def build_internal_sqlite3(bld):
if not Options.commands['clean'] and '../deps' in bld.env['CPPPATH_SQLITE3'][0]:
if not os.path.exists(SQLITE3_TARGET):
Utils.pprint('RED','Please re-run ./configure or node-waf configure')
sys.exit()
os.chdir(SQLITE3_TARGET)
os.system('make')
os.chdir('../../')
def clean_internal_sqlite3(): def clean_internal_sqlite3():
if os.path.exists(SQLITE3_TARGET): if os.path.exists(SQLITE3_TARGET):
rmtree(SQLITE3_TARGET) rmtree(SQLITE3_TARGET)
def build(ctx): def build(ctx):
build_internal_sqlite3() build_internal_sqlite3()
t = ctx.new_task_gen('cxx', 'shlib', 'node_addon') t = ctx.new_task_gen('cxx', 'shlib', 'node_addon')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment