From 3556ae5325f7ac12d2a51aaf5514c9bbd4cffb1d Mon Sep 17 00:00:00 2001 From: Alex Dupre Date: Wed, 26 Jun 2013 12:01:22 +0200 Subject: [PATCH 1/4] Use pkg-config for protobuf, it works also on FreeBSD. Do not add sources/headers to OBJECT_FILES. --- SConstruct | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/SConstruct b/SConstruct index 505315841d..b63f94d168 100644 --- a/SConstruct +++ b/SConstruct @@ -49,6 +49,8 @@ else: # Use openssl env.ParseConfig('pkg-config --cflags --libs openssl') +# Use protobuf +env.ParseConfig('pkg-config --cflags --libs protobuf') # The required version of boost is documented in the README file. # @@ -143,15 +145,9 @@ if not FreeBSD: ] ) -# Apparently, pkg-config --libs protobuf on bsd fails to provide this necessary include dir. -if FreeBSD: - env.Append(LINKFLAGS = ['-I/usr/local/include']) - env.Append(CXXFLAGS = ['-DOS_FREEBSD']) - env.Append( LIBS = [ 'rt', # for clock_nanosleep in beast - 'protobuf', 'z' ] ) @@ -183,7 +179,7 @@ TAG_SRCS = copy.copy(COMPILED_FILES) # Derive the object files from the source files. OBJECT_FILES = [] -OBJECT_FILES += PROTO_SRCS +OBJECT_FILES.append(PROTO_SRCS[0]) for file in COMPILED_FILES: OBJECT_FILES.append('build/obj/' + file) From d82a68dbbb154a966a48e2376769be45212338ed Mon Sep 17 00:00:00 2001 From: Alex Dupre Date: Wed, 26 Jun 2013 12:02:22 +0200 Subject: [PATCH 2/4] Fix compilation on FreeBSD. --- Subtrees/beast/modules/beast_basics/beast_basics.h | 4 ++-- Subtrees/beast/modules/beast_basics/functor/beast_Bind.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Subtrees/beast/modules/beast_basics/beast_basics.h b/Subtrees/beast/modules/beast_basics/beast_basics.h index 29049bed4a..3d509cdcd4 100644 --- a/Subtrees/beast/modules/beast_basics/beast_basics.h +++ b/Subtrees/beast/modules/beast_basics/beast_basics.h @@ -280,11 +280,11 @@ # include # endif -#elif BEAST_LINUX +#elif BEAST_LINUX || BEAST_BSD # include #else -# error Unnkown platform! +# error Unknown platform! #endif diff --git a/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h b/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h index ed29b3d47c..91b4aca6c6 100644 --- a/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h +++ b/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h @@ -71,7 +71,7 @@ using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; #endif -#elif BEAST_LINUX +#elif BEAST_LINUX || BEAST_BSD using std::tr1::bind; using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; From 64075993945d1b7e172366b059cc71df86e11918 Mon Sep 17 00:00:00 2001 From: Alex Dupre Date: Wed, 26 Jun 2013 12:02:41 +0200 Subject: [PATCH 3/4] Fix build on FreeBSD/MacOS, they are POSIX platforms, too. --- modules/ripple_leveldb/ripple_leveldb.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/ripple_leveldb/ripple_leveldb.cpp b/modules/ripple_leveldb/ripple_leveldb.cpp index fcf011da74..ed230e1945 100644 --- a/modules/ripple_leveldb/ripple_leveldb.cpp +++ b/modules/ripple_leveldb/ripple_leveldb.cpp @@ -15,16 +15,18 @@ #if BEAST_WIN32 #define LEVELDB_PLATFORM_WINDOWS -#elif BEAST_MAC || BEAST_IOS - #define OS_MACOSX - -// VFALCO TODO Distinguish between BEAST_BSD and BEAST_FREEBSD -#elif BEAST_BSD - #define OS_FREEBSD - #else #define LEVELDB_PLATFORM_POSIX + #if BEAST_MAC || BEAST_IOS + #define OS_MACOSX + + // VFALCO TODO Distinguish between BEAST_BSD and BEAST_FREEBSD + #elif BEAST_BSD + #define OS_FREEBSD + + #endif + #endif #if BEAST_MSVC From a5167c809f5059a86e33d442a33379c830ecbbe6 Mon Sep 17 00:00:00 2001 From: Alex Dupre Date: Wed, 26 Jun 2013 12:03:21 +0200 Subject: [PATCH 4/4] Conditionalize definition of __STDC_LIMIT_MACROS and define it at the top of ripple_websocket.h. --- Subtrees/websocket/src/rng/boost_rng.hpp | 4 +++- modules/ripple_websocket/ripple_websocket.h | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Subtrees/websocket/src/rng/boost_rng.hpp b/Subtrees/websocket/src/rng/boost_rng.hpp index 8069937080..c87c20e54d 100644 --- a/Subtrees/websocket/src/rng/boost_rng.hpp +++ b/Subtrees/websocket/src/rng/boost_rng.hpp @@ -30,7 +30,9 @@ #ifndef BOOST_RNG_HPP #define BOOST_RNG_HPP -#define __STDC_LIMIT_MACROS 1 +#ifndef __STDC_LIMIT_MACROS + #define __STDC_LIMIT_MACROS +#endif #include #include diff --git a/modules/ripple_websocket/ripple_websocket.h b/modules/ripple_websocket/ripple_websocket.h index 0e3b7fb1b1..4eeb8c78ce 100644 --- a/modules/ripple_websocket/ripple_websocket.h +++ b/modules/ripple_websocket/ripple_websocket.h @@ -21,6 +21,10 @@ @deprecated */ +// needed before inclusion of stdint.h for INT32_MIN/INT32_MAX macros +#ifndef __STDC_LIMIT_MACROS + #define __STDC_LIMIT_MACROS +#endif // VFALCO NOTE Log dependencies have wormed their way into websocketpp, // which needs the ripple_basic module to compile. @@ -38,11 +42,6 @@ //------------------------------------------------------------------------------ -// VFALCO TODO This include is just to prevent a warning about -// redefinition of __STDC_LIMIT_MACROS. Fix it right. -// -#include "websocket/src/rng/boost_rng.hpp" - #include "websocket/src/common.hpp" #include "websocket/src/sockets/socket_base.hpp"