Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update to work with nodejs 0.6.x #2

Closed
wants to merge 5 commits into from

1 participant

@englercj

Minor changes taken from https://github.com/pzgz/protobuf-for-node makes this repo compatible with nodejs 0.6.x

Also did a small change in package.json to run ldconfig after install.

@englercj englercj closed this
@englercj

Decided to fork this repo for future expansion, instead of contributing back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 29, 2012
  1. @englercj
Commits on Mar 1, 2012
  1. @englercj

    README updates.

    englercj authored
  2. @englercj

    README updates

    englercj authored
  3. @englercj
  4. @englercj

    README Updates

    englercj authored
This page is out of date. Refresh to see the latest.
Showing with 36 additions and 38 deletions.
  1. +2 −0  .gitignore
  2. +26 −29 README.md
  3. +5 −6 package.json
  4. +3 −3 protobuf_for_node.cc
View
2  .gitignore
@@ -0,0 +1,2 @@
+build
+.lock-wscript
View
55 README.md
@@ -1,39 +1,36 @@
-This is a fork of http://code.google.com/p/protobuf-for-node/
-
-My intention is just to package it up nicely for NPM and to fix some bugs.
-
-I also intend to make it work with the NodeJS 0.6.x series.
-
+Overview:
+---------
+This is a fork of https://github.com/chrisdew/protobuf
+It was forked to add support for nodejs 0.6.x using code from https://github.com/pzgz/protobuf-for-node
+and to provide better support for future nodejs versions and npm.
Prerequisites:
--------------
-
-NodeJS v0.4.X
-npm
+ - [NodeJS v0.6.X](http://nodejs.org/)
+ - [npm](http://npmjs.org/)
To install on Ubuntu:
---------------------
-1. wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz
-2. tar -xzvf protobuf-2.4.1.tar.gz
-3. cd protobuf-2.4.1/
-4. ./configure && make && sudo make install
-5. cd
-6. npm install protobuf
-7. echo "/home/chris/node_modules/protobuf/build/default/" | sudo tee /etc/ld.so.conf.d/protobuf.conf
- (replace /home/chris/node_modules with wherever you installed the module)
-8. sudo ldconfig
-9. run node, try "require('protobuf');" - you should see: { Schema: [Function: Schema] }
-
-
-As seen from the instructions above, this is my first attempt at packaging a slightly complex C++ module for NPM.
-
-If you can help me simplify these instructions, please submit a patch.
-
-
-Good luck,
-
-Chris.
+ wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz
+ tar -xzvf protobuf-2.4.1.tar.gz
+ cd protobuf-2.4.1/
+ ./configure && make && sudo make install
+ cd ..
+ npm install protobuf
+
+Test your install:
+------------------
+You can test your installation by opening the nodejs console (by typing `node`) and issue the following
+
+ require('protobuf');
+ .exit
+
+You should see the output `{ Schema: [Function: Schema] }`
+
+Issues:
+-------
+Please report any issues or bugs at https://github.com/englercj/protobuf/issues
View
11 package.json
@@ -1,15 +1,14 @@
-{ "name" : "protobuf",
+{
+ "name" : "protobuf",
"version" : "0.3.0",
"description" : "Protocol Buffers for NodeJS",
- "author": {
- "Matthias Ernst": "mernst@google.com"
- },
- "main": "./build/default/protobuf_for_node",
+ "author": "Matthias Ernst": "mernst@google.com",
+ "main": "./build/Release/protobuf_for_node",
"repository": {
"type": "git",
"url": "git://github.com/chrisdew/protobuf.git"
},
"scripts": {
- "install": "PROTOBUF=/usr/local/lib node-waf configure clean build"
+ "install": "PROTOBUF=/usr/local/lib node-waf configure clean build && echo \"`pwd`/build/Release\" | tee /etc/ld.so.conf.d/protobuf.conf && ldconfig"
}
}
View
6 protobuf_for_node.cc
@@ -25,7 +25,7 @@
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/service.h>
-#include <eio.h>
+#include <node/uv-private/eio.h>
#include <node_buffer.h>
#include <node_object_wrap.h>
@@ -590,14 +590,14 @@ namespace protobuf_for_node {
static ev_async ev_done;
// in some thread:
- static int Run(eio_req* req) {
+ static void Run(eio_req* req) {
AsyncInvocation* self = static_cast<AsyncInvocation*>(req->data);
self->service_->service_->CallMethod(self->method_,
NULL,
self->request_,
self->response_,
google::protobuf::NewCallback(&Done, self));
- return 0;
+ //return 0;
}
// in some thread:
Something went wrong with that request. Please try again.