[Pkg-javascript-commits] [node-topcube] 07/19: Imported Upstream version 0.2.0+ds1

Jérémy Lal kapouer at alioth.debian.org
Sat Oct 26 13:54:18 UTC 2013


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository node-topcube.

commit b2e10c96d5ba13fc82ded8ab0f98e27d5262e0c9
Author: Jérémy Lal <kapouer at melix.org>
Date:   Sat Oct 26 12:06:40 2013 +0200

    Imported Upstream version 0.2.0+ds1
---
 .gitignore                     |    5 +++-
 LICENSE                        |    8 +++++++
 Makefile                       |    6 ++++-
 binding.gyp                    |   51 ++++++++++++++++++++++++++++++++++++++++
 deps/download_and_extract.py   |   17 ++++++++++++++
 deps/fetch-win-binary.gyp      |   22 +++++++++++++++++
 lib/index.js                   |    1 +
 topcube.js => lib/topcube.js   |    4 ++--
 package.js                     |   22 -----------------
 package.json                   |   11 +++------
 topcube.cpp => src/topcube.cpp |   35 ++++++++++++++++-----------
 11 files changed, 134 insertions(+), 48 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8aca833..444a015 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+.DS_Store
 build
 sampleapp/node_modules
-.lock-wscript
+bin/topcube
+bin/cefclient
+deps/cefclient-0.0.2.tar.gz
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8cb8c41
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,8 @@
+Copyright (c) 2011-2012 Tim Caswell <tim at creationix.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/Makefile b/Makefile
index d4402b7..5ce3670 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,8 @@
 build:
