| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 1 | Apache Thrift (an Apache Incubator project) | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 2 |  | 
| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 3 | Last Modified: 2009-Jan-30 | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 4 |  | 
| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 5 | Thrift is distributed under the Apache License, v2.0. Please see the | 
 | 6 | included LICENSE file. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 7 |  | 
 | 8 | Introduction | 
 | 9 | ============ | 
 | 10 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 11 | Thrift is a lightweight, language-independent software stack with an | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 12 | associated code generation mechanism for RPC. Thrift provides clean | 
 | 13 | abstractions for data transport, data serialization, and application | 
 | 14 | level processing. The code generation system takes a simple definition | 
 | 15 | language as its input and generates code across programming languages that | 
 | 16 | uses the abstracted stack to build interoperable RPC clients and servers. | 
 | 17 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 18 | Thrift is specifically designed to support non-atomic version changes | 
 | 19 | across client and server code. | 
 | 20 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 21 | For more details on Thrift's design and implementation, take a gander at | 
 | 22 | the Thrift whitepaper included in this distribution or at the README files | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 23 | in your particular subdirectory of interest. | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 24 |  | 
 | 25 | Heirarchy | 
 | 26 | ========= | 
 | 27 |  | 
 | 28 | thrift/ | 
 | 29 |  | 
 | 30 |   compiler/ | 
 | 31 |     Contains the Thrift compiler, implemented in C++. | 
 | 32 |  | 
 | 33 |   lib/ | 
 | 34 |     Contains the Thrift software library implementation, subdivided by | 
 | 35 |     language of implementation. | 
 | 36 |  | 
 | 37 |     cpp/ | 
 | 38 |     java/ | 
 | 39 |     php/ | 
 | 40 |     py/ | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 41 |     rb/ | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 42 |  | 
 | 43 |   test/ | 
 | 44 |  | 
 | 45 |     Contains sample Thrift files and test code across the target programming | 
 | 46 |     languages. | 
 | 47 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 48 |   tutorial/ | 
 | 49 |  | 
 | 50 |     Contains a basic tutorial that will teach you how to develop software | 
 | 51 |     using Thrift. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 52 |  | 
 | 53 | Requirements | 
 | 54 | ============ | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 55 |  | 
 | 56 | Thrift requires boost shared pointers from boost-1.33.1 or greater, see: | 
 | 57 | http://www.boost.org/libs/smart_ptr/smart_ptr.htm | 
 | 58 |  | 
 | 59 | Some portions of Thrift also depend upon libevent, see: | 
 | 60 | http://monkey.org/~provos/libevent/ | 
 | 61 |  | 
| David Reiss | b72d19f | 2007-09-18 19:46:00 +0000 | [diff] [blame] | 62 | Some portions of Thrift also depend upon zlib, see: | 
 | 63 | http://www.zlib.net/ | 
 | 64 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 65 | These libraries are open source and may be freely obtained, but they are not | 
 | 66 | provided as a part of this distribution. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 67 |  | 
 | 68 | Resources | 
 | 69 | ========= | 
 | 70 |  | 
 | 71 | More information about Thrift can be obtained on the Thrift webpage at: | 
 | 72 |  | 
| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 73 |      http://incubator.apache.org/thrift | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 74 |  | 
 | 75 | Acknowledgments | 
 | 76 | =============== | 
 | 77 |  | 
| Greg Stein | f0d35d2 | 2009-01-30 19:10:27 +0000 | [diff] [blame] | 78 | Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo, | 
 | 79 | and also by Google's protocol buffers. | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 80 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 81 | Installation | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 82 | ============ | 
 | 83 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 84 | If you are building from the first time out of the source repository, you will | 
| David Reiss | b72d19f | 2007-09-18 19:46:00 +0000 | [diff] [blame] | 85 | need to generate the configure scripts.  (This is not necessary if you | 
 | 86 | downloaded a tarball.)  From the top directory, do: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 87 |  | 
 | 88 | 	./bootstrap.sh | 
 | 89 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 90 | Once the configure scripts are generated, thrift can be configured. | 
 | 91 | From the top directory, do: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 92 |  | 
 | 93 | 	./configure | 
 | 94 |  | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 95 | You may need to specify the location of the boost files explicitly. | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 96 | If you installed boost in /usr/local, you would run configure as follows: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 97 |  | 
 | 98 | 	./configure --with-boost=/usr/local | 
 | 99 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 100 | Note that by default the thrift C++ library is typically built with debugging | 
 | 101 | symbols included. If you want to customize these options you should use the | 
 | 102 | CXXFLAGS option in configure, as such: | 
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 103 |  | 
| Mark Slee | 3303f36 | 2007-03-05 20:09:37 +0000 | [diff] [blame] | 104 |         ./configure CXXFLAGS='-g -O2' | 
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 105 |         ./configure CFLAGS='-g -O2' | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 106 |         ./configure CPPFLAGS='-DDEBUG_MY_FEATURE' | 
| Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 107 |  | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 108 | Run ./configure --help to see other configuration options | 
 | 109 |  | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 110 | Please be aware that the Python library will ignore the --prefix option | 
 | 111 | and just install wherever Python's distutils puts it (usually along | 
| David Reiss | d683219 | 2007-09-05 00:47:32 +0000 | [diff] [blame] | 112 | the lines of /usr/lib/pythonX.Y/site-packages/).  If you need to control | 
 | 113 | where the Python modules are installed, set the PY_PREFIX variable. | 
 | 114 | (DESTDIR is respected for Python and C++.) | 
| David Reiss | aea19c9 | 2007-08-29 23:17:32 +0000 | [diff] [blame] | 115 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 116 | Make thrift: | 
| Marc Slemko | 9de5a5c | 2006-08-23 22:34:00 +0000 | [diff] [blame] | 117 |  | 
 | 118 | 	make | 
 | 119 |  | 
 | 120 | From the top directory, become superuser and do: | 
 | 121 |  | 
 | 122 | 	make install | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 123 |  | 
| Mark Slee | 227ac2c | 2007-03-07 05:46:50 +0000 | [diff] [blame] | 124 | Note that some language packages must be installed manually using build tools | 
 | 125 | better suited to those languages (at the time of this writing, this applies | 
 | 126 | to Java, Ruby, PHP). | 
 | 127 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 128 | Look for the README file in the lib/<language>/ folder for more details on the | 
 | 129 | installation of each language library package. |