thrift/tutorial
Thomas Petazzoni 1744cdcb67 configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation
The thrift build system currently assumes that the thrift compiler is
always available in $(top_builddir)/compiler/cpp/thrift. However, in a
cross-compilation context, this location contains the thrift compiler
built for the target... which obviously will not run on the build
machine.

In order to support such cross-compilation situation, we introduce the
THRIFT variable as a an argument for the configure script (using
AC_ARG_VAR). If not specified, it defaults to the existing value of
using compiler/cpp/thrift from the build directory, but it can be
overridden when calling ./configure.

Note that $(top_builddir) cannot be used within the configure script,
so we simply use `pwd`, which is the same as the top_builddir.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

This closes #1336
This closes #1350
2017-09-09 07:50:54 -07:00
..
as3 THRIFT-2392: Actionscript tutorial 2014-03-11 22:21:07 -04:00
c_glib configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
cpp configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
csharp THRIFT-4014 align C# meta data in AssemblyInfo.cs 2016-12-26 11:33:03 +01:00
d THRIFT-3666 Build D tutorial as part of Autotools build 2016-02-27 17:17:27 +09:00
dart configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
delphi THRIFT-2768: Whitespace Fixup 2014-10-03 20:12:40 +02:00
erl THRIFT-4313: Program code of the Erlang tutorial files contain syntax errors. 2017-09-05 13:43:46 -07:00
go configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
haxe configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
hs THRIFT-727 - C++: what() method of generated exceptions will provide more information 2015-05-18 19:47:23 +02:00
java Build fails using Java 1.8 with Ant < 1.9 2017-01-25 20:34:04 -05:00
js Build fails using Java 1.8 with Ant < 1.9 2017-01-25 20:34:04 -05:00
netcore THRIFT-4039 Update of Apache Thrift .Net Core lib 2017-01-25 00:04:45 +01:00
nodejs configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
ocaml THRIFT-727 - C++: what() method of generated exceptions will provide more information 2015-05-18 19:47:23 +02:00
perl THRIFT-727 - C++: what() method of generated exceptions will provide more information 2015-05-18 19:47:23 +02:00
php THRIFT-3596 Better conformance to PEP8 2016-02-04 14:28:24 +09:00
py configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
py.tornado configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
py.twisted configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
rb configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation 2017-09-09 07:50:54 -07:00
rs THRIFT-4176: Implement threaded server for Rust 2017-04-27 08:46:02 -04:00
Makefile.am THRIFT-2945 Add Rust support 2017-01-26 01:34:16 +01:00
README.md THRIFT-2407 use markdown (rename README => README.md) 2014-03-19 06:47:47 +01:00
shared.thrift THRIFT-3933 Microsoft .Net Core library port and generator for this library 2017-01-04 19:40:30 +01:00
tutorial.thrift THRIFT-3933 Microsoft .Net Core library port and generator for this library 2017-01-04 19:40:30 +01:00

Thrift Tutorial

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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.

Tutorial

  1. First things first, you'll need to install the Thrift compiler and the language libraries. Do that using the instructions in the top level README.md file.

  2. Read tutorial.thrift to learn about the syntax of a Thrift file

  3. Compile the code for the language of your choice:

    $ thrift $ thrift -r --gen cpp tutorial.thrift

  4. Take a look at the generated code.

  5. Look in the language directories for sample client/server code.

  6. That's about it for now. This tutorial is intentionally brief. It should be just enough to get you started and ready to build your own project.