-	node-waf build
+	npm install
+
+clean:
+	rm -rf ./build
+	rm -rf ./bin/*
 
 .PHONY: build
\ No newline at end of file
diff --git a/binding.gyp b/binding.gyp
new file mode 100644
index 0000000..9c67354
--- /dev/null
+++ b/binding.gyp
@@ -0,0 +1,51 @@
+{
+  'targets': [
+    {
+      'target_name': 'topcube',
+      'type': 'executable',
+      'conditions': [
+        ['OS!="win"', {
+          'sources': [
+            'src/topcube.cpp'
+          ],
+        }],
+        ['OS=="win"', {
+          'dependencies': [ 'deps/fetch-win-binary.gyp:download_cef' ],
+        }],
+        ['OS=="linux"', {
+          'cflags_cc' : [
+              '<!@(pkg-config gtk+-2.0 --cflags)',
+              '<!@(pkg-config glib-2.0 --cflags)',
+              '<!@(pkg-config webkit-1.0 --cflags)'
+          ],
+          'libraries':[
+              '<!@(pkg-config gtk+-2.0 --libs)',
+              '<!@(pkg-config glib-2.0 --libs)',
+              '<!@(pkg-config webkit-1.0 --libs)'
+          ]
+        }]
+      ]
+    },
+    {
+      'target_name': 'action_after_build',
+      'type': 'none',
+      'dependencies': [ 'topcube' ],
+      'conditions': [
+        ['OS!="win"', {
+          'actions': [
+            {
+              'action_name': 'move_topcube',
+              'inputs': [
+                '<@(PRODUCT_DIR)/topcube'
+              ],
+              'outputs': [
+                'bin/topcube'
+              ],
+              'action': ['cp', '<@(PRODUCT_DIR)/topcube', 'bin/topcube']
+            }
+          ]
+        }]
+      ]
+    }
+  ]
+}
diff --git a/deps/download_and_extract.py b/deps/download_and_extract.py
new file mode 100644
index 0000000..9dddaa7
--- /dev/null
+++ b/deps/download_and_extract.py
@@ -0,0 +1,17 @@
+import os
+import sys
+import urllib
+import tarfile
+
+# hardcoded here otherwise gyp on windows will incorrectly try to relativize the path
+source_url = 'https://github.com/downloads/mapbox/cefclient/cefclient-0.0.2.tar.gz'
+
+target_file = os.path.abspath(os.path.basename(source_url))
+dirname = os.path.abspath(sys.argv[1])
+
+if not os.path.exists(target_file):
+    urllib.urlretrieve(source_url, target_file)
+
+tfile = tarfile.open(target_file,'r:gz');
+tfile.extractall(dirname)
+sys.exit(0)
diff --git a/deps/fetch-win-binary.gyp b/deps/fetch-win-binary.gyp
new file mode 100755
index 0000000..6e57883
--- /dev/null
+++ b/deps/fetch-win-binary.gyp
@@ -0,0 +1,22 @@
+{
+  'targets': [
+    {
+      'target_name': 'download_cef',
+      'type': 'none',
+      'hard_dependency': 1,
+      'actions': [
+        {
+          'action_name': 'download_and_unpack',
+          'inputs': [],
+          'outputs': [
+            '../bin/cefclient/cefclient.exe'
+          ],
+          'action': ['python',
+                     './download_and_extract.py',
+                     '../bin/'
+                    ]
+        }
+      ]
+    }
+  ]
+}
diff --git a/lib/index.js b/lib/index.js
new file mode 100644
index 0000000..4e09e57
--- /dev/null
+++ b/lib/index.js
@@ -0,0 +1 @@
+module.exports = require('./topcube');
\ No newline at end of file
diff --git a/topcube.js b/lib/topcube.js
similarity index 83%
rename from topcube.js
rename to lib/topcube.js
index 63b2c89..f2dfafd 100644
--- a/topcube.js
+++ b/lib/topcube.js
@@ -10,11 +10,11 @@ module.exports = function (options) {
     var keys = [];
     switch (process.platform) {
     case 'win32':
-        client = path.resolve(__dirname + '/cefclient/cefclient');
+        client = path.resolve(__dirname + '/../bin/cefclient/cefclient');
         keys = ['url', 'name', 'width', 'height', 'minwidth', 'minheight', 'ico', 'cache-path', 'log-file'];
         break;
     case 'linux':
-        client = path.resolve(__dirname + (/0\.4\./.test(process.version) ? '/build/default/topcube' : '/build/Release/topcube'));
+        client = path.resolve(__dirname + '/../bin/topcube');
         keys = ['url', 'name', 'width', 'height', 'minwidth', 'minheight'];
         break;
     default:
diff --git a/package.js b/package.js
deleted file mode 100644
index 6d9b784..0000000
--- a/package.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var exec = require('child_process').exec;
-switch (process.platform) {
-case 'win32':
-    console.log('win32: Downloading CEF client...');
-    exec('curl -skL https://github.com/downloads/mapbox/cefclient/cefclient-0.0.2.tar.gz | tar zx', function(err, stdout, stderr) {
-        console.log(stdout);
-        console.log(stderr);
-        return err ? process.exit(1) : process.exit(0);
-    });
-    break;
-case 'linux':
-    exec('node-waf clean || true; node-waf configure build', function(err, stdout, stderr) {
-        console.log(stdout);
-        console.log(stderr);
-        return err ? process.exit(1) : process.exit(0);
-    });
-    break;
-default:
-    console.log('Topcube currently does not support %s', process.platform);
-    return process.exit(0);
-    break;
-}
diff --git a/package.json b/package.json
index 604fc76..fa77d93 100644
--- a/package.json
+++ b/package.json
@@ -2,18 +2,13 @@
   "author": "Tim Caswell <tim at creationix.com>",
   "name": "topcube",
   "description": "Simple bindings to create a webkit window that node can control",
-  "version": "0.1.2",
+  "version": "0.2.0",
   "repository": {
     "type": "git",
     "url": "git://github.com/creationix/topcube.git"
   },
-  "main": "./topcube.js",
+  "main": "./lib/topcube.js",
   "dependencies": {},
   "devDependencies": {},
-  "engines": {
-    "node": "<0.7.x"
-  },
-  "scripts": {
-    "preinstall": "node package.js"
-  }
+  "engines": { "node": ">= 0.8.11 < 0.11.0" }
 }
diff --git a/topcube.cpp b/src/topcube.cpp
similarity index 89%
rename from topcube.cpp
rename to src/topcube.cpp
index 8944f12..670a860 100644
--- a/topcube.cpp
+++ b/src/topcube.cpp
@@ -1,15 +1,20 @@
+#ifdef __APPLE__
+
+#include <iostream>
+int main(int argc, char* argv[])
+{
+    std::clog << "OS X is not currently supported by topcube\n";
+    return 0;
+}
+
+#else
+
+#include <string.h> // for strcmp
+#include <cstdlib> // for exit
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
 #include <webkit/webkitwebview.h>
 
-// stl for n00b debugging :)
-#include <sstream>
-#include <iostream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-// std::clog << "debug output";
-
 GtkWidget *window;
 GtkWidget *scrolled_window;
 GtkWidget *web_view;
@@ -85,12 +90,12 @@ int main(int argc, char* argv[])
   static gint minwidth = 600;
   static gint minheight = 400;
   static GOptionEntry entries[] = {
-    { "url", 'u', 0, G_OPTION_ARG_STRING, &url, "URL" },
-    { "name", 'n', 0, G_OPTION_ARG_STRING, &name, "Window name" },
-    { "width", 'W', 0, G_OPTION_ARG_INT, &width, "Width" },
-    { "height", 'H', 0, G_OPTION_ARG_INT, &height, "Height" },
-    { "minwidth", 'w', 0, G_OPTION_ARG_INT, &minwidth, "Minimum width" },
-    { "minheight", 'h', 0, G_OPTION_ARG_INT, &minheight, "Minimum height" }
+    { "url", 'u', 0, G_OPTION_ARG_STRING, &url, "URL", NULL },
+    { "name", 'n', 0, G_OPTION_ARG_STRING, &name, "Window name", NULL },
+    { "width", 'W', 0, G_OPTION_ARG_INT, &width, "Width", NULL },
+    { "height", 'H', 0, G_OPTION_ARG_INT, &height, "Height", NULL },
+    { "minwidth", 'w', 0, G_OPTION_ARG_INT, &minwidth, "Minimum width", NULL },
+    { "minheight", 'h', 0, G_OPTION_ARG_INT, &minheight, "Minimum height", NULL }
   };
   GError *error = NULL;
   GOptionContext *options;
@@ -136,3 +141,5 @@ int main(int argc, char* argv[])
   return 0;
 }
 
+
+#endif // linux

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-topcube.git



More information about the Pkg-javascript-commits mailing list