diff options
| author | Laszlo Boszormenyi (GCS) <gcs@debian.org> | 2014-01-21 18:48:42 +0100 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2014-01-22 16:17:36 +0000 |
| commit | 5996812464c9496ff55df06e92027f8f94332a43 (patch) | |
| tree | 662e57121a3268e124357869f341832c0b7ef045 | |
| parent | adc13f29521414a998f67b590a3dd0119f5996d9 (diff) | |
2.2.0+ds1-1 (patches unapplied)import/2.2.0+ds1-1ubuntu/xenial-develubuntu/xenialubuntu/wily-develubuntu/wilyubuntu/vivid-develubuntu/vividubuntu/utopic-develubuntu/utopicubuntu/trusty-proposedubuntu/trusty-develubuntu/trustydebian/jessie
Imported using git-ubuntu import.
Notes
Notes:
* New upstream release.
| -rw-r--r-- | .travis.yml | 97 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | binding.gyp | 50 | ||||
| -rw-r--r-- | build-util/crosswalk-semver-to-module.js | 96 | ||||
| -rwxr-xr-x | build-util/remake.sh | 34 | ||||
| -rw-r--r-- | build-util/tools.js | 88 | ||||
| -rwxr-xr-x | build-util/upload.sh | 32 | ||||
| -rwxr-xr-x | build.js | 251 | ||||
| -rwxr-xr-x | configure | 2 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | debian/control | 2 | ||||
| -rwxr-xr-x | debian/rules | 1 | ||||
| -rw-r--r-- | deps/common-sqlite.gypi | 2 | ||||
| -rwxr-xr-x | deps/sqlite3.gyp | 4 | ||||
| -rw-r--r-- | lib/sqlite3.js | 9 | ||||
| -rw-r--r-- | package.json | 28 | ||||
| -rw-r--r-- | scripts/build.bat | 49 | ||||
| -rw-r--r-- | src/database.h | 3 | ||||
| -rw-r--r-- | src/gcc-preinclude.h | 4 | ||||
| -rw-r--r-- | src/statement.cc | 2 | ||||
| -rw-r--r-- | src/statement.h | 2 | ||||
| -rw-r--r-- | test/nw/.gitignore | 3 | ||||
| -rwxr-xr-x | test/nw/Makefile | 40 | ||||
| -rw-r--r-- | test/nw/index.html | 14 | ||||
| -rw-r--r-- | test/nw/package.json | 9 |
25 files changed, 253 insertions, 582 deletions
diff --git a/.travis.yml b/.travis.yml index 960bd00..92ac5dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,67 @@ -language: node_js +language: cpp -node_js: - - "0.10" - - "0.8" - - "0.6" +env: + matrix: + - export NODE_VERSION="0.8" + - export NODE_VERSION="0.10" + global: + - secure: QhuP5E/kYL1j1KDkHGJtk6DSJr1RH4DR/JrC62Viuf5Du8jE+i0kPWfF2MxtuEmKo35orhpu8t8mzKygWfuO63WPuuIE9qd/+V/y99Lqcj0tEN6wJ5RnywktbTJWg23zphjhmYq3Xj8DLVEikCZBwHtlbygkO9Q60cn1PK+bnPg= + - secure: HxCS2dQAWI0KmCFnFNNZoucG4FeAW+itG7+Hp0dNtwmxZzGOZYFO2bZcGvTAMNfVN++oqLxTebYQI1oB5yUl5mPJjrjthaGS6Zq3S6rfJcXiv+icYgEXlR6ejQ97dsHw1Jeg8nedCQlI4kHfvG6pgBLhq9hnugxH1Cjhdt14E9U= before_install: - - sudo apt-get -qq update +# put node-pre-gyp on path +- export PATH=./node_modules/.bin/:$PATH +- echo $NODE_VERSION +- git clone https://github.com/creationix/nvm.git ../.nvm +- source ../.nvm/nvm.sh +- nvm install $NODE_VERSION +- nvm use $NODE_VERSION +- node --version +- npm --version +- npm install mocha +- platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/") install: - # test installing from a binary - - npm install - - npm install mocha - - npm test +# test installing from source +- npm install --build-from-source +- npm test before_script: - - make clean +# test publishing +- echo $TRAVIS_BRANCH +- echo $TRAVIS_COMMIT +- echo `git describe --tags --always HEAD` +- PUBLISH=false +- if [ "[publish]" = `git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n'` ]; then echo yes;PUBLISH=true; fi; +- if [[ `git describe --contains $( git rev-parse HEAD )` ]]; then echo yes;PUBLISH=true; fi; +- if [[ $PUBLISH == true ]]; then node-pre-gyp package publish; fi script: - # test source compile with internal libsqlite3 - - npm install --stage - - npm test - - sudo apt-get -qq install libsqlite3-dev - - make clean - # test source compile against external libsqlite3 - - npm install --build-from-source --sqlite=/usr - # output linking details for debugging - - ldd lib/binding/*/*/*node - - npm test - - make clean - # node v0.8 and above provide pre-built 32 bit and 64 bit linux binaries - # so here we use the 32 bit ones to also test 32 bit builds - - export NVER=`node -v` - - if [[ "$NVER" != v0.6* ]]; then wget http://nodejs.org/dist/${NVER}/node-${NVER}-linux-x86.tar.gz; fi - - if [[ "$NVER" != v0.6* ]]; then tar xf node-${NVER}-linux-x86.tar.gz; fi - - if [[ "$NVER" != v0.6* ]]; then export PATH=$(pwd)/node-${NVER}-linux-x86/bin:$PATH; fi - - if [[ "$NVER" != v0.6* ]]; then sudo apt-get -y install binutils:i386 cpp:i386 gcc-4.6:i386 g++-4.6:i386 libstdc++6-4.6-dev:i386 | true; fi - # test source compile in 32 bit mode with internal libsqlite3 - - if [[ "$NVER" != v0.6* ]]; then CC=gcc-4.6 CXX=g++-4.6 npm install --build-from-source; fi - - if [[ "$NVER" != v0.6* ]]; then ldd lib/binding/*/*/*node; fi - - if [[ "$NVER" != v0.6* ]]; then npm test; fi - - if [[ "$NVER" != v0.6* ]]; then make clean; fi - - if [[ "$NVER" != v0.6* ]]; then sudo apt-get -y install libsqlite3-dev:i386; fi - # test source compile in 32 bit mode against external libsqlite3 - - if [[ "$NVER" != v0.6* ]]; then CC=gcc-4.6 CXX=g++-4.6 npm install --build-from-source --sqlite=/usr; fi - - if [[ "$NVER" != v0.6* ]]; then ldd lib/binding/*/*/*node; fi - - if [[ "$NVER" != v0.6* ]]; then npm test; fi
\ No newline at end of file +# test install from published binary +- make clean +- npm install +- npm test +- make clean +# test source compile against system libsqlite3 +- if [[ "$platform" == 'linux' ]]; then sudo apt-get -qq update; sudo apt-get -qq install libsqlite3-dev; fi +- make clean +- npm install --build-from-source --sqlite=/usr +- npm test +- make clean +# node v0.8 and above provide pre-built 32 bit and 64 bit binaries +# so here we use the 32 bit ones to also test 32 bit builds +- NVER=`node -v` +- wget http://nodejs.org/dist/${NVER}/node-${NVER}-${platform}-x86.tar.gz +- tar xf node-${NVER}-${platform}-x86.tar.gz +# enable 32 bit node +- export PATH=$(pwd)/node-${NVER}-${platform}-x86/bin:$PATH +# install 32 bit compiler toolchain +- if [[ "$platform" == 'linux' ]]; then sudo apt-get -y install gcc-multilib g++-multilib; fi +# test source compile in 32 bit mode with internal libsqlite3 +- if [[ "$platform" == 'linux' ]]; then CC=gcc-4.6 CXX=g++-4.6 npm install --build-from-source; else npm install --build-from-source; fi +- npm test +# publish 32 bit build +- if [[ $PUBLISH == true ]]; then node-pre-gyp package publish; fi; +- make clean +# test source compile in 32 bit mode against external libsqlite3 +- if [[ "$platform" == 'linux' ]]; then sudo apt-get -y install libsqlite3-dev:i386; CC=gcc-4.6 CXX=g++-4.6 npm install --build-from-source --sqlite=/usr; npm test; fi @@ -76,7 +76,12 @@ After the `sqlite3` module is installed (according to the previous section), d 1. Install [`nw-gyp`](https://github.com/rogerwang/nw-gyp) globally: `npm install nw-gyp -g` *(unless already installed)* -2. Use `nw-gyp` to rebuild the module: `nw-gyp rebuild --target=0.6.2` +2. Use `nw-gyp` to rebuild the module: + +``` +NODE_WEBKIT_VERSION="0.8.4" # see latest version at https://github.com/rogerwang/node-webkit#downloads +nw-gyp rebuild --target=${NODE_WEBKIT_VERSION} +``` Remember the following: diff --git a/binding.gyp b/binding.gyp index 4a4547e..6d5babb 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,31 +1,45 @@ { - 'includes': [ 'deps/common-sqlite.gypi' ], - 'variables': { - 'sqlite%':'internal', + "includes": [ "deps/common-sqlite.gypi" ], + "variables": { + "sqlite%":"internal", + "module_name":"node_sqlite3", + "module_path":"./lib/" }, - 'targets': [ + "targets": [ { - 'target_name': 'node_sqlite3', - 'conditions': [ - ['sqlite != "internal"', { - 'libraries': [ - '-L<@(sqlite)/lib', - '-lsqlite3' + "target_name": "<(module_name)", + "conditions": [ + ["sqlite != 'internal'", { + "libraries": [ + "-L<@(sqlite)/lib", + "-lsqlite3" ], - 'include_dirs': [ '<@(sqlite)/include' ] + "include_dirs": [ "<@(sqlite)/include" ], + "conditions": [ [ "OS=='linux'", {"libraries+":["-Wl,-rpath=<@(sqlite)/lib"]} ] ] }, { - 'dependencies': [ - 'deps/sqlite3.gyp:sqlite3' + "dependencies": [ + "deps/sqlite3.gyp:sqlite3" ] } ] ], - 'sources': [ - 'src/database.cc', - 'src/node_sqlite3.cc', - 'src/statement.cc' - ], + "sources": [ + "src/database.cc", + "src/node_sqlite3.cc", + "src/statement.cc" + ] + }, + { + "target_name": "action_after_build", + "type": "none", + "dependencies": [ "<(module_name)" ], + "copies": [ + { + "files": [ "<(PRODUCT_DIR)/<(module_name).node" ], + "destination": "<(module_path)" + } + ] } ] } diff --git a/build-util/crosswalk-semver-to-module.js b/build-util/crosswalk-semver-to-module.js deleted file mode 100644 index 54b00ed..0000000 --- a/build-util/crosswalk-semver-to-module.js +++ /dev/null @@ -1,96 +0,0 @@ -var https = require("https"); -var http = require("http"); -var fs = require("fs"); -var url = require('url'); -var semver = require('semver'); - -var cross = {}; - -// https://github.com/developmentseed/node-sqlite3/wiki/Binaries - -var template = 'https://raw.github.com/joyent/node/v{VERSION}/src/'; - -var sortObjectByKey = function(obj){ - var keys = []; - var sorted_obj = {}; - for(var key in obj){ - if(obj.hasOwnProperty(key)){ - keys.push(key); - } - } - // sort keys - keys.sort(function(a,b) { - if (semver.gt(a, b)) { - return 1 - } - return -1; - }); - len = keys.length; - - for (i = 0; i < len; i++) - { - key = keys[i]; - sorted_obj[key] = obj[key]; - } - return sorted_obj; -}; - -function get(ver,callback) { - var header = 'node.h'; - if (semver.gt(ver, 'v0.11.4')) { - // https://github.com/joyent/node/commit/44ed42bd971d58b294222d983cfe2908e021fb5d#src/node_version.h - header = 'node_version.h'; - } - var path = template.replace('{VERSION}',ver) + header; - var uri = url.parse(path); - https.get(uri, function(res) { - if (res.statusCode != 200) { - throw new Error("server returned " + res.statusCode + ' for: ' + path); - } - res.setEncoding('utf8'); - var body = ''; - res.on('data', function (chunk) { - body += chunk; - }); - res.on('end',function(err) { - var term = 'define NODE_MODULE_VERSION' - var idx = body.indexOf(term); - var following = body.slice(idx); - var end = following.indexOf('\n'); - var value = following.slice(term.length,end).trim(); - if (value[0] === '(' && value[value.length-1] == ')') { - value = value.slice(1,value.length-1); - } else if (value.indexOf(' ') > -1) { - value = value.slice(0,value.indexOf(' ')); - } - var int_val = +value; - cross[ver] = int_val; - return callback(null,ver,int_val); - }) - }); -} - -process.on('exit', function(err) { - var sorted = sortObjectByKey(cross); - console.log(sorted); -}) - -var versions_doc = 'http://nodejs.org/dist/npm-versions.txt'; -http.get(url.parse(versions_doc), function(res) { - if (res.statusCode != 200) { - throw new Error("server returned " + res.statusCode + ' for: ' + versions_doc); - } - res.setEncoding('utf8'); - var body = ''; - res.on('data', function (chunk) { - body += chunk; - }); - res.on('end',function(err) { - var lines = body.split('\n').map(function(line) { return line.split(' ')[0].slice(1); }).filter(function(line) { return (line.length && line != 'node'); }); - lines.forEach(function(ver) { - get(ver,function(err,version,result) { - cross[version] = result; - }); - }); - }); -});
\ No newline at end of file diff --git a/build-util/remake.sh b/build-util/remake.sh deleted file mode 100755 index 2ff4e66..0000000 --- a/build-util/remake.sh +++ /dev/null @@ -1,34 +0,0 @@ -export ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export UNAME=$(uname -s); - -cd $ROOTDIR -cd ../ - -if [ ${UNAME} = 'Darwin' ]; then - # note: requires FAT (duel-arch) node installed via .pkg - npm install --stage --target_arch=ia32 - npm install --stage --target_arch=ia32 --debug - npm install --stage --target_arch=x64 - npm install --stage --target_arch=x64 --debug - -elif [ ${UNAME} = 'Linux' ]; then - rm -rf ./bin/linux-* - apt-get -y update - apt-get -y install git make build-essential - git clone https://github.com/creationix/nvm.git ~/.nvm - source ~/.nvm/nvm.sh - nvm install 0.10 - npm install -g node-gyp - node ./build.js --target_arch=x64 - # now do 32 bit - NVER=`node -v` - wget http://nodejs.org/dist/${NVER}/node-${NVER}-linux-x86.tar.gz - tar xf node-${NVER}-linux-x86.tar.gz - export PATH=$(pwd)/node-${NVER}-linux-x86/bin:$PATH - # ignore: - # dependency problems - leaving unconfigure gcc-4.6:i386 g++-4.6:i386 libstdc++6-4.6-dev:i386 - # E: Sub-process /usr/bin/dpkg returned an error code (1) - apt-get -y install binutils:i386 cpp:i386 gcc-4.6:i386 g++-4.6:i386 libstdc++6-4.6-dev:i386 | true - CC=gcc-4.6 CXX=g++-4.6 node ./build.js --target_arch=ia32 -fi
\ No newline at end of file diff --git a/build-util/tools.js b/build-util/tools.js deleted file mode 100644 index 896f779..0000000 --- a/build-util/tools.js +++ /dev/null @@ -1,88 +0,0 @@ -var http = require('http'); -var url = require('url'); - -function download(from,options,callback) { - var options = options || {}; - var uri = url.parse(from); - var req = http.request(uri); - req.on('response', function(res){ - // needed for end to be called - res.resume(); - if (res.statusCode !== 200) { - return callback(new Error('Server returned '+ res.statusCode)); - } - function returnBuffer() { - // todo - use http://nodejs.org/api/buffer.html#buffer_class_method_buffer_concat_list_totallength - for (var length = 0, i = 0; i < out.length; ++i) { - length += out[i].length; - } - var result = new Buffer(length); - for (var pos = 0, j = 0; j < out.length; ++j) { - out[j].copy(result, pos); - pos += out[j].length; - } - return callback(null,result); - } - var out = []; - res.on('data', function(chunk) { - out.push(chunk); - }); - res.on('end', function(){ - returnBuffer(); - }); - res.on('close', function(){ - returnBuffer(); - }); - }); - req.on('error', function(err){ - callback(err); - }); - req.end(); -} - - -function parse_args(_args, opts) { - // first split them like npm returns - var args = []; - _args.forEach(function(a) { - var parts = a.split('='); - parts.forEach(function(p) { - args.push(p); - }) - }) - // respect flags passed to npm install - if (process.env.npm_config_argv) { - var argv_obj = JSON.parse(process.env.npm_config_argv); - args = args.concat(argv_obj.cooked.slice(1)) - } - var debug = (args.indexOf('--debug') > -1); - if (debug) opts.configuration = 'Debug'; - - opts.stage = (args.indexOf('--stage') > -1); - if (opts.stage) { - opts.force = true; - } else { - var from_source = args.indexOf('--build-from-source'); - if ( from_source > -1) { - // no specific module name passed - var next_arg = args[from_source+1]; - if (!next_arg || next_arg.indexOf('--') <= 0) { - opts.force = true; - } else if (next_arg == 'sqlite3'){ - opts.force = true; - } - } - } - var target_arch = args.indexOf('--target_arch'); - if (target_arch > -1) { - var next_arg = args[target_arch+1]; - if (next_arg && next_arg.indexOf('--') < 0) { - opts.target_arch = next_arg; - } - } - opts.args = args; - return opts; -} - -module.exports.parse_args = parse_args; -module.exports.download = download;
\ No newline at end of file diff --git a/build-util/upload.sh b/build-util/upload.sh deleted file mode 100755 index 9d62c54..0000000 --- a/build-util/upload.sh +++ /dev/null @@ -1,32 +0,0 @@ -export ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export DRY_RUN="--dry-run" -export PATTERN="*.*" -export CHECK_MD5="--no-check-md5" - -function make_shas { - for i in $(ls *.tar.gz); do - shasum_file="${i//.tar.gz/.sha1.txt}"; - if [ ! -f "${shasum_file}" ]; then - echo generating "${shasum_file}" - shasum $i | awk '{print $1}' > "${shasum_file}" - fi - done -} - -cd ${ROOTDIR}/../stage/ -if [ -d Debug ]; then -cd Debug -make_shas -../../../s3cmd/s3cmd sync --acl-public ${CHECK_MD5} ./${PATTERN} s3://node-sqlite3/Debug/ ${DRY_RUN} -cd ../ -fi - -if [ -d Release ]; then -cd Release -make_shas -../../../s3cmd/s3cmd sync --acl-public ${CHECK_MD5} ./${PATTERN} s3://node-sqlite3/Release/ ${DRY_RUN} -cd ../ -fi - -#../../s3cmd/s3cmd ls s3://node-sqlite3/ diff --git a/build.js b/build.js deleted file mode 100755 index 2307232..0000000 --- a/build.js +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/env node - -/* -TODO - - verbose/quiet mode - - travis/nvm/32bit auto-build and post to s3 for linux - - cloudfront + logging - - script to check for acl-public - - use require() to support node_modules location of binary? - - consider json config for configuring build and for handling routing remotely - - drop tar.gz - use node-tar directly - https://github.com/isaacs/node-tar/issues/11 -*/ - -var package_json = require('./package.json'); -var Binary = require('./lib/binary_name.js').Binary; -var util = require('./build-util/tools.js'); -var mkdirp = require('mkdirp'); -var targz = require('tar.gz'); -var cp = require('child_process'); -var fs = require('fs'); -var path = require('path'); -var os = require('os'); -var crypto = require('crypto'); - -var opts = { - name: 'node_sqlite3', - force: false, - stage: false, - configuration: 'Release', - target_arch: process.arch, - platform: process.platform, - uri: 'http://node-sqlite3.s3.amazonaws.com/', - tool: 'node-gyp', - paths: {} -} - -function log(msg) { - console.log('['+package_json.name+']: ' + msg); -} - -// only for dev -function log_debug(msg) { - //log(msg); -} - -function done(err) { - if (err) { - log(err); - process.exit(1); - } - process.exit(0); -} - -function test(opts,try_build,callback) { - fs.statSync(opts.paths.runtime_module_path); - var args = []; - var shell_cmd; - var arch_names = { - 'ia32':'-i386', - 'x64':'-x86_64' - } - if (process.platform === 'darwin' && arch_names[opts.target_arch]) { - shell_cmd = 'arch'; - args.push(arch_names[opts.target_arch]); - args.push(process.execPath); - } else if (process.arch == opts.target_arch) { - shell_cmd = process.execPath; - } - if (!shell_cmd) { - // system we cannot test on - likely since we are cross compiling - log("Skipping testing binary for " + process.target_arch); - return callback(); - } - args.push('lib/sqlite3'); - cp.execFile(shell_cmd, args, function(err, stdout, stderr) { - if (err || stderr) { - var output = err.message || stderr; - log('Testing the binary failed: "' + output + '"'); - if (try_build) { - log('Attempting source compile...'); - build(opts,callback); - } - } else { - log('Sweet: "' + opts.binary.filename() + '" is valid, node-sqlite3 is now installed!'); - return callback(); - } - }); -} - -function build(opts,callback) { - var shell_cmd = opts.tool; - if (opts.tool == 'node-gyp' && process.platform === 'win32') { - shell_cmd = 'node-gyp.cmd'; - } - var shell_args = ['rebuild'].concat(opts.args); - var cmd = cp.spawn(shell_cmd,shell_args, {cwd: undefined, env: process.env, customFds: [ 0, 1, 2]}); - cmd.on('error', function (err) { - if (err) { - return callback(new Error("Failed to execute '" + shell_cmd + ' ' + shell_args.join(' ') + "' (" + err + ")")); - } - }); - // exit not close to support node v0.6.x - cmd.on('exit', function (code) { - if (code !== 0) { - return callback(new Error("Failed to execute '" + shell_cmd + ' ' + shell_args.join(' ') + "' (" + code + ")")); - } - move(opts,callback); - }); -} - -function tarball(opts,callback) { - var source = path.dirname(opts.paths.staged_module_file_name); - log('Compressing: ' + source + ' to ' + opts.paths.tarball_path); - new targz(9).compress(source, opts.paths.tarball_path, function(err) { - if (err) return callback(err); - log('Versioned binary staged for upload at ' + opts.paths.tarball_path); - var sha1 = crypto.createHash('sha1'); - fs.readFile(opts.paths.tarball_path,function(err,buffer) { - if (err) return callback(err); - sha1.update(buffer); - log('Writing shasum at ' + opts.paths.tarball_shasum); - fs.writeFile(opts.paths.tarball_shasum,sha1.digest('hex'),callback); - }); - }); -} - -function move(opts,callback) { - try { - fs.statSync(opts.paths.build_module_path); - } catch (ex) { - return callback(new Error('Build succeeded but target not found at ' + opts.paths.build_module_path)); - } - try { - mkdirp.sync(path.dirname(opts.paths.runtime_module_path)); - log('Created: ' + path.dirname(opts.paths.runtime_module_path)); - } catch (err) { - log_debug(err); - } - fs.renameSync(opts.paths.build_module_path,opts.paths.runtime_module_path); - if (opts.stage) { - try { - mkdirp.sync(path.dirname(opts.paths.staged_module_file_name)); - log('Created: ' + path.dirname(opts.paths.staged_module_file_name)) - } catch (err) { - log_debug(err); - } - fs.writeFileSync(opts.paths.staged_module_file_name,fs.readFileSync(opts.paths.runtime_module_path)); - // drop build metadata into build folder - var metapath = path.join(path.dirname(opts.paths.staged_module_file_name),'build-info.json'); - // more build info - opts.date = new Date(); - opts.node_features = process.features; - opts.versions = process.versions; - opts.config = process.config; - opts.execPath = process.execPath; - fs.writeFileSync(metapath,JSON.stringify(opts,null,2)); - tarball(opts,callback); - } else { - log('Installed in ' + opts.paths.runtime_module_path + ''); - test(opts,false,callback); - } -} - -function rel(p) { - return path.relative(process.cwd(),p); -} - -var opts = util.parse_args(process.argv.slice(2),opts); -opts.binary = new Binary(opts); -var versioned = opts.binary.getRequirePath(); -opts.paths.runtime_module_path = rel(path.join(__dirname, 'lib', versioned)); -opts.paths.runtime_folder = rel(path.join(__dirname, 'lib', 'binding',opts.binary.configuration)); -var staged_module_path = path.join(__dirname, 'stage', opts.binary.getModuleAbi(), opts.binary.getBasePath()); -opts.paths.staged_module_file_name = rel(path.join(staged_module_path,opts.binary.filename())); -opts.paths.build_module_path = rel(path.join(__dirname, 'build', opts.binary.configuration, opts.binary.filename())); -opts.paths.tarball_path = rel(path.join(__dirname, 'stage', opts.binary.configuration, opts.binary.getArchivePath())); -opts.paths.tarball_shasum = opts.paths.tarball_path.replace(opts.binary.compression(),'.sha1.txt'); - -if (!{ia32: true, x64: true, arm: true}.hasOwnProperty(opts.target_arch)) { - return done(new Error('Unsupported (?) architecture: '+ opts.target_arch+ '')); -} - -if (opts.force) { - build(opts,done); -} else { - try { - test(opts,true,done); - } catch (ex) { - var from = opts.binary.getRemotePath(); - var tmpdirbase = '/tmp/'; - if (process.env.npm_config_tmp) { - tmpdirbase = process.env.npm_config_tmp - } else if (os.tmpdir) { - tmpdirbase = os.tmpdir(); - } - var tmpdir = path.join(tmpdirbase,'node-sqlite3-'+opts.binary.configuration); - try { - mkdirp.sync(tmpdir); - } catch (err) { - log_debug(err); - } - - log('Checking for ' + from); - util.download(from,{progress:false}, function(err,buffer) { - if (err) { - log(from + ' not found, falling back to source compile (' + err + ')'); - return build(opts,done); - } - // calculate shasum of tarball - var sha1 = crypto.createHash('sha1'); - sha1.update(buffer); - var actual_shasum = sha1.digest('hex'); - - // write local tarball now to make debugging easier if following checks fail - var tmpfile = path.join(tmpdir,path.basename(from)); - fs.writeFile(tmpfile,buffer,function(err) { - if (err) return done(err); - log('Downloaded to: '+ tmpfile); - // fetch shasum expected value - var from_shasum = from.replace(opts.binary.compression(),'.sha1.txt'); - log('Checking for ' + from_shasum); - util.download(from_shasum,{progress:false},function(err,expected_shasum_buffer) { - if (err) { - log(from_shasum + ' not found, skipping shasum check (' + err + ')'); - return done(); - } else { - // now check shasum match - var expected = expected_shasum_buffer.toString().trim(); - if (expected !== actual_shasum) { - return done(new Error("shasum does not match between remote and local: " + expected + ' ' + actual_shasum)); - } else { - log('Sha1sum matches! ' + expected); - // we are good: continue - log('Extracting to ' + opts.paths.runtime_folder); - new targz().extract(tmpfile, opts.paths.runtime_folder, function(err) { - if (err) return done(err); - try { - return test(opts,true,done); - } catch (ex) { - // Stat failed - log(opts.paths.runtime_folder + ' not found, falling back to source compile'); - return build(opts,done); - } - }); - } - } - }); - }); - }); - } -} @@ -1,3 +1,3 @@ #!/bin/sh -node-gyp configure $@ +`npm explore npm -g -- pwd`/bin/node-gyp-bin/node-gyp configure $@
\ No newline at end of file diff --git a/debian/changelog b/debian/changelog index bf2673a..e286ec3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +node-sqlite3 (2.2.0+ds1-1) unstable; urgency=low + + * New upstream release. + + -- Laszlo Boszormenyi (GCS) <gcs@debian.org> Tue, 21 Jan 2014 18:48:42 +0100 + node-sqlite3 (2.1.19+ds1-1) unstable; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index 378e2ff..8d3b8c8 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Uploaders: David Paleino <dapal@debian.org>, Build-Depends: debhelper (>= 9~) , dh-buildinfo + , chrpath , node-gyp , libsqlite3-dev Standards-Version: 3.9.5 @@ -31,4 +32,3 @@ Description: asynchronous, non-blocking SQLite3 bindings for Node.js - extension support. . Node.js is an event-based server-side javascript engine. - diff --git a/debian/rules b/debian/rules index b98a0c5..01c58e9 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,7 @@ TARNAME := node-sqlite3_$(UPVER)+$(DSVER).orig.tar override_dh_install: dh_install dh_buildinfo + chrpath -d $(CURDIR)/debian/node-sqlite3/usr/lib/nodejs/sqlite3/lib/node_sqlite3.node chmod 644 $(CURDIR)/debian/node-sqlite3/usr/lib/nodejs/sqlite3/lib/node_sqlite3.node override_dh_auto_configure: diff --git a/deps/common-sqlite.gypi b/deps/common-sqlite.gypi index 93134c2..c03d747 100644 --- a/deps/common-sqlite.gypi +++ b/deps/common-sqlite.gypi @@ -1,5 +1,5 @@ { 'variables': { - 'sqlite_version%':'3071700' + 'sqlite_version%':'3080200' } }
\ No newline at end of file diff --git a/deps/sqlite3.gyp b/deps/sqlite3.gyp index 48e5879..9d7e9fc 100755 --- a/deps/sqlite3.gyp +++ b/deps/sqlite3.gyp @@ -79,6 +79,10 @@ 'SQLITE_ENABLE_RTREE' ], }, + 'cflags_cc': [ + '-Wno-unused-value', + '-include ../src/gcc-preinclude.h' + ], 'defines': [ '_REENTRANT=1', 'SQLITE_THREADSAFE=1', diff --git a/lib/sqlite3.js b/lib/sqlite3.js index f7506c2..f0d35a4 100644 --- a/lib/sqlite3.js +++ b/lib/sqlite3.js @@ -1,11 +1,4 @@ -var Binary = require('./binary_name.js').Binary; -var binary = new Binary({name:'node_sqlite3'}); -var binding; -try { - binding = require(binary.getRequirePath('Debug')); -} catch (err) { - binding = require(binary.getRequirePath('Release')); -} +var binding = require('./node_sqlite3.node'); var sqlite3 = module.exports = exports = binding; var path = require('path'); var util = require('util'); diff --git a/package.json b/package.json index 24216d7..c6ed882 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,18 @@ { "name": "sqlite3", "description": "Asynchronous, non-blocking SQLite3 bindings", - "version": "2.1.19", - "abi":"a", + "version": "2.2.0", "homepage": "http://github.com/mapbox/node-sqlite3", "author": { "name": "MapBox", "url": "https://mapbox.com/" }, + "binary": { + "module_name": "node_sqlite3", + "module_path": "./lib", + "remote_uri": "http://node-sqlite3.s3.amazonaws.com", + "template": "{configuration}/{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz" + }, "contributors": [ "Konstantin Käfer <mail@kkaefer.com>", "Dane Springmeyer <dane@mapbox.com>", @@ -30,18 +35,23 @@ "url": "git://github.com/mapbox/node-sqlite3.git" }, "dependencies": { - "mkdirp":"~0.3.5", - "tar.gz": "~0.1.1" + "node-pre-gyp": "~0.2.5" }, - "bundledDependencies":["mkdirp","tar.gz","progress"], + "bundledDependencies": [ + "node-pre-gyp" + ], "engines": { - "node": ">= 0.6.13 < 0.11.0" + "node": ">= 0.8.0 < 0.11.0" }, "scripts": { - "install": "node build.js", + "install": "node-pre-gyp install --fallback-to-build", "pretest": "node test/support/createdb.js", "test": "mocha -R spec --timeout 200000" }, - "licenses": [{ "type": "BSD" }], + "licenses": [ + { + "type": "BSD" + } + ], "main": "./lib/sqlite3" -} +}
\ No newline at end of file diff --git a/scripts/build.bat b/scripts/build.bat new file mode 100644 index 0000000..9263a27 --- /dev/null +++ b/scripts/build.bat @@ -0,0 +1,49 @@ +@rem setup +@rem git clone git://github.com/marcelklehr/nodist.git +@rem create ~/.node_pre_gyprc +@rem note, for 64 builds you may need to win7 sdk terminal +@rem https://github.com/TooTallNate/node-gyp/issues/112 +set PATH=c:\dev2\nodist\bin;%PATH% +set PATH=node_modules\.bin;%PATH% +set PATH=%PATH%;c:\Python27 + +@rem 32 bit +set NODIST_X64=0 +nodist use stable +node -e "console.log(process.version + ' ' + process.arch)" +node-pre-gyp clean +npm install --build-from-source +npm test +node-pre-gyp package publish +node-pre-gyp clean + +@rem 64 bit +@ rem cannot open input file 'kernel32.lib' http://www.microsoft.com/en-us/download/details.aspx?id=4422 +set NODIST_X64=1 +nodist use stable +node -e "console.log(process.version + ' ' + process.arch)" +node-pre-gyp clean +npm install --build-from-source +npm test +node-pre-gyp package publish +node-pre-gyp clean + +@ rem 32 bit v0.8x +set NODIST_X64=0 +nodist use v0.8 +node -e "console.log(process.version + ' ' + process.arch)" +node-pre-gyp clean +npm install --build-from-source +npm test +node-pre-gyp package publish +node-pre-gyp clean + +@rem 64 bit v0.8.x +set NODIST_X64=1 +nodist use v0.8 +node -e "console.log(process.version + ' ' + process.arch)" +node-pre-gyp clean +npm install --build-from-source +npm test +node-pre-gyp package publish +node-pre-gyp clean diff --git a/src/database.h b/src/database.h index b2e4853..a051dae 100644 --- a/src/database.h +++ b/src/database.h @@ -105,7 +105,8 @@ protected: pending(0), serialize(false), debug_trace(NULL), - debug_profile(NULL) { + debug_profile(NULL), + update_event(NULL) { } diff --git a/src/gcc-preinclude.h b/src/gcc-preinclude.h new file mode 100644 index 0000000..c515fa6 --- /dev/null +++ b/src/gcc-preinclude.h @@ -0,0 +1,4 @@ + +// https://rjpower9000.wordpress.com/2012/04/09/fun-with-shared-libraries-version-glibc_2-14-not-found/ + +__asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); diff --git a/src/statement.cc b/src/statement.cc index 04a0d79..86df315 100644 --- a/src/statement.cc +++ b/src/statement.cc @@ -247,7 +247,7 @@ template <class T> T* Statement::Bind(const Arguments& args, int start, int last return baton; } -bool Statement::Bind(const Parameters parameters) { +bool Statement::Bind(const Parameters & parameters) { if (parameters.size() == 0) { return true; } diff --git a/src/statement.h b/src/statement.h index 0b6e60c..3b02677 100644 --- a/src/statement.h +++ b/src/statement.h @@ -217,7 +217,7 @@ protected: template <class T> inline Values::Field* BindParameter(const Handle<Value> source, T pos); template <class T> T* Bind(const Arguments& args, int start = 0, int end = -1); - bool Bind(const Parameters parameters); + bool Bind(const Parameters & parameters); static void GetRow(Row* row, sqlite3_stmt* stmt); static Local<Object> RowToJS(Row* row); diff --git a/test/nw/.gitignore b/test/nw/.gitignore new file mode 100644 index 0000000..107e605 --- /dev/null +++ b/test/nw/.gitignore @@ -0,0 +1,3 @@ +node-webkit.app +node-webkit-v0.8.4-osx-ia32.zip +node_modules
\ No newline at end of file diff --git a/test/nw/Makefile b/test/nw/Makefile new file mode 100755 index 0000000..adb7dbf --- /dev/null +++ b/test/nw/Makefile @@ -0,0 +1,40 @@ +NODE_WEBKIT_VERSION=0.8.4 + +all: app.nw + +node_modules/sqlite3: + npm install https://github.com/mapbox/node-sqlite3/tarball/master + +node_modules/sqlite3/lib/node_sqlite3.node: node_modules/sqlite3 + cd node_modules/sqlite3 && nw-gyp rebuild --target=$(NODE_WEBKIT_VERSION) && rm -rf build/ + +node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip: + wget https://s3.amazonaws.com/node-webkit/v$(NODE_WEBKIT_VERSION)/node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip + +./node-webkit.app: node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip + unzip -o node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip + +app.nw: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3/lib/node_sqlite3.node + zip app.nw index.html package.json node_modules + +test: ./node-webkit.app app.nw + ./node-webkit.app/Contents/MacOS/node-webkit app.nw + +package: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3 + rm -rf node-sqlite-test.app + cp -r ./node-webkit.app node-sqlite-test.app + mkdir ./node-sqlite-test.app/Contents/Resources/app.nw/ + cp package.json ./node-sqlite-test.app/Contents/Resources/app.nw/ + cp index.html ./node-sqlite-test.app/Contents/Resources/app.nw/ + cp -r node_modules/ ./node-sqlite-test.app/Contents/Resources/app.nw/ + ./node-sqlite-test.app/Contents/MacOS/node-webkit + +clean: + rm -rf ./node_modules/sqlite3/build + rm -f ./node_modules/sqlite3/lib/node_sqlite3.node + rm -f ./app.nw + rm -rf node-sqlite-test.app + rm -f credits.html + rm -f nwsnapshot + +.PHONY: test diff --git a/test/nw/index.html b/test/nw/index.html new file mode 100644 index 0000000..9a1bb90 --- /dev/null +++ b/test/nw/index.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <head> + <title>Hello World!</title> + </head> + <body> + <h1>Hello World!</h1> + Using node-sqlite3: + <script> + var sqlite = require('sqlite3'); + document.write(sqlite.VERSION); + </script>. + </body> +</html>
\ No newline at end of file diff --git a/test/nw/package.json b/test/nw/package.json new file mode 100644 index 0000000..d1b4aee --- /dev/null +++ b/test/nw/package.json @@ -0,0 +1,9 @@ +{ + "name": "nw-demo", + "main": "index.html", + "window": { + "toolbar": false, + "width": 800, + "height": 600 + } +}
\ No newline at end of file |
