From 17aa517e410f9a877f845f520168e03cf21d1c55 Mon Sep 17 00:00:00 2001 From: Chris Laws Date: Tue, 17 Dec 2013 08:53:15 +1030 Subject: [PATCH 1/2] Fix up README, include accurate instructions --- README.md | 145 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 103 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 48e07cea..d17a2d7a 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,134 @@ -MessagePack for C/C++ -===================== +# Msgpack for C/C++ +It's like JSON but small and fast. + +## Overview + +MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves. Binary-based efficient object serialization library. -## Installation +## License -Download latest package from [releases of MessagePack](http://sourceforge.net/projects/msgpack/files/) and extract it. - -On UNIX-like platform, run ./configure && make && sudo make install: - - $ ./configure - $ make - $ sudo make install - -On Windows, open msgpack_vc8.vcproj or msgpack_vc2008 file and build it using batch build. DLLs are built on lib folder, -and the headers are built on include folder. - -To use the library in your program, include msgpack.hpp header and link "msgpack" library. +Msgpack is Copyright (C) 2008-2010 FURUHASHI Sadayuki and licensed under the Apache License, Version 2.0 (the "License"). For details see the `COPYING` file in this directory. -## Example +## Contributing + +The source for msgpack-c is held at [msgpack-c](https://github.com/msgpack/msgpack-c) github.com site. + +To report an issue, use the [msgpack-c issue tracker](https://github.com/msgpack/msgpack-c/issues) at github.com. + + +## Using Msgpack + +### Building and Installing + +#### Install from git repository + +You will need gcc (4.1.0 or higher), autotools. + +``` +$ git clone https://github.com/msgpack/msgpack-c.git +$ cd msgpack-c +$ ./bootstrap +$ ./configure +$ make +$ sudo make install +``` + +#### Install from package + +##### UNIX-like platform with ./configure + +On typical UNIX-like platforms, download source package from [Releases|http://msgpack.org/releases/cpp/] and run `./configure && make && make install`. Example: + +``` +$ wget http://msgpack.org/releases/cpp/msgpack-0.5.5.tar.gz +$ tar zxvf msgpack-0.5.5.tar.gz +$ cd msgpack-0.5.5 +$ ./configure +$ make +$ sudo make install +``` + +##### FreeBSD with Ports Collection + +On FreeBSD, you can use Ports Collection. Install [net/msgpack|http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/] package. + + +##### Gentoo Linux with Portage + +On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack|http://gentoo-portage.com/dev-libs/msgpack] package. + + +##### Mac OS X with MacPorts + +On Mac OS X, you can install MessagePack for C using MacPorts. + +``` +$ sudo port install msgpack +``` + +You might need to run `sudo port selfupdate` before installing to update the package repository. + +You can also install via Homebrew. + +``` +$ sudo brew install msgpack +``` + + +##### Windows + +On Windows, download source package from [here|https://sourceforge.net/projects/msgpack/files/] and extract it. Open `msgpack_vc8.vcproj` or msgpack_vc2008 file and build it using batch build. It builds libraries in `lib/` folder and header files in `include/` folder. + +You can build using command line as follows: + +``` +> vcbuild msgpack_vc2008.vcproj +> dir lib % DLL files are here +> dir include % header files are here +``` + + +### Linking with an Application + +Include `msgpack.hpp` (or `msgpack.h` for C) in your application and link with libmsgpack. Here is a typical gcc link command: + + gcc -lmsgpack myapp.c -o myapp + + +### Code Example ```CPP #include #include - + int main(void) { // This is target object. std::vector target; target.push_back("Hello,"); target.push_back("World!"); - + // Serialize it. msgpack::sbuffer sbuf; // simple buffer msgpack::pack(&sbuf, target); - + // Deserialize the serialized data. msgpack::unpacked msg; // includes memory pool and deserialized object msgpack::unpack(&msg, sbuf.data(), sbuf.size()); msgpack::object obj = msg.get(); - + // Print the deserialized object to stdout. std::cout << obj << std::endl; // ["Hello," "World!"] - + // Convert the deserialized object to staticaly typed object. std::vector result; obj.convert(&result); - + // If the type is mismatched, it throws msgpack::type_error. obj.as(); // type is mismatched, msgpack::type_error is thrown } ``` +### Quickstart Guides -See [QuickStart for C](QUICKSTART-C.md) and [QuickStart for C++](QUICKSTART-CPP.md) for other example codes. - -## License - - Copyright (C) 2008-2010 FURUHASHI Sadayuki - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -See also NOTICE file. - +For more detailed examples see [QuickStart for C](QUICKSTART-C.md) and [QuickStart for C++](QUICKSTART-CPP.md). From 4e0a6ae624276ca1b2e811bec7b84785e190bd32 Mon Sep 17 00:00:00 2001 From: Nobuyuki Kubota Date: Sun, 22 Dec 2013 21:04:53 -0800 Subject: [PATCH 2/2] Fixed some URL syntaxes --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d17a2d7a..4032cd47 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Msgpack for C/C++ + It's like JSON but small and fast. + ## Overview MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves. -Binary-based efficient object serialization library. ## License @@ -40,12 +41,12 @@ $ sudo make install ##### UNIX-like platform with ./configure -On typical UNIX-like platforms, download source package from [Releases|http://msgpack.org/releases/cpp/] and run `./configure && make && make install`. Example: +On typical UNIX-like platforms, download source package from [Releases](https://github.com/msgpack/msgpack-c/releases) and run `./configure && make && make install`. Example: ``` -$ wget http://msgpack.org/releases/cpp/msgpack-0.5.5.tar.gz -$ tar zxvf msgpack-0.5.5.tar.gz -$ cd msgpack-0.5.5 +$ wget https://github.com/msgpack/msgpack-c/releases/download/cpp-0.5.8/msgpack-0.5.8.tar.gz +$ tar zxvf msgpack-0.5.8.tar.gz +$ cd msgpack-0.5.8 $ ./configure $ make $ sudo make install @@ -53,13 +54,11 @@ $ sudo make install ##### FreeBSD with Ports Collection -On FreeBSD, you can use Ports Collection. Install [net/msgpack|http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/] package. - +On FreeBSD, you can use Ports Collection. Install [net/msgpack](http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/) package. ##### Gentoo Linux with Portage -On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack|http://gentoo-portage.com/dev-libs/msgpack] package. - +On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack](http://gentoo-portage.com/dev-libs/msgpack) package. ##### Mac OS X with MacPorts @@ -80,7 +79,7 @@ $ sudo brew install msgpack ##### Windows -On Windows, download source package from [here|https://sourceforge.net/projects/msgpack/files/] and extract it. Open `msgpack_vc8.vcproj` or msgpack_vc2008 file and build it using batch build. It builds libraries in `lib/` folder and header files in `include/` folder. +On Windows, download source package from [here](https://sourceforge.net/projects/msgpack/files/) and extract it. Open `msgpack_vc8.vcproj` or msgpack_vc2008 file and build it using batch build. It builds libraries in `lib/` folder and header files in `include/` folder. You can build using command line as follows: