Patchwork [5/5] thrift: new package

login
register
mail settings
Submitter Gustavo Zacarias
Date Oct. 25, 2013, 12:15 p.m.
Message ID <1382703323-31038-5-git-send-email-gustavo@zacarias.com.ar>
Download mbox | patch
Permalink /patch/286135/
State Superseded
Headers show

Comments

Gustavo Zacarias - Oct. 25, 2013, 12:15 p.m.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/Config.in                             |  1 +
 package/thrift/Config.in                      | 22 +++++++++++
 package/thrift/thrift-01-libevent-cross.patch | 16 ++++++++
 package/thrift/thrift-02-autoreconf.patch     | 22 +++++++++++
 package/thrift/thrift-03-zlib-cross.patch     | 16 ++++++++
 package/thrift/thrift.mk                      | 54 +++++++++++++++++++++++++++
 6 files changed, 131 insertions(+)
 create mode 100644 package/thrift/Config.in
 create mode 100644 package/thrift/thrift-01-libevent-cross.patch
 create mode 100644 package/thrift/thrift-02-autoreconf.patch
 create mode 100644 package/thrift/thrift-03-zlib-cross.patch
 create mode 100644 package/thrift/thrift.mk
Ryan Barnett - Oct. 26, 2013, 3:12 a.m.
Gustavo,

Please see my comments below.

Gustavo Zacarias <gustavo@zacarias.com.ar> wrote on 10/25/2013 07:15:23 
AM:

> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  package/Config.in                             |  1 +
>  package/thrift/Config.in                      | 22 +++++++++++
>  package/thrift/thrift-01-libevent-cross.patch | 16 ++++++++
>  package/thrift/thrift-02-autoreconf.patch     | 22 +++++++++++
>  package/thrift/thrift-03-zlib-cross.patch     | 16 ++++++++
>  package/thrift/thrift.mk                      | 54 
+++++++++++++++++++++++++++
>  6 files changed, 131 insertions(+)
>  create mode 100644 package/thrift/Config.in
>  create mode 100644 package/thrift/thrift-01-libevent-cross.patch
>  create mode 100644 package/thrift/thrift-02-autoreconf.patch
>  create mode 100644 package/thrift/thrift-03-zlib-cross.patch
>  create mode 100644 package/thrift/thrift.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 16cb36d..319b7d5 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -639,6 +639,7 @@ source "package/openpgm/Config.in"
>  source "package/ortp/Config.in"
>  source "package/slirp/Config.in"
>  source "package/snmppp/Config.in"
> +source "package/thrift/Config.in"
>  source "package/usbredir/Config.in"
>  source "package/wvstreams/Config.in"
>  source "package/zeromq/Config.in"
> diff --git a/package/thrift/Config.in b/package/thrift/Config.in
> new file mode 100644
> index 0000000..38a8897
> --- /dev/null
> +++ b/package/thrift/Config.in
> @@ -0,0 +1,22 @@
> +config BR2_PACKAGE_THRIFT
> +   bool "thrift"
> +   depends on BR2_INSTALL_LIBSTDCPP
> +   depends on BR2_USE_WCHAR
> +   depends on BR2_LARGEFILE
> +   depends on BR2_TOOLCHAIN_HAS_THREADS
> +   select BR2_PACKAGE_BOOST
> +   select BR2_PACKAGE_LIBEVENT
> +   select BR2_PACKAGE_OPENSSL
> +   help
> +     The Apache Thrift software framework, for scalable cross-language
> +     services development, combines a software stack with a
> +     code generation engine to build services that work
> +     efficiently and seamlessly between C++, Java, Python, PHP, Ruby,
> +     Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk,
> +     OCaml and Delphi and other languages.
> +
> +     http://thrift.apache.org/
> +
> +comment "thrift needs a toolchain w/ C++, largefile, wchar, threads"
> +   depends on !BR2_LARGEFILE || !BR2_USE_WCHAR || \
> +      !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/thrift/thrift-01-libevent-cross.patch 
b/package/thrift/thrift-01-libevent-cross.patch
> new file mode 100644
> index 0000000..f07caa7
> --- /dev/null
> +++ b/package/thrift/thrift-01-libevent-cross.patch
> @@ -0,0 +1,16 @@
> +Make it cross-compile happy the hard way, there's no clean way.
> +
> +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> +
> +diff -Nura thrift-0.9.1.orig/aclocal/ax_lib_event.m4 
thrift-0.9.1/aclocal/ax_lib_event.m4
> +--- thrift-0.9.1.orig/aclocal/ax_lib_event.m4   2013-08-15 
11:04:29.000000000 -0300
> ++++ thrift-0.9.1/aclocal/ax_lib_event.m4   2013-10-07 
20:40:44.076435613 -0300
> +@@ -75,7 +75,7 @@
> +           AC_LANG_PUSH([C])
> +           dnl This can be changed to AC_LINK_IFELSE if you are 
cross-compiling,
> +           dnl but then the version cannot be checked.
> +-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
> ++          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> +           #include <sys/types.h>
> +           #include <event.h>
> +           ]], [[
> diff --git a/package/thrift/thrift-02-autoreconf.patch 
b/package/thrift/thrift-02-autoreconf.patch
> new file mode 100644
> index 0000000..d56212a
> --- /dev/null
> +++ b/package/thrift/thrift-02-autoreconf.patch
> @@ -0,0 +1,22 @@
> +Fillers to make autoreconf (automake) happy.
> +
> +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> +
> +diff -Nura thrift-0.9.1.orig/AUTHORS thrift-0.9.1/AUTHORS
> +--- thrift-0.9.1.orig/AUTHORS   1969-12-31 21:00:00.000000000 -0300
> ++++ thrift-0.9.1/AUTHORS   2013-10-07 20:45:15.745315148 -0300
> +@@ -0,0 +1,2 @@
> ++
> ++
> +diff -Nura thrift-0.9.1.orig/ChangeLog thrift-0.9.1/ChangeLog
> +--- thrift-0.9.1.orig/ChangeLog   1969-12-31 21:00:00.000000000 -0300
> ++++ thrift-0.9.1/ChangeLog   2013-10-07 20:45:23.078554836 -0300
> +@@ -0,0 +1,2 @@
> ++
> ++
> +diff -Nura thrift-0.9.1.orig/NEWS thrift-0.9.1/NEWS
> +--- thrift-0.9.1.orig/NEWS   1969-12-31 21:00:00.000000000 -0300
> ++++ thrift-0.9.1/NEWS   2013-10-07 20:45:20.351465699 -0300
> +@@ -0,0 +1,2 @@
> ++
> ++
> diff --git a/package/thrift/thrift-03-zlib-cross.patch 
b/package/thrift/thrift-03-zlib-cross.patch
> new file mode 100644
> index 0000000..3af39c4
> --- /dev/null
> +++ b/package/thrift/thrift-03-zlib-cross.patch
> @@ -0,0 +1,16 @@
> +Make zlib version detection cross-compile happy.
> +
> +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> +
> +diff -Nura thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4 
thrift-0.9.1/aclocal/ax_lib_zlib.m4
> +--- thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4   2013-08-15 
11:04:29.000000000 -0300
> ++++ thrift-0.9.1/aclocal/ax_lib_zlib.m4   2013-10-07 20:47:44.523177973 
-0300
> +@@ -73,7 +73,7 @@
> +           #   (defined in the library).
> +           AC_LANG_PUSH([C])
> +           dnl This can be changed to AC_LINK_IFELSE if you are 
cross-compiling.
> +-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
> ++          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> +           #include <zlib.h>
> +           #if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
> +           #else
> diff --git a/package/thrift/thrift.mk b/package/thrift/thrift.mk
> new file mode 100644
> index 0000000..53e1b97
> --- /dev/null
> +++ b/package/thrift/thrift.mk
> @@ -0,0 +1,54 @@
> 
+################################################################################
> +#
> +# thrift
> +#
> 
+################################################################################
> +
> +THRIFT_VERSION = 0.9.1
> +THRIFT_SITE = http://www.us.apache.org/dist/thrift/$(THRIFT_VERSION)
> +THRIFT_DEPENDENCIES = host-pkgconf host-thrift boost libevent openssl
> +HOST_THRIFT_DEPENDENCIES = host-boost host-libevent host-openssl 
host-pkgconf
> +THRIFT_CONF_OPT = --with-sysroot=$(STAGING_DIR) --with-tests=no \
> +   --with-boost=$(STAGING_DIR)
> +HOST_THRIFT_CONF_OPT = --with-sysroot=$(HOST_DIR) --with-tests=no
> +THRIFT_AUTORECONF = YES

Could you move the license to right below the site? It doesn't really 
matter but I guess I like to see version, site, license as the first 
things in a package. I guess there isn't any official standard to the way 
a package makefile should be in but I guess that is just my person 
preference. 

> +THRIFT_LICENSE = Apache 2.0
> +THRIFT_LICENSE_FILES = LICENSE
> +
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +# openssl uses zlib, so we need to explicitly link with it when static
> +THRIFT_CONF_ENV += LIBS=-lz

Shouldn't you add a dependancy on libz then?

THRIFT_DEPENDCIES += zlib

> +endif
> +
> +# Language selection
> +# The generator (host tool) works with all of them regardless
> +# This is just for the libraries / bindings
> +THRIFT_LANG_CONF_OPT += --without-csharp --without-java 
--without-erlang \
> +   --without-python --without-perl --without-php 
--without-php_extension \
> +   --without-ruby --without-haskell --without-go --without-d
> +HOST_THRIFT_CONF_OPT += $(THRIFT_LANG_CONF_OPT) --without-c_glib
> +THRIFT_CONF_OPT += $(THRIFT_LANG_CONF_OPT)
> +
> +# C bindings
> +ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
> +THRIFT_DEPENDENCIES += libglib2
> +else
> +THRIFT_CONF_OPT += --without-c_glib
> +endif
> +
> +# De-hardcode THRIFT for cross compiling
> +define THRIFT_BUILD_CMDS
> +   for f in `find $(@D) -name Makefile -type f`; do \
> +      $(SED) "/^THRIFT =/d" $$f; \
> +   done
> +   $(SED) "s:top_builddir)/compiler/cpp/thrift:THRIFT):" 
$(@D)/tutorial/Makefile
> +   $(TARGET_MAKE_ENV) $(MAKE) THRIFT=$(HOST_DIR)/usr/bin/thrift -C 
$(@D)
> +endef
> +

I haven't tested this so I don't fully understand what exactly what you 
are doing here. I see that this is an autotools package but it doesn't 
appear to be building or installing using the autotools infrastructure. 
Could you please elaborate a little bit more of why exactly you can't use 
autotoools to build for this? I believe I understand what you are doing 
here but I guess I would like a few more details from you. 

Also it looks like thrift is a compiler, so wouldn't we want to have this 
available as a host tool because presumably there would be a need to to 
add custom user packages that utilize Thrift to compile their application. 
Again I haven't had time to read further what exactly thrift does but 
these are just the few things that are coming to my mind tonight.

I will try to investigate this a little bit more in the coming days (next 
week) but for now this are my initial reaction comments.

> +# Install runtime only
> +define THRIFT_INSTALL_TARGET_CMDS
> +   $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/lib DESTDIR=$(TARGET_DIR) 
install
> +endef
> +
> +$(eval $(autotools-package))
> +$(eval $(host-autotools-package))
> -- 
> 1.8.1.5

Thanks,
-Ryan
Gustavo Zacarias - Oct. 26, 2013, 9:48 a.m.
On 10/26/2013 12:12 AM, Ryan Barnett wrote:
> Could you move the license to right below the site? It doesn't really 
> matter but I guess I like to see version, site, license as the first 
> things in a package. I guess there isn't any official standard to the way 
> a package makefile should be in but I guess that is just my person 
> preference. 

Huh, that's very OCD :)
There are several packages that don't keep them ordered, specially those

>> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
>> +# openssl uses zlib, so we need to explicitly link with it when static
>> +THRIFT_CONF_ENV += LIBS=-lz
> 
> Shouldn't you add a dependancy on libz then?
> 
> THRIFT_DEPENDCIES += zlib

It's implicit from openssl, we don't build openssl without zlib (it's
possible to do so, but not really that useful and would complicate other
packages).

> I haven't tested this so I don't fully understand what exactly what you 
> are doing here. I see that this is an autotools package but it doesn't 
> appear to be building or installing using the autotools infrastructure. 
> Could you please elaborate a little bit more of why exactly you can't use 
> autotoools to build for this? I believe I understand what you are doing 
> here but I guess I would like a few more details from you. 
> 
> Also it looks like thrift is a compiler, so wouldn't we want to have this 
> available as a host tool because presumably there would be a need to to 
> add custom user packages that utilize Thrift to compile their application. 
> Again I haven't had time to read further what exactly thrift does but 
> these are just the few things that are coming to my mind tonight.
> 
> I will try to investigate this a little bit more in the coming days (next 
> week) but for now this are my initial reaction comments.

A quick overlook then.
Thrift is basically a compiler and runtime libs.
The compiler component is only useful for the host because we don't do
development on the target any more, that would be host-boost, which IS
actually using autotools infra (no defines overriding HOST_THRIFT_*_CMDS).
For the target the INSTALL phase has an override to just install the
runtime libraries and avoid the compiler, tests and examples.
The target BUILD override patches the thrift makefiles to use $(THRIFT)
rather than hardcode it (the for-SED loop), and builds passing $(THRIFT)
to the appropiate host-compiled one (since it's hell bent on using it's
own built one which would be cross and wouldn't run).
This is a double catch though, i wanted to build examples as a sane way
to test it that things are ok but not install them.
Regards.
Arnout Vandecappelle - Oct. 28, 2013, 7:24 a.m.
On 26/10/13 11:48, Gustavo Zacarias wrote:
> On 10/26/2013 12:12 AM, Ryan Barnett wrote:
>> Could you move the license to right below the site? It doesn't really
>> matter but I guess I like to see version, site, license as the first
>> things in a package. I guess there isn't any official standard to the way
>> a package makefile should be in but I guess that is just my person
>> preference.
>
> Huh, that's very OCD :)

  But not as much as requiring 80 hashes in the header :-)

> There are several packages that don't keep them ordered, specially those

  It's not because it wasn't done right in the past that it shouldn't be 
done right now :-)


  I agree with Ryan that it would be a good idea to standardize on some 
order of the variable definitions. But since there is not standard at the 
moment, we have to wait for an edict from Peter before we can enforce it.


[snip]
>>> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
>>> +# openssl uses zlib, so we need to explicitly link with it when static
>>> +THRIFT_CONF_ENV += LIBS=-lz
>>
>> Shouldn't you add a dependancy on libz then?
>>
>> THRIFT_DEPENDCIES += zlib
>
> It's implicit from openssl, we don't build openssl without zlib (it's
> possible to do so, but not really that useful and would complicate other
> packages).

  That it's implicit from openssl is not really relevant - if the 
dependency is ever removed from openssl (OK, this will not happen, but 
just imagine) then we'd like to keep the correct dependency here.

>
>> I haven't tested this so I don't fully understand what exactly what you
>> are doing here. I see that this is an autotools package but it doesn't
>> appear to be building or installing using the autotools infrastructure.
>> Could you please elaborate a little bit more of why exactly you can't use
>> autotoools to build for this? I believe I understand what you are doing
>> here but I guess I would like a few more details from you.
>>
>> Also it looks like thrift is a compiler, so wouldn't we want to have this
>> available as a host tool because presumably there would be a need to to
>> add custom user packages that utilize Thrift to compile their application.
>> Again I haven't had time to read further what exactly thrift does but
>> these are just the few things that are coming to my mind tonight.
>>
>> I will try to investigate this a little bit more in the coming days (next
>> week) but for now this are my initial reaction comments.
>
> A quick overlook then.
> Thrift is basically a compiler and runtime libs.
> The compiler component is only useful for the host because we don't do
> development on the target any more, that would be host-boost, which IS
> actually using autotools infra (no defines overriding HOST_THRIFT_*_CMDS).
> For the target the INSTALL phase has an override to just install the
> runtime libraries and avoid the compiler, tests and examples.
> The target BUILD override patches the thrift makefiles to use $(THRIFT)
> rather than hardcode it (the for-SED loop), and builds passing $(THRIFT)
> to the appropiate host-compiled one (since it's hell bent on using it's
> own built one which would be cross and wouldn't run).
> This is a double catch though, i wanted to build examples as a sane way
> to test it that things are ok but not install them.

  It would be nicer though if that could be done with an upstreamable 
patch, but I think you said before that it wasn't going to happen.

  I do think that your sed magic should be done in POST_PATCH_HOOKS on 
the Makefile.am, though. Patching up the generated Makefiles just feels 
icky to me.

  Regards,
  Arnout
Gustavo Zacarias - Oct. 28, 2013, 11:02 a.m.
On 10/28/2013 04:24 AM, Arnout Vandecappelle wrote:

>  But not as much as requiring 80 hashes in the header :-)

Pfffft, that's not mine :)

>  It's not because it wasn't done right in the past that it shouldn't be
> done right now :-)

Some licenses were defined a few days ago that weren't the last lines
before defines and nobody said anything, you should have shown up then :P

>  I agree with Ryan that it would be a good idea to standardize on some
> order of the variable definitions. But since there is not standard at
> the moment, we have to wait for an edict from Peter before we can
> enforce it.

Propose it then and get it rolling, for the time being there's no rule
about it.

>  That it's implicit from openssl is not really relevant - if the
> dependency is ever removed from openssl (OK, this will not happen, but
> just imagine) then we'd like to keep the correct dependency here.

Ok.
All the packages that use openssl should be checked though, almost none
of them do zlib either (doesn't mean they use it directly, but a good
check wouldn't hurt).

>  It would be nicer though if that could be done with an upstreamable
> patch, but I think you said before that it wasn't going to happen.
> 
>  I do think that your sed magic should be done in POST_PATCH_HOOKS on
> the Makefile.am, though. Patching up the generated Makefiles just feels
> icky to me.

I don't think i've said that, but i might be wrong.
At the moment i prefer SED rather than a patch because there are many
instances around, i'll try reaching upstream to see how receptive they
are to a patch that just defines THRIFT ?= .. for a clean cross build.
It was a leftover from a quick hack to get it to build properly that
i've overlooked when cleaning up.
Fixed, i'll send a revised patchset soon.
Regards.
Ryan Barnett - Oct. 28, 2013, 2:11 p.m.
Gustavo, Arnout,

Gustavo Zacarias <gustavo@zacarias.com.ar> wrote on 10/28/2013 06:02:30 
AM:

> On 10/28/2013 04:24 AM, Arnout Vandecappelle wrote:
> 
> >  But not as much as requiring 80 hashes in the header :-)
> 
> Pfffft, that's not mine :)
> 
> >  It's not because it wasn't done right in the past that it shouldn't 
be
> > done right now :-)
> 
> Some licenses were defined a few days ago that weren't the last lines
> before defines and nobody said anything, you should have shown up then 
:P
> 
> >  I agree with Ryan that it would be a good idea to standardize on some
> > order of the variable definitions. But since there is not standard at
> > the moment, we have to wait for an edict from Peter before we can
> > enforce it.
> 
> Propose it then and get it rolling, for the time being there's no rule
> about it.

