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
This commit is contained in:
Thomas Petazzoni 2017-08-26 00:10:40 +02:00 committed by James E. King, III
parent cf892d46f6
commit 1744cdcb67
33 changed files with 3 additions and 59 deletions

View File

@ -83,6 +83,9 @@ AS_IF([test "x$D_IMPORT_PREFIX" = x], [D_IMPORT_PREFIX="${includedir}/d2"])
AC_ARG_VAR([DMD_LIBEVENT_FLAGS], [DMD flags for linking libevent (auto-detected if not set).])
AC_ARG_VAR([DMD_OPENSSL_FLAGS], [DMD flags for linking OpenSSL (auto-detected if not set).])
AC_ARG_VAR([THRIFT], [Path to the thrift tool (needed for cross-compilation).])
AS_IF([test "x$THRIFT" = x], [THRIFT=`pwd`/compiler/cpp/thrift])
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX

View File

@ -237,8 +237,6 @@ nodist_libtestgencpp_la_SOURCES = \
gen-cpp/ThriftTest_types.h
libtestgencpp_la_CPPFLAGS = -I../../cpp/src $(BOOST_CPPFLAGS) -I./gen-cpp
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-c_glib/t_test_container_test_types.c gen-c_glib/t_test_container_test_types.h gen-c_glib/t_test_container_service.c gen-c_glib/t_test_container_service.h: ContainerTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib $<

View File

@ -265,8 +265,6 @@ include_qt_HEADERS = \
src/thrift/qt/TQIODeviceTransport.h \
src/thrift/qt/TQTcpServer.h
THRIFT = $(top_builddir)/compiler/cpp/thrift
WINDOWS_DIST = \
src/thrift/windows \
thrift.sln \

View File

@ -360,7 +360,6 @@ OpenSSLManualInitTest_LDADD = \
#
# Common thrift code generation rules
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-cpp/AnnotationTest_constants.cpp gen-cpp/AnnotationTest_constants.h gen-cpp/AnnotationTest_types.cpp gen-cpp/AnnotationTest_types.h: $(top_srcdir)/test/AnnotationTest.thrift
$(THRIFT) --gen cpp $<

View File

@ -24,8 +24,6 @@ BUILT_SOURCES = trusted-ca-certificate.pem server-certificate.pem
# Thrift compiler rules
THRIFT = $(top_builddir)/compiler/cpp/thrift
debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)
$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift

View File

@ -21,7 +21,6 @@ if GOVERSION_LT_17
COMPILER_EXTRAFLAG=",legacy_context"
endif
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFTARGS = -out gopath/src/ --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift

View File

@ -17,7 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFTCMD = $(THRIFT) --gen haxe -r
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
AGGR = $(top_srcdir)/contrib/async-test/aggr.thrift

View File

@ -19,8 +19,6 @@
export CLASSPATH
THRIFT = $(top_builddir)/compiler/cpp/thrift
all-local:
$(ANT) $(ANT_FLAGS)

View File

@ -16,8 +16,6 @@
# under the License.
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/ThriftTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: ../../../test/ThriftTest.thrift TestValidators.thrift
mkdir -p ./packages
$(THRIFT) --gen php -r --out ./packages ../../../test/ThriftTest.thrift

View File

@ -54,8 +54,6 @@ test_server_LDADD = \
#
# Common thrift code generation rules
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-c_glib/t_test_second_service.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_thrift_test_types.h: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib -r $<

View File

@ -98,8 +98,6 @@ StressTestNonBlocking_LDADD = \
#
# Common thrift code generation rules
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen cpp:templates,cob_style -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-dart/thrift_test/lib/thrift_test.dart: ../ThriftTest.thrift
$(THRIFT) --gen dart ../ThriftTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFT_FILES = $(wildcard ../*.thrift)
if ERLANG_OTP16

View File

@ -22,7 +22,6 @@ if GOVERSION_LT_17
COMPILER_EXTRAFLAG=",legacy_context"
endif
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift

View File

@ -17,7 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFTCMD = $(THRIFT) --gen haxe -r
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: $(THRIFT) ../ConstantsDemo.thrift ../DebugProtoTest.thrift ../ThriftTest.thrift ../Include.thrift
$(THRIFT) --gen hs ../ConstantsDemo.thrift
$(THRIFT) --gen hs ../DebugProtoTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: ../ThriftTest.thrift
$(THRIFT) --gen perl ../ThriftTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: ../ThriftTest.thrift
$(THRIFT) --gen php ../ThriftTest.thrift
$(THRIFT) --gen php:inlined ../ThriftTest.thrift

View File

@ -17,7 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
TRIAL ?= trial
stubs: ../ThriftTest.thrift ../SmallTest.thrift

View File

@ -18,8 +18,6 @@
#
AUTOMAKE_OPTIONS = serial-tests
THRIFT = $(top_builddir)/compiler/cpp/thrift
py_unit_tests = RunClientServer.py
thrift_gen = \

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: $(THRIFT) ../ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen rb ../ThriftTest.thrift
$(THRIFT) --gen rb ../SmallTest.thrift

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
stubs: ../ThriftTest.thrift
$(THRIFT) -I ./thrifts -out src --gen rs ../ThriftTest.thrift

View File

@ -28,8 +28,6 @@ AM_CFLAGS = -g -Wall -Wextra -pedantic $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSS
AM_CPPFLAGS = -I$(top_srcdir)/lib/c_glib/src -Igen-c_glib
AM_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) $(OPENSSL_LDFLAGS) $(OPENSSL_LIBS) @GCOV_LDFLAGS@
THRIFT = $(top_builddir)/compiler/cpp/thrift
noinst_LTLIBRARIES = \
libtutorialgencglib.la

View File

@ -61,8 +61,6 @@ TutorialClient_LDADD = \
#
# Common thrift code generation rules
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-cpp/Calculator.cpp gen-cpp/SharedService.cpp gen-cpp/shared_constants.cpp gen-cpp/shared_types.cpp gen-cpp/tutorial_constants.cpp gen-cpp/tutorial_types.cpp: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen cpp -r $<

View File

@ -19,8 +19,6 @@
BUILT_SOURCES = gen-dart/tutorial/lib/tutorial.dart gen-dart/shared/lib/shared.dart
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-dart/tutorial/lib/tutorial.dart gen-dart/shared/lib/shared.dart: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen dart -r $<

View File

@ -21,8 +21,6 @@ if GOVERSION_LT_17
COMPILER_EXTRAFLAG=":legacy_context"
endif
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-go/tutorial/calculator.go gen-go/shared/shared_service.go: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen go$(COMPILER_EXTRAFLAG) -r $<

View File

@ -17,13 +17,10 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
BIN_CPP = bin/Main-debug
BIN_PHP = bin/php/Main-debug.php
BIN_PHP_WEB = bin/php-web-server/Main-debug.php
gen-haxe/tutorial/calculator.hx gen-haxe/shared/shared_service.hx: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen haxe -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-nodejs/Calculator.js gen-nodejs/SharedService.js: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen js:node -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-py.tornado/tutorial/Calculator.py gen-py.tornado/shared/SharedService.py: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen py:tornado -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-py/tutorial/Calculator.py gen-py/shared/SharedService.py: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen py:twisted -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-py/tutorial/Calculator.py gen-py/shared/SharedService.py: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen py -r $<

View File

@ -17,8 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
gen-py/calculator.rb gen-py/shared_service.rb: $(top_srcdir)/tutorial/tutorial.thrift
$(THRIFT) --gen rb -r $<