Permalink
Browse files

Add binding.gyp sypport for node v0.6.x, refs #111

  • Loading branch information...
1 parent 1847bd2 commit 9545ea7485fcc8b07b7c56c5ec3575938bfd4e5f @Sannis committed Mar 31, 2012
Showing with 72 additions and 32 deletions.
  1. +3 −1 .gitignore
  2. +16 −15 Makefile
  3. +35 −0 binding.gyp
  4. +13 −0 mysql-libmysqlclient-bindings.js
  5. +3 −3 mysql-libmysqlclient.js
  6. +1 −2 package.json
  7. +1 −1 tests/config.js
  8. +0 −10 wscript
View
@@ -4,10 +4,12 @@ build
mysql_bindings.node
.idea
node_modules
+
conf-stamp
build-stamp
+waf-stamp
+gyp-stamp
devdependencies-stamp
-node-mysql-libmysqlclient
*.gcda
*.gcno
View
@@ -6,29 +6,31 @@ NI_DEBUG_PORT=5858
NI_WEB_PORT=8888
WEB_BROWSER=google-chrome
-all: conf build
-
-conf: clean conf-stamp
-
-conf-stamp:
- touch conf-stamp
- node-waf configure
+all: waf
clean:
rm -rf ./build
rm -f ./mysql_bindings.node
- rm -f conf-stamp
- rm -f build-stamp
+ rm -f waf-stamp
+ rm -f gyp-stamp
-cleanall: clean
+clean-all: clean
rm -f devdependencies-stamp
-build: build-stamp
+waf: waf-stamp
-build-stamp: ./src/*
- touch build-stamp
+waf-stamp: ./wscript ./src/*
+ touch waf-stamp
+ node-waf configure
node-waf build
+gyp: gyp-stamp
+
+gyp-stamp: ./binding.gyp ./src/*
+ touch gyp-stamp
+ node-gyp configure
+ node-gyp build
+
test: devdependencies
./node_modules/.bin/nodeunit tests/simple tests/complex tests/issues
@@ -53,5 +55,4 @@ devdependencies-stamp:
touch devdependencies-stamp
npm install --dev .
-.PHONY: all build clean conf test test-all test-profile inspector mlf
-
+.PHONY: all waf gyp clean clean-all test test-all test-profile inspector mlf
View
@@ -0,0 +1,35 @@
+{
+ 'targets': [
+ {
+ # have to specify 'liblib' here since gyp will remove the first one :\
+ 'target_name': 'mysql_bindings',
+ 'sources': [
+ 'src/mysql_bindings.cc',
+ 'src/mysql_bindings_connection.cc',
+ 'src/mysql_bindings_result.cc',
+ 'src/mysql_bindings_statement.cc',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ # no Windows support yet...
+ }, {
+ 'libraries': [
+ '<!@(mysql_config --libs)'
+ ],
+ }],
+ ['OS=="mac"', {
+ # cflags on OS X are stupid and have to be defined like this
+ 'xcode_settings': {
+ 'OTHER_CFLAGS': [
+ '<!@(mysql_config --cflags)'
+ ]
+ }
+ }, {
+ 'cflags': [
+ '<!@(mysql_config --cflags)'
+ ],
+ }]
+ ]
+ }
+ ]
+}
@@ -0,0 +1,13 @@
+/*!
+ * Copyright by Oleg Efimov and node-mysql-libmysqlclient contributors
+ * See contributors list in README
+ *
+ * See license text in LICENSE file
+ */
+
+try {
+ module.exports = require('./build/default/mysql_bindings');
+} catch(e) {
+ // For node v0.5.5+
+ module.exports = require('./build/Release/mysql_bindings');
+}
@@ -10,7 +10,7 @@
*
* @ignore
*/
-var binding = require("./mysql_bindings");
+var bindings = require("./mysql-libmysqlclient-bindings");
/**
* Create connection to database
@@ -23,8 +23,8 @@ var binding = require("./mysql_bindings");
* @param {String|null} socket
* @return {MysqlConnection}
*/
-exports.createConnectionSync = function () {
- var db = new binding.MysqlConnection();
+exports.createConnectionSync = function createConnectionSync() {
+ var db = new bindings.MysqlConnection();
if (arguments.length > 0) {
db.connectSync.apply(db, Array.prototype.slice.call(arguments, 0, 6));
}
View
@@ -47,8 +47,7 @@
}
, "main" : "./mysql-libmysqlclient"
, "scripts" :
- { "install" : "make conf all"
- , "test" : "make test"
+ { "test" : "make test"
, "doc" : "make doc"
}
, "engines" : { "node" : "0.4.x || 0.5.x || 0.6.x" }
View
@@ -14,7 +14,7 @@ GRANT ALL ON test.* TO test@localhost IDENTIFIED BY "";
module.exports = {
// Required modules
mysql_libmysqlclient: require("../mysql-libmysqlclient"),
- mysql_bindings: require("../mysql_bindings"),
+ mysql_bindings: require("../mysql-libmysqlclient-bindings"),
util: require("util"),
// Database connection settings
View
@@ -114,13 +114,3 @@ def doc(doc):
def gh_pages(context):
Utils.exec_command('./gh_pages.sh')
-
-def shutdown(bld):
- if Options.commands['clean'] and not Options.commands['build']:
- if lexists('mysql_bindings.node'):
- unlink('mysql_bindings.node')
- elif Options.commands['build']:
- if exists('build/default/mysql_bindings.node') and not lexists('mysql_bindings.node'):
- symlink('build/default/mysql_bindings.node', 'mysql_bindings.node')
- if exists('build/Release/mysql_bindings.node') and not lexists('mysql_bindings.node'):
- symlink('build/Release/mysql_bindings.node', 'mysql_bindings.node')

0 comments on commit 9545ea7

Please sign in to comment.