Commit c8dab647 authored by Axel Auweter's avatar Axel Auweter
Browse files

Add patches infrastructure to the build system

This adds the ability to patch some of the dependencies before buidling.
First users of this are ncurses and Thrift who have some trouble when compiling
under MacOS 10.9 Mavericks using LLVM and the CLANG frontend.

This fixes ticket #10 and ticket #11.
parent cb16f8a2
......@@ -24,6 +24,7 @@ DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//'))
CFLAGS += -I$(DCDBDEPLOYPATH)/include -I$(DCDBDEPLOYPATH)/include/ncurses -O0 -g
CXX11FLAGS = --std=c++11
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O0 -g
.PHONY : info all clean cleanall distclean $(PROJECTS)
......@@ -71,6 +72,10 @@ all: $(DCDBDEPSPATH)/.prerequesites
@make $(PROJECTS)
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@echo ""
@echo "Preparing patches..."
@cp -a patches $(DCDBDEPSPATH)/
@echo ""
@echo "Building Mosquitto library..."
@mkdir -p $(DCDBDEPSPATH)/mosquitto_build
......@@ -90,6 +95,7 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@echo ""
@echo "Buidling Ncurses library..."
$(eval N := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*ncurses/ncurses/' | sed 's/\ .*//'))
@if [ -e $(DCDBDEPSPATH)/patches/$(N).patch ]; then echo "Patching Ncurses..."; cd $(DCDBDEPSPATH)/$(N) && patch -p1 < $(DCDBDEPSPATH)/patches/$(N).patch; fi
@cd $(DCDBDEPSPATH)/$(N) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-shared --without-ada --without-manpages \
--without-progs --without-tests && make -j $(MAKETHREADS) && make install
......@@ -109,10 +115,11 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@echo ""
@echo "Buidling Thrift..."
$(eval T := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*thrift/thrift/' | sed 's/\ .*//'))
@cd $(DCDBDEPSPATH)/$(T) && ./configure --prefix=$(DCDBDEPLOYPATH) --without-qt4 --without-csharp \
@if [ -e $(DCDBDEPSPATH)/patches/$(T).patch ]; then echo "Patching Thrift..."; cd $(DCDBDEPSPATH)/$(T) && patch -p1 < $(DCDBDEPSPATH)/patches/$(T).patch; fi
@cd $(DCDBDEPSPATH)/$(T) && env CXXFLAGS="$(CXX11FLAGS)" ./configure --prefix=$(DCDBDEPLOYPATH) --without-qt4 --without-csharp \
--without-java --without-erlang --without-python --without-perl --without-php --without-php_extension \
--without-ruby --without-haskell --without-go --without-d --with-cpp --with-boost=$(DCDBDEPLOYPATH) \
--enable-libtool-lock --without-tests && make -j $(MAKETHREADS) && make install
--enable-libtool-lock --without-tests && env CXXFLAGS="$(CXX11FLAGS)" make -j $(MAKETHREADS) && env CXXFLAGS="$(CXX11FLAGS)" make install
@echo ""
@echo "Staging and configuring Cassandra..."
......
Only in ncurses-5.9-proper: .dirstamp
diff -r -U3 ncurses-5.9/c++/cursesf.h ncurses-5.9-proper/c++/cursesf.h
--- ncurses-5.9/c++/cursesf.h 2005-08-13 20:08:24.000000000 +0200
+++ ncurses-5.9-proper/c++/cursesf.h 2013-10-29 15:53:11.000000000 +0100
@@ -681,7 +681,7 @@
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
- : NCursesForm (Fields, with_frame, autoDelete_Fields) {
+ : NCursesForm (&Fields, with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(p_UserData));
};
@@ -694,7 +694,7 @@
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Fields=FALSE)
- : NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
+ : NCursesForm (&Fields, nlines, ncols, begin_y, begin_x,
with_frame, autoDelete_Fields) {
if (form)
set_user (const_cast<void *>(p_UserData));
diff -r -U3 ncurses-5.9/c++/cursesm.h ncurses-5.9-proper/c++/cursesm.h
--- ncurses-5.9/c++/cursesm.h 2005-08-13 20:10:36.000000000 +0200
+++ ncurses-5.9-proper/c++/cursesm.h 2013-10-29 15:53:21.000000000 +0100
@@ -639,7 +639,7 @@
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE,
bool autoDelete_Items=FALSE)
- : NCursesMenu (Items, with_frame, autoDelete_Items) {
+ : NCursesMenu (&Items, with_frame, autoDelete_Items) {
if (menu)
set_user (const_cast<void *>(p_UserData));
};
@@ -651,7 +651,7 @@
int begin_x = 0,
const T* p_UserData = STATIC_CAST(T*)(0),
bool with_frame=FALSE)
- : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
+ : NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) {
if (menu)
set_user (const_cast<void *>(p_UserData));
};
Only in thrift-0.9.1-proper: .dirstamp
diff -r -U3 thrift-0.9.1/compiler/cpp/src/generate/t_java_generator.cc thrift-0.9.1-proper/compiler/cpp/src/generate/t_java_generator.cc
--- thrift-0.9.1/compiler/cpp/src/generate/t_java_generator.cc 2013-08-15 16:04:29.000000000 +0200
+++ thrift-0.9.1-proper/compiler/cpp/src/generate/t_java_generator.cc 2013-10-29 16:08:40.000000000 +0100
@@ -2824,10 +2824,9 @@
t_struct* xs = tfunction->get_xceptions();
const std::vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
- bool first = true;
if (xceptions.size() > 0) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- first ? first = false : indent(f_service_) << "else ";
+ if (x_iter != xceptions.begin()) indent(f_service_) << "else ";
indent(f_service_) << "if (e instanceof " << type_name((*x_iter)->get_type(), false, false)<<") {" << endl;
indent(f_service_) << indent() << "result." << (*x_iter)->get_name() << " = (" << type_name((*x_iter)->get_type(), false, false) << ") e;" << endl;
indent(f_service_) << indent() << "result.set" << get_cap_name((*x_iter)->get_name()) << get_cap_name("isSet") << "(true);" << endl;
diff -r -U3 thrift-0.9.1/compiler/cpp/src/generate/t_rb_generator.cc thrift-0.9.1-proper/compiler/cpp/src/generate/t_rb_generator.cc
--- thrift-0.9.1/compiler/cpp/src/generate/t_rb_generator.cc 2013-08-15 16:04:29.000000000 +0200
+++ thrift-0.9.1-proper/compiler/cpp/src/generate/t_rb_generator.cc 2013-10-29 16:08:47.000000000 +0100
@@ -359,21 +359,19 @@
// Create a hash mapping values back to their names (as strings) since ruby has no native enum type
f_types_.indent() << "VALUE_MAP = {";
- bool first = true;
for(c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
// Populate the hash
int value = (*c_iter)->get_value();
- first ? first = false : f_types_ << ", ";
+ if (c_iter != constants.begin()) f_types_ << ", ";
f_types_ << value << " => \"" << capitalize((*c_iter)->get_name()) << "\"";
}
f_types_ << "}" << endl;
// Create a set with valid values for this enum
f_types_.indent() << "VALID_VALUES = Set.new([";
- first = true;
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
// Populate the set
- first ? first = false : f_types_ << ", ";
+ if (c_iter != constants.begin()) f_types_ << ", ";
f_types_ << capitalize((*c_iter)->get_name());
}
f_types_ << "]).freeze" << endl;
diff -r -U3 thrift-0.9.1/compiler/cpp/src/thrifty.yy thrift-0.9.1-proper/compiler/cpp/src/thrifty.yy
--- thrift-0.9.1/compiler/cpp/src/thrifty.yy 2013-08-15 16:04:29.000000000 +0200
+++ thrift-0.9.1-proper/compiler/cpp/src/thrifty.yy 2013-10-29 16:08:52.000000000 +0100
@@ -661,7 +661,7 @@
$$ = new t_const_value();
$$->set_integer($1);
if (!g_allow_64bit_consts && ($1 < INT32_MIN || $1 > INT32_MAX)) {
- pwarning(1, "64-bit constant \"%"PRIi64"\" may not work in all languages.\n", $1);
+ pwarning(1, "64-bit constant \"%" PRIi64 "\" may not work in all languages.\n", $1);
}
}
| tok_dub_constant
@@ -968,7 +968,7 @@
* warn if the user-specified negative value isn't what
* thrift would have auto-assigned.
*/
- pwarning(1, "Nonpositive field key (%"PRIi64") differs from what would be "
+ pwarning(1, "Nonpositive field key (%" PRIi64 ") differs from what would be "
"auto-assigned by thrift (%d).\n", $1, y_field_val);
}
/*
@@ -979,7 +979,7 @@
$$.value = $1;
$$.auto_assigned = false;
} else {
- pwarning(1, "Nonpositive value (%"PRIi64") not allowed as a field key.\n",
+ pwarning(1, "Nonpositive value (%" PRIi64 ") not allowed as a field key.\n",
$1);
$$.value = y_field_val--;
$$.auto_assigned = true;
diff -r -U3 thrift-0.9.1/tutorial/cpp/CppClient.cpp thrift-0.9.1-proper/tutorial/cpp/CppClient.cpp
--- thrift-0.9.1/tutorial/cpp/CppClient.cpp 2013-08-15 16:04:29.000000000 +0200
+++ thrift-0.9.1-proper/tutorial/cpp/CppClient.cpp 2013-10-29 16:08:55.000000000 +0100
@@ -38,9 +38,9 @@
using namespace boost;
int main(int argc, char** argv) {
- shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
- shared_ptr<TTransport> transport(new TBufferedTransport(socket));
- shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
+ boost::shared_ptr<TTransport> socket(new TSocket("localhost", 9090));
+ boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
+ boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
CalculatorClient client(protocol);
try {
diff -r -U3 thrift-0.9.1/tutorial/cpp/CppServer.cpp thrift-0.9.1-proper/tutorial/cpp/CppServer.cpp
--- thrift-0.9.1/tutorial/cpp/CppServer.cpp 2013-08-15 16:04:29.000000000 +0200
+++ thrift-0.9.1-proper/tutorial/cpp/CppServer.cpp 2013-10-29 16:08:58.000000000 +0100
@@ -113,11 +113,11 @@
int main(int argc, char **argv) {
- shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
- shared_ptr<CalculatorHandler> handler(new CalculatorHandler());
- shared_ptr<TProcessor> processor(new CalculatorProcessor(handler));
- shared_ptr<TServerTransport> serverTransport(new TServerSocket(9090));
- shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+ boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+ boost::shared_ptr<CalculatorHandler> handler(new CalculatorHandler());
+ boost::shared_ptr<TProcessor> processor(new CalculatorProcessor(handler));
+ boost::shared_ptr<TServerTransport> serverTransport(new TServerSocket(9090));
+ boost::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
TSimpleServer server(processor,
serverTransport,
@@ -128,10 +128,10 @@
/**
* Or you could do one of these
- shared_ptr<ThreadManager> threadManager =
+ boost::shared_ptr<ThreadManager> threadManager =
ThreadManager::newSimpleThreadManager(workerCount);
- shared_ptr<PosixThreadFactory> threadFactory =
- shared_ptr<PosixThreadFactory>(new PosixThreadFactory());
+ boost::shared_ptr<PosixThreadFactory> threadFactory =
+ boost::shared_ptr<PosixThreadFactory>(new PosixThreadFactory());
threadManager->threadFactory(threadFactory);
threadManager->start();
TThreadPoolServer server(processor,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment