Commit b69ed971 by King Koopa

Merge

parents 59798f11 85699799
.lock-wscript
*.dylib
*.so
*.o
*.lo
*.Makefile
*.target.gyp.mk
stage
lib/binding
build
out
......@@ -18,6 +16,6 @@ gyp-mac-tool
.dirstamp
npm-debug.log
test/support/big.db
lib/node_sqlite3.node
test/tmp
test/nw/app.nw
.DS_Store
\ No newline at end of file
.gitignore
.npmignore
node_modules
lib/binding
build
test
benchmark
configure
Makefile
scripts
.travis.yml
examples
......@@ -3,7 +3,7 @@ language: cpp
env:
matrix:
- export NODE_VERSION="0.8"
- export NODE_VERSION="0.10"
- export NODE_VERSION="0.10" NODE_WEBKIT="0.8.4"
global:
- secure: QhuP5E/kYL1j1KDkHGJtk6DSJr1RH4DR/JrC62Viuf5Du8jE+i0kPWfF2MxtuEmKo35orhpu8t8mzKygWfuO63WPuuIE9qd/+V/y99Lqcj0tEN6wJ5RnywktbTJWg23zphjhmYq3Xj8DLVEikCZBwHtlbygkO9Q60cn1PK+bnPg=
- secure: HxCS2dQAWI0KmCFnFNNZoucG4FeAW+itG7+Hp0dNtwmxZzGOZYFO2bZcGvTAMNfVN++oqLxTebYQI1oB5yUl5mPJjrjthaGS6Zq3S6rfJcXiv+icYgEXlR6ejQ97dsHw1Jeg8nedCQlI4kHfvG6pgBLhq9hnugxH1Cjhdt14E9U=
......@@ -35,6 +35,9 @@ before_script:
- 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
# for testing node-webkit, launch a virtual display
- if [ "$NODE_WEBKIT" != "" ]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; fi
# note: `sleep 3` gives xvfb some time to start
script:
# test install from published binary
......@@ -47,6 +50,20 @@ script:
- make clean
- npm install --build-from-source --sqlite=/usr
- npm test
# on Linux 64 bit: install nw-gyp if NODE_WEBKIT is not empty
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then npm install nw-gyp -g; fi; fi
# on Linux 64 bit: rebuild node-sqlite3 for 64 bit node-webkit target (if NODE_WEBKIT is not empty)
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then node-pre-gyp rebuild --runtime=node-webkit --target=$NODE_WEBKIT; fi; fi
# on Linux 64 bit: download and unpack node-webkit, add it to PATH
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then wget https://s3.amazonaws.com/node-webkit/v${NODE_WEBKIT}/node-webkit-v${NODE_WEBKIT}-linux-x64.tar.gz; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then tar xf node-webkit-v${NODE_WEBKIT}-linux-x64.tar.gz; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then prenwpath="$PATH"; export PATH=$(pwd)/node-webkit-v${NODE_WEBKIT}-linux-x64:$PATH; fi; fi
# on Linux 64 bit: ldd nw
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then ldd $(pwd)/node-webkit-v${NODE_WEBKIT}-linux-x64/nw; fi; fi
# on Linux 64 bit: attempt node-pre-gyp package testpackage (if NODE_WEBKIT is not empty)
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then node-pre-gyp package testpackage --runtime=node-webkit --target=$NODE_WEBKIT --overwrite; fi; fi
# on Linux 64 bit: erase used node-webkit, restore PATH
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then export PATH="$prenwpath"; rm -rf node-webkit-v${NODE_WEBKIT}-linux-x64; fi; fi
- 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
......@@ -55,13 +72,47 @@ script:
- 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
# install 32 bit compiler toolchain and X11
- 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;
# install nw-gyp in 32 bit environment if NODE_WEBKIT is not empty (but on Linux it's installed earlier on 64 bit)
- if [ "$platform" != 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then npm install nw-gyp -g; fi; fi
# rebuild node-sqlite3 for 32 bit node-webkit target (if NODE_WEBKIT is not empty)
- if [ "$NODE_WEBKIT" != "" ]; then node-pre-gyp rebuild --runtime=node-webkit --target=$NODE_WEBKIT; fi;
# on Linux 32 bit: install 32 bit stuff necessary for node-webkit 32 bit
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libx11-6:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libglib2.0-0:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libgtk2.0-0:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libatk1.0-0:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libgdk-pixbuf2.0-0:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libcairo2:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libfreetype6:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libfontconfig1:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libxcomposite1:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libasound2:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libxdamage1:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libxext6:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libxfixes3:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libnss3:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libnspr4:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libgconf-2-4:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libexpat1:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libdbus-1-3:i386; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then sudo apt-get -y install libudev0:i386; fi; fi
# on Linux 32 bit: download and unpack node-webkit, add it to PATH
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then wget https://s3.amazonaws.com/node-webkit/v${NODE_WEBKIT}/node-webkit-v${NODE_WEBKIT}-linux-ia32.tar.gz; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then tar xf node-webkit-v${NODE_WEBKIT}-linux-ia32.tar.gz; fi; fi
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then prenwpath="$PATH"; export PATH=$(pwd)/node-webkit-v${NODE_WEBKIT}-linux-ia32:$PATH; fi; fi
# on Linux 32 bit: ldd nw
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then ldd $(pwd)/node-webkit-v${NODE_WEBKIT}-linux-ia32/nw; fi; fi
# attempt node-pre-gyp package testpackage (if NODE_WEBKIT is not empty)
- if [ "$NODE_WEBKIT" != "" ]; then node-pre-gyp package testpackage --runtime=node-webkit --target=$NODE_WEBKIT --overwrite; fi;
# on Linux 32 bit: erase used node-webkit, restore PATH
- if [ "$platform" = 'linux' ]; then if [ "$NODE_WEBKIT" != "" ]; then export PATH="$prenwpath"; rm -rf node-webkit-v${NODE_WEBKIT}-linux-ia32; fi; 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
build:
npm install --build-from-source
export PATH=`npm explore npm -g -- pwd`/bin/node-gyp-bin:$$PATH && ./node_modules/.bin/node-pre-gyp build
clean:
rm -f ./lib/node_sqlite3.node
rm -rf ./lib/binding/
#rm -f ./test/support/big.db*
rm -f test/support/big.db-journal
rm -f ./test/tmp/*
rm -rf ./deps/sqlite-autoconf-*/
rm -rf ./build
......
# NAME
Asynchronous, non-blocking [SQLite3](http://sqlite.org/) bindings for [Node.js](http://nodejs.org/).
node-sqlite3 - Asynchronous, non-blocking [SQLite3](http://sqlite.org/) bindings for [Node.js](http://nodejs.org/) 0.2-0.4 (versions 2.0.x), **0.6.13+, 0.8.x, and 0.10.x** (versions 2.1.x).
(Can also run in [node-webkit](https://github.com/rogerwang/node-webkit) if it uses a supported version of Node's engine.)
[![NPM](https://nodei.co/npm/sqlite3.png)](https://nodei.co/npm/sqlite3/)
[![Build Status](https://travis-ci.org/mapbox/node-sqlite3.png?branch=master)](https://travis-ci.org/mapbox/node-sqlite3)
[![npm package version](https://badge.fury.io/js/sqlite3.png)](https://npmjs.org/package/sqlite3)
## Depends
- Node.js v0.8.x or v0.10.x
Binaries for most Node versions and platforms are provided by default via [node-pre-gyp](https://github.com/springmeyer/node-pre-gyp).
Also works with [node-webkit](https://github.com/rogerwang/node-webkit) and sqlcipher.
# USAGE
# Usage
**Note:** the module must be [installed](#installing) before use.
......@@ -33,18 +38,15 @@ db.serialize(function() {
db.close();
```
# Features
# FEATURES
* Straightforward query and parameter binding interface
* Full Buffer/Blob support
* Extensive [debugging support](https://github.com/mapbox/node-sqlite3/wiki/Debugging)
* [Query serialization](https://github.com/mapbox/node-sqlite3/wiki/Control-Flow) API
* [Extension support](https://github.com/mapbox/node-sqlite3/wiki/Extensions)
* Big test suite
* Written in modern C++ and tested for memory leaks
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive [debugging support](https://github.com/mapbox/node-sqlite3/wiki/Debugging)
- [Query serialization](https://github.com/mapbox/node-sqlite3/wiki/Control-Flow) API
- [Extension support](https://github.com/mapbox/node-sqlite3/wiki/Extensions)
- Big test suite
- Written in modern C++ and tested for memory leaks
# API
......@@ -52,7 +54,7 @@ db.close();
See the [API documentation](https://github.com/mapbox/node-sqlite3/wiki) in the wiki.
# INSTALLING
# Installing
You can use [`npm`](https://github.com/isaacs/npm) to download and install:
......@@ -67,8 +69,36 @@ It is also possible to make your own build of `sqlite3` from its source instea
It is possible to use the installed package in [node-webkit](https://github.com/rogerwang/node-webkit) instead of the vanilla Node.js, but a rebuild is required before use (see the next section).
## Source install
Unless building via `npm install` (which uses its own `node-gyp`) you will need `node-gyp` installed globally:
npm install node-gyp -g
The sqlite3 module depends only on libsqlite3. However, by default, an internal/bundled copy of sqlite will be built and statically linked, so an externally installed sqlite3 is not required.
# REBUILDING FOR NODE-WEBKIT
If you wish to install against an external sqlite then you need to pass the `--sqlite` argument to `node-gyp`, `npm install` or the `configure` wrapper.
./configure --sqlite=/usr/local
make
Or, using the node-gyp directly:
node-gyp --sqlite=/usr/local
make
Or, using npm:
npm install --sqlite=/usr/local
If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the `-dev` package with your package manager, e.g. `apt-get install libsqlite3-dev` for Debian/Ubuntu. Make sure that you have at least `libsqlite3` >= 3.6.
Note, if building against homebrew-installed sqlite on OS X you can do:
./configure --sqlite=/usr/local/opt/sqlite/
make
## Building for node-webkit
Because of ABI differences, only a rebuilt version of `sqlite3` can be used in [node-webkit](https://github.com/rogerwang/node-webkit).
......@@ -93,38 +123,19 @@ Remember the following:
Visit the “[Using Node modules](https://github.com/rogerwang/node-webkit/wiki/Using-Node-modules)” article in the node-webkit's wiki for more details.
## Building for sqlcipher
# BUILDING FROM THE SOURCE
Unless building via `npm install` (which uses its own `node-gyp`) you will need `node-gyp` installed globally:
npm install node-gyp -g
The sqlite3 module depends only on libsqlite3. However, by default, an internal/bundled copy of sqlite will be built and statically linked, so an externally installed sqlite3 is not required.
If you wish to install against an external sqlite then you need to pass the `--sqlite` argument to `node-gyp`, `npm install` or the `configure` wrapper.
./configure --sqlite=/usr/local
make
Or, using the node-gyp directly:
node-gyp --sqlite=/usr/local
make
To run node-sqlite3 against sqlcipher you need to compile from source by passing build options like:
Or, using npm:
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
npm install --sqlite=/usr/local
If your sqlcipher is installed in a custom location, say if you installed it with homebrew on OS X you also need to do:
If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the `-dev` package with your package manager, e.g. `apt-get install libsqlite3-dev` for Debian/Ubuntu. Make sure that you have at least `libsqlite3` >= 3.6.
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I/`brew --prefix`opt/sqlcipher/include"
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
Note, if building against homebrew-installed sqlite on OS X you can do:
./configure --sqlite=/usr/local/opt/sqlite/
make
# TESTING
# Testing
[mocha](https://github.com/visionmedia/mocha) is required to run unit tests.
......@@ -134,8 +145,7 @@ In sqlite3's directory (where its `package.json` resides) run the following:
npm test
# CONTRIBUTORS
# Contributors
* [Konstantin Käfer](https://github.com/kkaefer)
* [Dane Springmeyer](https://github.com/springmeyer)
......@@ -152,8 +162,7 @@ In sqlite3's directory (where its `package.json` resides) run the following:
* [Mithgol](https://github.com/Mithgol)
# ACKNOWLEDGEMENTS
# Acknowledgments
Thanks to [Orlando Vazquez](https://github.com/orlandov),
[Eric Fredricksen](https://github.com/grumdrig) and
......@@ -162,6 +171,6 @@ Thanks to [Orlando Vazquez](https://github.com/orlandov),
Development of this module is sponsored by [MapBox](http://mapbox.org/).
# LICENSE
# License
`node-sqlite3` is [BSD licensed](https://github.com/mapbox/node-sqlite3/raw/master/LICENSE).
......@@ -2,8 +2,7 @@
"includes": [ "deps/common-sqlite.gypi" ],
"variables": {
"sqlite%":"internal",
"module_name":"node_sqlite3",
"module_path":"./lib/"
"sqlite_libname%":"sqlite3"
},
"targets": [
{
......@@ -13,7 +12,7 @@
["sqlite != 'internal'", {
"libraries": [
"-L<@(sqlite)/lib",
"-lsqlite3"
"-l<(sqlite_libname)"
],
"include_dirs": [ "<@(sqlite)/include" ],
"conditions": [ [ "OS=='linux'", {"libraries+":["-Wl,-rpath=<@(sqlite)/lib"]} ] ]
......
var path = require('path');
var Binary = function(options) {
var options = options || {};
var package_json = options.package_json || require('../package.json');
this.name = options.name || 'binding';
this.configuration = options.configuration || 'Release';
this.uri = options.uri || 'http://'+this.name+'.s3.amazonaws.com/';
this.module_maj_min = package_json.version.split('.').slice(0,2).join('.');
this.module_abi = package_json.abi;
this.platform = options.platform || process.platform;
this.target_arch = options.target_arch || process.arch;
if (process.versions.modules) {
// added in >= v0.10.4 and v0.11.7
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e
this.node_abi = 'node-v' + (+process.versions.modules);
} else {
this.node_abi = 'v8-' + process.versions.v8.split('.').slice(0,2).join('.');
}
}
Binary.prototype.filename = function() {
return this.name + '.node';
}
Binary.prototype.compression = function() {
return '.tar.gz';
}
Binary.prototype.getBasePath = function() {
return this.node_abi
+ '-' + this.platform
+ '-' + this.target_arch;
}
Binary.prototype.getRequirePath = function(configuration) {
return './' + path.join('binding',
configuration || this.configuration,
this.getBasePath(),
this.filename());
}
Binary.prototype.getModuleAbi = function() {
return this.name + '-v' + this.module_maj_min + '.' + this.module_abi;
}
Binary.prototype.getArchivePath = function() {
return this.getModuleAbi()
+ '-'
+ this.getBasePath()
+ this.compression();
}
Binary.prototype.getRemotePath = function() {
return this.uri+this.configuration+'/'+this.getArchivePath();
}
module.exports.Binary = Binary;
\ No newline at end of file
var binding = require('./node_sqlite3.node');
var sqlite3 = module.exports = exports = binding;
var path = require('path');
var binary = require('node-pre-gyp');
var path = require('path')
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
var binding = require(binding_path);
var sqlite3 = module.exports = exports = binding;
var util = require('util');
var EventEmitter = require('events').EventEmitter;
......
......@@ -9,9 +9,10 @@
},
"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"
"module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
"remote_path": "./{configuration}",
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
"host": "https://node-sqlite3.s3.amazonaws.com"
},
"contributors": [
"Konstantin Käfer <mail@kkaefer.com>",
......@@ -35,12 +36,15 @@
"url": "git://github.com/mapbox/node-sqlite3.git"
},
"dependencies": {
"node-pre-gyp": "~0.2.5",
"nan": "~0.8.0"
"node-pre-gyp": "0.5.x",
"nan": "~0.8.0"
},
"bundledDependencies": [
"node-pre-gyp"
],
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">= 0.8.0 < 0.11.0"
},
......
......@@ -3,10 +3,10 @@ NODE_WEBKIT_VERSION=0.8.4
all: app.nw
node_modules/sqlite3:
npm install https://github.com/mapbox/node-sqlite3/tarball/master
npm install https://github.com/mapbox/node-sqlite3/tarball/master --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
node_modules/sqlite3/lib/node_sqlite3.node: node_modules/sqlite3
cd node_modules/sqlite3 && nw-gyp rebuild --target=$(NODE_WEBKIT_VERSION) && rm -rf build/
rebuild:
cd node_modules/sqlite3 && ./node_modules/.bin/node-pre-gyp rebuild --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
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
......@@ -14,7 +14,7 @@ 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
app.nw: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3
zip app.nw index.html package.json node_modules
test: ./node-webkit.app app.nw
......@@ -30,8 +30,7 @@ package: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3
./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 -rf ./node_modules/sqlite3
rm -f ./app.nw
rm -rf node-sqlite-test.app
rm -f credits.html
......
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