Skip to contentSkip to conversation

Add apache thrift

PATCH New Gustavo Zacarias 2 participants 7 messages Dec 2, 2013 – Dec 8, 2013

lore
Share & tools
lore
#0 lore raw

v3 cover Add apache thrift

Add the apache thrift runtime and host tool.

Changes for v3:
* Install thrift to staging (d'oh!)
* Add a handy $(THRIFT) definition

Changes for v2:
* Fix indentation in python-thrift cross building
* Explicitly select/depend on zlib in thrift
* Patch Makefile.am instead of Makefile in thrift

Gustavo Zacarias (5):
libevent: add host variant
boost: add host variant
python-thrift: fix cross building
python-thrift: bump to version 0.9.1 and switch to apache
thirft: new package

 package/Config.in                             |  1 +
 package/boost/boost.mk                        | 33 ++++++++++++++
 package/libevent/libevent.mk                  |  1 +
 package/python-thrift/python-thrift.mk        | 21 +++++----
 package/thrift/Config.in                      | 23 ++++++++++
 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                      | 64 +++++++++++++++++++++++++++
 9 files changed, 189 insertions(+), 8 deletions(-)
 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
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v3 1/5 libevent: add host variant

---
 package/libevent/libevent.mk | 1 +
 1 file changed, 1 insertion(+)
package/libevent/libevent.mk +1 -0
index a6def1a..14ebf72 100644
@@ -20,3 +20,4 @@ LIBEVENT_POST_INSTALL_TARGET_HOOKS += LIBEVENT_REMOVE_PYSCRIPT
 endif
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v3 2/5 boost: add host variant

In reply to Gustavo Zacarias
---
 package/boost/boost.mk | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
package/boost/boost.mk +33 -0
index b0b3352..b97d12b 100644
@@ -11,11 +11,19 @@ BOOST_SITE = http://downloads.sourceforge.net/project/boost/boost/$(BOOST_VERSIO
 BOOST_INSTALL_STAGING = YES
 
 TARGET_CC_VERSION = $(shell $(TARGET_CC) -dumpversion)
+HOST_CC_VERSION = $(shell $(HOSTCC) -dumpversion)
 
 BOOST_DEPENDENCIES =
 
 BOOST_FLAGS =
 
+# keep host variant as minimal as possible
+HOST_BOOST_FLAGS = --without-icu \
+	--without-libraries=$(subst $(space),$(comma),atomic chrono context \
+	coroutine date_time exception filesystem graph graph_parallel \
+	iostreams locale log math mpi program_options python random regex \
+	serialization signals system test thread timer wave)
+
 # atomic library compile only with upstream version, wait for next release
 # coroutine breaks on some weak toolchains and it's new for 1.54+
 # log breaks with some toolchain combinations and it's new for 1.54+
@@ -54,6 +62,9 @@ ifeq ($(BR2_PACKAGE_BOOST_IOSTREAMS),y)
 BOOST_DEPENDENCIES += bzip2 zlib
 endif
 
+HOST_BOOST_OPT += toolset=gcc threading=multi variant=release link=shared \
+	runtime-link=shared
+
 BOOST_OPT += toolset=gcc \
 	     threading=multi \
 	     variant=$(if $(BR2_ENABLE_DEBUG),debug,release) \
@@ -78,6 +89,12 @@ define BOOST_CONFIGURE_CMDS
 	echo "" >> $(@D)/user-config.jam
 endef
 
+define HOST_BOOST_CONFIGURE_CMDS
+	(cd $(@D) && ./bootstrap.sh $(HOST_BOOST_FLAGS))
+	echo "using gcc : $(HOST_CC_VERSION) : $(HOSTCXX) : <cxxflags>\"$(HOST_CXXFLAGS)\" <linkflags>\"$(HOST_LDFLAGS)\" ;" > $(@D)/user-config.jam
+	echo "" >> $(@D)/user-config.jam
+endef
+
 define BOOST_INSTALL_TARGET_CMDS
 	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
 	--user-config=$(@D)/user-config.jam \
@@ -86,6 +103,21 @@ define BOOST_INSTALL_TARGET_CMDS
 	--layout=system install )
 endef
 
+define HOST_BOOST_BUILD_CMDS
+	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
+	--user-config=$(@D)/user-config.jam \
+	$(HOST_BOOST_OPT) \
+	--prefix=$(HOST_DIR)/usr )
+endef
+
+define HOST_BOOST_INSTALL_CMDS
+	(cd $(@D) && ./b2 -j$(PARALLEL_JOBS) -q -d+1 \
+	--user-config=$(@D)/user-config.jam \
+	$(HOST_BOOST_OPT) \
+	--prefix=$(HOST_DIR)/usr \
+	--layout=system install )
+endef
+
 define BOOST_INSTALL_STAGING_CMDS
 	(cd $(@D) && ./bjam -j$(PARALLEL_JOBS) -d+1 \
 	--user-config=$(@D)/user-config.jam \
@@ -95,3 +127,4 @@ define BOOST_INSTALL_STAGING_CMDS
 endef
 
 $(eval $(generic-package))
+$(eval $(host-generic-package))
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH v3 3/5 python-thrift: fix cross building

In reply to Gustavo Zacarias

The C code (fastbinary.so) wasn't built using the cross compiler, hence it was unusable. Fix it.

---
 package/python-thrift/python-thrift.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
package/python-thrift/python-thrift.mk +8 -3
index 4cd35e5..65733d4 100644
@@ -9,13 +9,18 @@ PYTHON_THRIFT_SOURCE = thrift-$(PYTHON_THRIFT_VERSION).tar.gz
 PYTHON_THRIFT_SITE = http://pypi.python.org/packages/source/t/thrift
 PYTHON_THRIFT_LICENSE = Apache-2.0
 PYTHON_THRIFT_LICENSE_FILES = README
-
 PYTHON_THRIFT_DEPENDENCIES = python
 
 define PYTHON_THRIFT_BUILD_CMDS
 	(cd $(@D); \
-		PYTHONXCPREFIX="$(STAGING_DIR)/usr/" \
-		LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
+		CC="$(TARGET_CC)" \
+		CFLAGS="$(TARGET_CFLAGS)" \
+		LDSHARED="$(TARGET_CROSS)gcc -shared" \
+		CROSS_COMPILING=yes \
+		_python_sysroot=$(STAGING_DIR) \
+		_python_srcdir=$(BUILD_DIR)/python$(PYTHON_VERSION) \
+		_python_prefix=/usr \
+		_python_exec_prefix=/usr \
 		$(HOST_DIR)/usr/bin/python setup.py build)
 endef
 
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH v3 4/5 python-thrift: bump to version 0.9.1 and switch to apache

In reply to Gustavo Zacarias

Switch away from the PyPI subset version since it has a great filename clash with the full upstream apache version.

---
 package/python-thrift/python-thrift.mk | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
package/python-thrift/python-thrift.mk +5 -5
index 65733d4..91e14e5 100644
@@ -4,15 +4,15 @@
 #
 ################################################################################
 
-PYTHON_THRIFT_VERSION = 0.9.0
+PYTHON_THRIFT_VERSION = 0.9.1
 PYTHON_THRIFT_SOURCE = thrift-$(PYTHON_THRIFT_VERSION).tar.gz
-PYTHON_THRIFT_SITE = http://pypi.python.org/packages/source/t/thrift
+PYTHON_THRIFT_SITE = http://www.us.apache.org/dist/thrift/$(PYTHON_THRIFT_VERSION)
 PYTHON_THRIFT_LICENSE = Apache-2.0
-PYTHON_THRIFT_LICENSE_FILES = README
+PYTHON_THRIFT_LICENSE_FILES = LICENSE
 PYTHON_THRIFT_DEPENDENCIES = python
 
 define PYTHON_THRIFT_BUILD_CMDS
-	(cd $(@D); \
+	(cd $(@D)/lib/py; \
 		CC="$(TARGET_CC)" \
 		CFLAGS="$(TARGET_CFLAGS)" \
 		LDSHARED="$(TARGET_CROSS)gcc -shared" \
@@ -28,7 +28,7 @@ endef
 # the installation directory is in python's load path. For host-python,
 # it is not, so add it explicitly while installing to target.
 define PYTHON_THRIFT_INSTALL_TARGET_CMDS
-	(cd $(@D); PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
+	(cd $(@D)/lib/py; PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
 		$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
 endef
 
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH v3 5/5 thirft: new package

In reply to Gustavo Zacarias
---
 package/Config.in                             |  1 +
 package/thrift/Config.in                      | 23 ++++++++++
 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                      | 64 +++++++++++++++++++++++++++
 6 files changed, 142 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
package/Config.in +1 -0
index d0be2a7..43468ba 100644
@@ -660,6 +660,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"
package/thrift/Config.in new file +23 -0
new file mode 100644
index 0000000..a7f3479
@@ -0,0 +1,23 @@
+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
+	select BR2_PACKAGE_ZLIB
+	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
package/thrift/thrift-01-libevent-cross.patch new file +16 -0
new file mode 100644
index 0000000..f07caa7
@@ -0,0 +1,16 @@
+Make it cross-compile happy the hard way, there's no clean way.
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+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>
+           ]], [[
package/thrift/thrift-02-autoreconf.patch new file +22 -0
new file mode 100644
index 0000000..d56212a
@@ -0,0 +1,22 @@
+Fillers to make autoreconf (automake) happy.
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+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 @@
++
++
package/thrift/thrift-03-zlib-cross.patch new file +16 -0
new file mode 100644
index 0000000..3af39c4
@@ -0,0 +1,16 @@
+Make zlib version detection cross-compile happy.
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+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
package/thrift/thrift.mk new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#6 lore raw

v3 cover Add apache thrift

In reply to Gustavo Zacarias
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Add the apache thrift runtime and host tool.

Changes for v3:
* Install thrift to staging (d'oh!)
* Add a handy $(THRIFT) definition

I guess you're planning on adding packages using this THRIFT variable in the future?

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard