Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with nodejs 0.6.x #2

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.lock-wscript
55 changes: 26 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 3 additions & 3 deletions protobuf_for_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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:
Expand Down