Common Lisp implementation of Google's protocol buffers
C++ Common Lisp Protocol Buffer Other
Latest commit 9e682cc Jul 10, 2015 @brown Remove protoc/lisp/config.h
The file is needs to be generated on the system that compiles
protoc-gen-lisp.  README now contains instructions for copying it from
the Google protobuf compiler directory.
Permalink
Failed to load latest commit information.
example Switch to new optimization scheme, where the compiler optimization level Apr 29, 2014
google Update for latest Gogole protoc. Use protoc-gen-lisp in PATH. Feb 27, 2015
protoc Remove protoc/lisp/config.h Jul 10, 2015
varint Use logbitp in a couple of places. Sep 2, 2014
web-site Add initial common-lisp.net web page. Mar 4, 2009
COPYING Increment year in copyright notices. Add a todo. Increment protobuf Jan 7, 2011
README Improve the installation instructions in README. Jul 10, 2015
TODO Remove TODO item about generating code into different packages. Feb 5, 2012
golden Initial commit of Common Lisp protocol buffer project. Sep 30, 2008
message-test.lisp Switch to new optimization scheme, where the compiler optimization level Apr 29, 2014
package.lisp Use nibbles to serialize floating point values. Feb 26, 2015
proto-lisp-test.lisp Switch to new optimization scheme, where the compiler optimization level Apr 29, 2014
protobuf-test.asd Add metadata to test ASDF files. Jun 6, 2015
protobuf.asd Increase version number. Mar 3, 2015
protocol-buffer.lisp Switch to new optimization scheme, where the compiler optimization level Apr 29, 2014
testproto1.proto Add asdf:*PROTOC-RELATIVE-PATH* to control whether a relative or abso… Dec 21, 2010
testproto2.proto Add asdf:*PROTOC-RELATIVE-PATH* to control whether a relative or abso… Dec 21, 2010
wire-format.lisp Use nibbles to serialize floating point values. Feb 26, 2015
wire-format_test.lisp Switch to new optimization scheme, where the compiler optimization level Apr 29, 2014

README

Protobuf is a Common Lisp implementation of Google's protocol buffers.

The protobuf repository contains a compiler from .proto files to Lisp and the
run time support needed by the generated Lisp code.  Not all protocol buffer
features are implemented, but the code works well enough that serialization
tests pass.

The protobuf code has been tested with ABCL, CCL, CLISP, Lispworks, and SBCL.
In the past it has also worked with Allegro Common Lisp, but I have not tested
it recently.


INSTALLATION
============

1. The Common Lisp protocol buffer compiler is implemented as a plugin to
Google's protocol buffer compiler, so you must first build and install Google's
compiler, which is called protoc.  The required code and documentation are
available here:

    https://github.com/google/protobuf

The steps should be something like:

    cd /tmp
    git clone https://github.com/google/protobuf google-protobuf
    cd google-protobuf
    ./autogen.sh
    ./configure --prefix=/local/software/package/protobuf
    make
    make check
    make install


2. Clone the Lisp protobuf git repository to get a local copy and compile
protoc-gen-lisp, the Common Lisp protocol buffer plugin.  The steps required
for Linux are:

    cd /tmp
    git clone git://github.com/brown/protobuf.git

    cd protobuf/protoc/lisp

    # Copy the config.h file created when Google's protocol buffer compiler was
    # built.
    cp /tmp/google-protobuf/config.h .

    # Change INSTALL_ROOT and PROTOC_ROOT in Makefile.  INSTALL_ROOT indicates
    # where protoc-gen-lisp should be installed.  PROTOC_ROOT indicates where
    # you installed Google's protobuf compiler when you compiled it in step 1.

    make install


3. Download and install the Common Lisp packages that protobuf depends on.
First, you'll need ASDF, but it comes pre-installed in most Common Lisp
distributions.  You'll also need com.google.base, which is available via
Quicklisp.  To run all the tests, you'll need the Stefil testing package and
its dependencies: hu.dwim.stefil, hu.dwim.asdf, alexandria.  All of these can
easily be downloaded using Quicklisp.

If you're not using Allegro, CLisp, or SBCL, you may need trivial-utf8, again
available via Quicklisp.


4. Make protobuf and its dependencies available to ASDF.  There are several
ways to do this and you should consult the ASDF documentation to determine what
will work best for you.  If you've downloaded dependencies using Quicklisp,
then ASDF will automatically know about them.

ASDF and its manual are available here:

    http://common-lisp.net/project/asdf/

On my system, I tell ASDF where to find the protobuf system files by creating a
file called source-registry.conf in directory /home/brown/.config/common-lisp/
with the following contents:

  (:source-registry
   (:tree "/home/brown/src/protobuf/")
   :inherit-configuration)


5. Make sure ASDF can execute Google's protocol buffer compiler and the Common
Lisp plugin.  Both protoc and protoc-gen-lisp must be installed in directories
that appear in your shell's PATH environment variable.


6. Compile and load all the protobuf code:

    (asdf:load-system 'protobuf)


7. Optionally, load and run all the tests:

    (asdf:test-system 'varint)
    (asdf:test-system 'protobuf)


8. Compile and run the example code, which shows how to incorporate protocol
buffer definition files into your own projects:

    (asdf:load-system 'protobuf-example)

    (in-package address-book)
    (add-person :id 100
                :name "Robert Brown"
                :email-address "brown@foo.com"
                :phone-numbers '((home . "718-555-1212")
                                 (work . "212-589-1212")
                                 (mobile . "917-555-1212")))
    (list-people)


BUGS
====

Please report bugs and send suggestions on GitHub or contact me directly.  My
email is robert.brown at the mail hosting site gmail.com.