diff --git a/README.md b/README.md index 26d5b51..3296c18 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,36 @@ Node.js add-on (C++) for [SiriDB](https://github.com/SiriDB/siridb-server#readme ## Installation ``` -node-gyp configure && node-gyp build +mkdir my_modules +cd my_modules +git clone https://github.com/SiriDB/siridb-nodejs-addon.git siridb +cd ../ +npm install ./my_modules/siridb ``` +### About Installation + +The addon is built using `cmake` and `node-gyp`. + + +The dependencies are: + +* https://github.com/transceptor-technology/libqpack.git +* https://github.com/SiriDB/libsiridb.git +* https://github.com/SiriDB/libsuv.git + +The build command is: `node-gyp configure && node-gyp build` + +There is `install.sh` script that will install everything, when the package is installed using npm. +It's possible to do the compilation manually, like in install.sh. + +The main module file is specified in package.json: + + `"main": "build/Release/obj.target/siridb.node"` + ## Quick usage ```javascript -const sdbaddon = require('./build/Release/siridb'); +const sdbaddon = require('siridb'); var siridb = new sdbaddon.SiriDBClient( "iris", "siri", "dbtest", "localhost", 9000); diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..809fbbf --- /dev/null +++ b/install.sh @@ -0,0 +1,43 @@ + +if "$( which apt-get )" 2> /dev/null; then + echo "detected Debian-based" + sudo apt install cmake libuv1-dev + +elif "$( which yum )" 2> /dev/null; then + echo "detected Modern Red Hat-based" + sudo yum install cmake libuv-devel + +elif "$( which portage )" 2> /dev/null; then + echo "detected Gentoo-based" + echo "please make sure you have packages: cmake , libuv deveopment" + +elif VERB="$( which pacman )" 2> /dev/null; then + echo "detected Arch-based" + echo "please make sure you have packages: cmake , libuv deveopment" +else + echo "can't detect os type"; + echo "please make sure you have packages: cmake , libuv deveopment" +fi + +npm install -g node-gyp + +git clone https://github.com/transceptor-technology/libqpack.git +cd libqpack/Release +make +sudo make install +cd ../../ + +git clone https://github.com/SiriDB/libsiridb.git +cd libsiridb/Release +make all +sudo make install +cd ../../ + +git clone https://github.com/SiriDB/libsuv.git +cd libsuv/Release +make +sudo make install +cd ../../ + +node-gyp configure +node-gyp build diff --git a/package.json b/package.json new file mode 100644 index 0000000..e4130ea --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "siridb", + "version": "1.0.0", + "description": "Node.js add-on (C++) for [SiriDB](https://github.com/SiriDB/siridb-server#readme)", + "main": "build/Release/obj.target/siridb.node", + "directories": { + "example": "examples" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install": "bash install.sh" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/SiriDB/siridb-nodejs-addon.git" + }, + "author": "", + "license": "ISC", + "gypfile": true, + "bugs": { + "url": "https://github.com/SiriDB/siridb-nodejs-addon/issues" + }, + "homepage": "https://github.com/SiriDB/siridb-nodejs-addon#readme" +}