I never was intending for you to change it, rather it was a suggestion and 
I don't have any standard to fall back on to back me up. 

> >  That it's implicit from openssl is not really relevant - if the
> > dependency is ever removed from openssl (OK, this will not happen, but
> > just imagine) then we'd like to keep the correct dependency here.
> 
> Ok.
> All the packages that use openssl should be checked though, almost none
> of them do zlib either (doesn't mean they use it directly, but a good
> check wouldn't hurt).

I guess all I really care about is a comment in regards to zlib being 
built from having dependancy on openssl. I don't always remember these 
things so just a friendly reminder comment is good enough.

Thanks,
-Ryan
Gustavo Zacarias - Oct. 28, 2013, 2:21 p.m.
On 10/28/2013 11:11 AM, Ryan Barnett wrote:

>>>  That it's implicit from openssl is not really relevant - if the
>>> dependency is ever removed from openssl (OK, this will not happen, but
>>> just imagine) then we'd like to keep the correct dependency here.
>>
>> Ok.
>> All the packages that use openssl should be checked though, almost none
>> of them do zlib either (doesn't mean they use it directly, but a good
>> check wouldn't hurt).
> 
> I guess all I really care about is a comment in regards to zlib being 
> built from having dependancy on openssl. I don't always remember these 
> things so just a friendly reminder comment is good enough.

Point is thrift has a hard dependency on zlib right now (regardless of
openssl, for channel compression) so it is a dependency.
It can be built without it and loose the TZlibTransport but really it's
already pulled in by openssl so making it optional is kind of pointless.
What should be checked is the same holding true for other packages that
do use openssl and _maybe_ use zlib as well in a separate fashion which
haven't accounted for it (like thrift).
So the comment itself wouldn't apply, pulling in zlib does (select +
DEPENDENCIES) which is what i'm doing for the next patchset version.
Regards.

Patch

diff --git a/package/Config.in b/package/Config.in
index 16cb36d..319b7d5 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -639,6 +639,7 @@  source "package/openpgm/Config.in"
 source "package/ortp/Config.in"
 source "package/slirp/Config.in"
 source "package/snmppp/Config.in"
+source "package/thrift/Config.in"
 source "package/usbredir/Config.in"
 source "package/wvstreams/Config.in"
 source "package/zeromq/Config.in"
diff --git a/package/thrift/Config.in b/package/thrift/Config.in
new file mode 100644
index 0000000..38a8897
--- /dev/null
+++ b/package/thrift/Config.in
@@ -0,0 +1,22 @@ 
+config BR2_PACKAGE_THRIFT
+	bool "thrift"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_USE_WCHAR
+	depends on BR2_LARGEFILE
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_BOOST
+	select BR2_PACKAGE_LIBEVENT
+	select BR2_PACKAGE_OPENSSL
+	help
+	  The Apache Thrift software framework, for scalable cross-language
+	  services development, combines a software stack with a
+	  code generation engine to build services that work
+	  efficiently and seamlessly between C++, Java, Python, PHP, Ruby,
+	  Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk,
+	  OCaml and Delphi and other languages.
+
+	  http://thrift.apache.org/
+
+comment "thrift needs a toolchain w/ C++, largefile, wchar, threads"
+	depends on !BR2_LARGEFILE || !BR2_USE_WCHAR || \
+		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/thrift/thrift-01-libevent-cross.patch b/package/thrift/thrift-01-libevent-cross.patch
new file mode 100644
index 0000000..f07caa7
--- /dev/null
+++ b/package/thrift/thrift-01-libevent-cross.patch
@@ -0,0 +1,16 @@ 
+Make it cross-compile happy the hard way, there's no clean way.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura thrift-0.9.1.orig/aclocal/ax_lib_event.m4 thrift-0.9.1/aclocal/ax_lib_event.m4
+--- thrift-0.9.1.orig/aclocal/ax_lib_event.m4	2013-08-15 11:04:29.000000000 -0300
++++ thrift-0.9.1/aclocal/ax_lib_event.m4	2013-10-07 20:40:44.076435613 -0300
+@@ -75,7 +75,7 @@
+           AC_LANG_PUSH([C])
+           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling,
+           dnl but then the version cannot be checked.
+-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
++          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+           #include <sys/types.h>
+           #include <event.h>
+           ]], [[
diff --git a/package/thrift/thrift-02-autoreconf.patch b/package/thrift/thrift-02-autoreconf.patch
new file mode 100644
index 0000000..d56212a
--- /dev/null
+++ b/package/thrift/thrift-02-autoreconf.patch
@@ -0,0 +1,22 @@ 
+Fillers to make autoreconf (automake) happy.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura thrift-0.9.1.orig/AUTHORS thrift-0.9.1/AUTHORS
+--- thrift-0.9.1.orig/AUTHORS	1969-12-31 21:00:00.000000000 -0300
++++ thrift-0.9.1/AUTHORS	2013-10-07 20:45:15.745315148 -0300
+@@ -0,0 +1,2 @@
++
++
+diff -Nura thrift-0.9.1.orig/ChangeLog thrift-0.9.1/ChangeLog
+--- thrift-0.9.1.orig/ChangeLog	1969-12-31 21:00:00.000000000 -0300
++++ thrift-0.9.1/ChangeLog	2013-10-07 20:45:23.078554836 -0300
+@@ -0,0 +1,2 @@
++
++
+diff -Nura thrift-0.9.1.orig/NEWS thrift-0.9.1/NEWS
+--- thrift-0.9.1.orig/NEWS	1969-12-31 21:00:00.000000000 -0300
++++ thrift-0.9.1/NEWS	2013-10-07 20:45:20.351465699 -0300
+@@ -0,0 +1,2 @@
++
++
diff --git a/package/thrift/thrift-03-zlib-cross.patch b/package/thrift/thrift-03-zlib-cross.patch
new file mode 100644
index 0000000..3af39c4
--- /dev/null
+++ b/package/thrift/thrift-03-zlib-cross.patch
@@ -0,0 +1,16 @@ 
+Make zlib version detection cross-compile happy.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4 thrift-0.9.1/aclocal/ax_lib_zlib.m4
+--- thrift-0.9.1.orig/aclocal/ax_lib_zlib.m4	2013-08-15 11:04:29.000000000 -0300
++++ thrift-0.9.1/aclocal/ax_lib_zlib.m4	2013-10-07 20:47:44.523177973 -0300
+@@ -73,7 +73,7 @@
+           #   (defined in the library).
+           AC_LANG_PUSH([C])
+           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling.
+-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
++          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+           #include <zlib.h>
+           #if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
+           #else
diff --git a/package/thrift/thrift.mk b/package/thrift/thrift.mk
new file mode 100644
index 0000000..53e1b97
--- /dev/null
+++ b/package/thrift/thrift.mk
@@ -0,0 +1,54 @@ 
+################################################################################
+#
+# thrift
+#
+################################################################################
+
+THRIFT_VERSION = 0.9.1
+THRIFT_SITE = http://www.us.apache.org/dist/thrift/$(THRIFT_VERSION)
+THRIFT_DEPENDENCIES = host-pkgconf host-thrift boost libevent openssl
+HOST_THRIFT_DEPENDENCIES = host-boost host-libevent host-openssl host-pkgconf
+THRIFT_CONF_OPT = --with-sysroot=$(STAGING_DIR) --with-tests=no \
+	--with-boost=$(STAGING_DIR)
+HOST_THRIFT_CONF_OPT = --with-sysroot=$(HOST_DIR) --with-tests=no
+THRIFT_AUTORECONF = YES
+THRIFT_LICENSE = Apache 2.0
+THRIFT_LICENSE_FILES = LICENSE
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+# openssl uses zlib, so we need to explicitly link with it when static
+THRIFT_CONF_ENV += LIBS=-lz
+endif
+
+# Language selection
+# The generator (host tool) works with all of them regardless
+# This is just for the libraries / bindings
+THRIFT_LANG_CONF_OPT += --without-csharp --without-java --without-erlang \
+	--without-python --without-perl --without-php --without-php_extension \
+	--without-ruby --without-haskell --without-go --without-d
+HOST_THRIFT_CONF_OPT += $(THRIFT_LANG_CONF_OPT) --without-c_glib
+THRIFT_CONF_OPT += $(THRIFT_LANG_CONF_OPT)
+
+# C bindings
+ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
+THRIFT_DEPENDENCIES += libglib2
+else
+THRIFT_CONF_OPT += --without-c_glib
+endif
+
+# De-hardcode THRIFT for cross compiling
+define THRIFT_BUILD_CMDS
+	for f in `find $(@D) -name Makefile -type f`; do \
+		$(SED) "/^THRIFT =/d" $$f; \
+	done
+	$(SED) "s:top_builddir)/compiler/cpp/thrift:THRIFT):" $(@D)/tutorial/Makefile
+	$(TARGET_MAKE_ENV) $(MAKE) THRIFT=$(HOST_DIR)/usr/bin/thrift -C $(@D)
+endef
+
+# Install runtime only
+define THRIFT_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/lib DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))