[fawkes/f22] Updates for lua 5.2 and for c++11

rmattes rmattes at fedoraproject.org
Wed Feb 18 04:38:16 UTC 2015


commit 36bd0bba6148515e9abfe5a59dabbdccd8820768
Author: Rich Mattes <richmattes at gmail.com>
Date:   Tue Feb 17 23:35:28 2015 -0500

    Updates for lua 5.2 and for c++11

 fawkes-0.5.0-cpp11.patch   |  229 ++++++++++++++++++++++++++++++++++++++++++++
 fawkes-0.5.0-lua-5.2.patch |   18 +++-
 fawkes-0.5.0-stdint.patch  |   11 ++
 fawkes.spec                |   22 +++-
 4 files changed, 271 insertions(+), 9 deletions(-)
---
diff --git a/fawkes-0.5.0-cpp11.patch b/fawkes-0.5.0-cpp11.patch
new file mode 100644
index 0000000..341582c
--- /dev/null
+++ b/fawkes-0.5.0-cpp11.patch
@@ -0,0 +1,229 @@
+diff -up ./etc/buildsys/gcc.mk.cpp11 ./etc/buildsys/gcc.mk
+--- ./etc/buildsys/gcc.mk.cpp11	2015-02-17 23:24:09.862805893 -0500
++++ ./etc/buildsys/gcc.mk	2015-02-17 23:25:28.546833240 -0500
+@@ -26,6 +26,11 @@ GCC_VERSION_SPLITTED=$(call split,.,$(GC
+ GCC_VERSION_MAJOR=$(word 1,$(GCC_VERSION_SPLITTED))
+ GCC_VERSION_MINOR=$(word 2,$(GCC_VERSION_SPLITTED))
+ 
++ifeq ($(call gte,$(GCC_VERSION_MAJOR),5),$(true))
++  HAVE_CPP11=1
++  CFLAGS_CPP11=-std=gnu++11
++else
++
+ ifeq ($(call gte,$(GCC_VERSION_MAJOR),4),$(true))
+   ifeq ($(call gte,$(GCC_VERSION_MINOR),3),$(true))
+     HAVE_CPP11=1
+@@ -35,6 +40,7 @@ ifeq ($(call gte,$(GCC_VERSION_MAJOR),4)
+     endif
+   endif
+ endif
++endif
+ 
+ ifeq ($(USE_OPENMP),1)
+   CFLAGS_OPENMP  = -fopenmp
+diff -up ./src/libs/blackboard/net/handler.cpp.cpp11 ./src/libs/blackboard/net/handler.cpp
+--- ./src/libs/blackboard/net/handler.cpp.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/blackboard/net/handler.cpp	2015-02-17 23:00:15.442545719 -0500
+@@ -357,10 +357,10 @@ BlackBoardNetworkHandler::send_opensucce
+ 
+ 
+ void
+-BlackBoardNetworkHandler::send_openfailure(unsigned int clid, unsigned int errno)
++BlackBoardNetworkHandler::send_openfailure(unsigned int clid, unsigned int error_number)
+ {
+   bb_iopenfail_msg_t *ofm = (bb_iopenfail_msg_t *)malloc(sizeof(bb_iopenfail_msg_t));
+-  ofm->errno = htonl(errno);
++  ofm->error_number = htonl(error_number);
+ 
+   FawkesNetworkMessage *omsg = new FawkesNetworkMessage(clid, FAWKES_CID_BLACKBOARD,
+ 							MSG_BB_OPEN_FAILURE, ofm,
+diff -up ./src/libs/blackboard/net/handler.h.cpp11 ./src/libs/blackboard/net/handler.h
+--- ./src/libs/blackboard/net/handler.h.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/blackboard/net/handler.h	2015-02-17 23:00:15.442545719 -0500
+@@ -62,7 +62,7 @@ class BlackBoardNetworkHandler
+ 
+  private:
+   void send_opensuccess(unsigned int clid, Interface *interface);
+-  void send_openfailure(unsigned int clid, unsigned int errno);
++  void send_openfailure(unsigned int clid, unsigned int error_number);
+ 
+ 
+   BlackBoard *__bb;
+diff -up ./src/libs/blackboard/net/messages.h.cpp11 ./src/libs/blackboard/net/messages.h
+--- ./src/libs/blackboard/net/messages.h.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/blackboard/net/messages.h	2015-02-17 23:00:15.442545719 -0500
+@@ -140,7 +140,7 @@ typedef struct {
+ 
+ /** Message to send update data. */
+ typedef struct {
+-  uint32_t  errno;	/**< Error code. @see blackboard_neterror_t */
++  uint32_t  error_number;	/**< Error code. @see blackboard_neterror_t */
+ } bb_iopenfail_msg_t;
+ 
+ 
+diff -up ./src/libs/blackboard/remote.cpp.cpp11 ./src/libs/blackboard/remote.cpp
+--- ./src/libs/blackboard/remote.cpp.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/blackboard/remote.cpp	2015-02-17 23:00:15.443545757 -0500
+@@ -229,7 +229,7 @@ RemoteBlackBoard::open_interface(const c
+     __proxies[proxy->serial()] = proxy;
+   } else if ( __m->msgid() == MSG_BB_OPEN_FAILURE ) {
+     bb_iopenfail_msg_t *fm = __m->msg<bb_iopenfail_msg_t>();
+-    unsigned int error = ntohl(fm->errno);
++    unsigned int error = ntohl(fm->error_number);
+     __m->unref();
+     __m = NULL;
+     if ( error == BB_ERR_WRITER_EXISTS ) {
+diff -up ./src/libs/core/exception.cpp.cpp11 ./src/libs/core/exception.cpp
+--- ./src/libs/core/exception.cpp.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/core/exception.cpp	2015-02-17 23:00:15.443545757 -0500
+@@ -168,16 +168,16 @@ Exception::Exception(const char *format,
+  * Constructs a new exception with the given message and errno value. This
+  * is particularly handy when throwing the exception after a function failed
+  * that returns an error code in errno. 
+- * @param errno error number
++ * @param error_number error number
+  * @param format The format of the primary message. Supports the same
+  * arguments as append(). The message is copied and not just referenced.
+  * Thus the memory has to be freed if it is a dynamic  string on the heap.
+  */
+-Exception::Exception(int errno, const char *format, ...) throw()
++Exception::Exception(int error_number, const char *format, ...) throw()
+ {
+   messages_mutex = new Mutex();
+ 
+-  _errno = errno;
++  _errno = error_number;
+   __type_id = "unknown";
+ 
+   messages = NULL;
+@@ -188,7 +188,7 @@ Exception::Exception(int errno, const ch
+     va_list arg;
+     va_start(arg, format);
+     char *ext_format;
+-    if ( asprintf(&ext_format, "%s (errno: %i, %s)", format, errno, strerror(errno)) == -1 ) {
++    if ( asprintf(&ext_format, "%s (errno: %i, %s)", format, error_number, strerror(error_number)) == -1 ) {
+       append_nolock_va(format, arg);
+     } else {
+       append_nolock_va(ext_format, arg);
+@@ -196,7 +196,7 @@ Exception::Exception(int errno, const ch
+     }
+     va_end(arg);
+   } else {
+-    append_nolock("Exception with errno=%i (%s)", errno, strerror(errno));
++    append_nolock("Exception with errno=%i (%s)", error_number, strerror(error_number));
+   }
+ }
+ 
+diff -up ./src/libs/core/exception.h.cpp11 ./src/libs/core/exception.h
+--- ./src/libs/core/exception.h.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/core/exception.h	2015-02-17 23:00:15.443545757 -0500
+@@ -37,7 +37,7 @@ class Exception : public std::exception
+  public:
+ 
+   Exception(const char *format, ...) throw();
+-  Exception(int errno, const char *format, ...) throw();
++  Exception(int error_number, const char *format, ...) throw();
+   Exception(const Exception &exc) throw();
+   virtual ~Exception() throw();
+ 
+diff -up ./src/libs/core/exceptions/system.cpp.cpp11 ./src/libs/core/exceptions/system.cpp
+--- ./src/libs/core/exceptions/system.cpp.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/core/exceptions/system.cpp	2015-02-17 23:00:15.444545796 -0500
+@@ -54,7 +54,7 @@ OutOfMemoryException::OutOfMemoryExcepti
+ /** @class InterruptedException <core/exceptions/system.h>
+  * The current system call has been interrupted (for instance by a signal).
+  * Throw this exception if you use libc functions which return EINTR or store
+- * EINTR in errno.
++ * EINTR in error_number.
+  * @ingroup Exceptions
+  */
+ /** Constructor */
+@@ -112,12 +112,12 @@ TimeoutException::TimeoutException(const
+ 
+ /** Constructor with error number.
+  * @param filename name of file which could not be opened
+- * @param errno error number
++ * @param error_code error number
+  * @param additional_msg optional additional message
+  */
+-CouldNotOpenFileException::CouldNotOpenFileException(const char *filename, int errno,
++CouldNotOpenFileException::CouldNotOpenFileException(const char *filename, int error_code,
+ 						     const char *additional_msg) throw()
+-  : Exception(errno, "Could not open file '%s' %s%s%s", filename,
++  : Exception(error_code, "Could not open file '%s' %s%s%s", filename,
+ 	      (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "",
+ 	      (additional_msg) ? ")" : "")
+ {
+@@ -146,12 +146,12 @@ CouldNotOpenFileException::CouldNotOpenF
+ 
+ /** Constructor with error number.
+  * @param filename name of file which could not be read
+- * @param errno error number
++ * @param error_number error number
+  * @param additional_msg optional additional message
+  */
+-FileReadException::FileReadException(const char *filename, int errno,
++FileReadException::FileReadException(const char *filename, int error_number,
+ 				     const char *additional_msg) throw()
+-  : Exception(errno, "Could not read from file '%s' %s%s%s", filename,
++  : Exception(error_number, "Could not read from file '%s' %s%s%s", filename,
+ 	      (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "",
+ 	      (additional_msg) ? ")" : "")
+ {
+@@ -180,12 +180,12 @@ FileReadException::FileReadException(con
+ 
+ /** Constructor with error number.
+  * @param filename name of file which could not be written to
+- * @param errno error number
++ * @param error_number error number
+  * @param additional_msg optional additional message
+  */
+-FileWriteException::FileWriteException(const char *filename, int errno,
++FileWriteException::FileWriteException(const char *filename, int error_number,
+ 				       const char *additional_msg) throw()
+-  : Exception(errno, "Could not write to file '%s' %s%s%s", filename,
++  : Exception(error_number, "Could not write to file '%s' %s%s%s", filename,
+ 	      (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "",
+ 	      (additional_msg) ? ")" : "")
+ {
+diff -up ./src/libs/core/exceptions/system.h.cpp11 ./src/libs/core/exceptions/system.h
+--- ./src/libs/core/exceptions/system.h.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/core/exceptions/system.h	2015-02-17 23:00:15.444545796 -0500
+@@ -52,7 +52,7 @@ class TimeoutException : public Exceptio
+ 
+ class CouldNotOpenFileException : public Exception {
+  public:
+-  CouldNotOpenFileException(const char *filename, int errno,
++  CouldNotOpenFileException(const char *filename, int error_number,
+ 			    const char *additional_msg = 0) throw();
+   CouldNotOpenFileException(const char *filename, const char *additional_msg = 0) throw();
+ };
+@@ -60,14 +60,14 @@ class CouldNotOpenFileException : public
+ 
+ class FileReadException : public Exception {
+  public:
+-  FileReadException(const char *filename, int errno,
++  FileReadException(const char *filename, int error_number,
+ 		    const char *additional_msg = 0) throw();
+   FileReadException(const char *filename, const char *additional_msg = 0) throw();
+ };
+ 
+ class FileWriteException : public Exception {
+  public:
+-  FileWriteException(const char *filename, int errno,
++  FileWriteException(const char *filename, int error_number,
+ 		     const char *additional_msg = 0) throw();
+   FileWriteException(const char *filename, const char *additional_msg = 0) throw();
+ };
+diff -up ./src/plugins/worldmodel/fusers/objpos_majority.h.cpp11 ./src/plugins/worldmodel/fusers/objpos_majority.h
+--- ./src/plugins/worldmodel/fusers/objpos_majority.h.cpp11	2012-09-26 18:55:32.000000000 -0400
++++ ./src/plugins/worldmodel/fusers/objpos_majority.h	2015-02-17 23:00:15.444545796 -0500
+@@ -100,7 +100,7 @@ class WorldModelObjPosMajorityFuser
+   typedef std::vector<Opi*>           OpiBucket;
+   typedef std::vector<OpiBucket>      OpiBuckets;
+ 
+-  const static float GROUP_RADIUS = 1.0f;
++  constexpr static float GROUP_RADIUS = 1.0f;
+ 
+   void check();
+   void copy_own_if();
diff --git a/fawkes-0.5.0-lua-5.2.patch b/fawkes-0.5.0-lua-5.2.patch
index 87e5c81..a2e7697 100644
--- a/fawkes-0.5.0-lua-5.2.patch
+++ b/fawkes-0.5.0-lua-5.2.patch
@@ -1,6 +1,18 @@
-diff -up fawkes-0.5.0/src/libs/lua/context.cpp.lua-52 fawkes-0.5.0/src/libs/lua/context.cpp
---- fawkes-0.5.0/src/libs/lua/context.cpp.lua-52	2013-05-14 16:20:36.579372089 -0400
-+++ fawkes-0.5.0/src/libs/lua/context.cpp	2013-05-14 16:21:45.632373125 -0400
+diff -up ./etc/buildsys/lua.mk.lua-52 ./etc/buildsys/lua.mk
+--- ./etc/buildsys/lua.mk.lua-52	2015-02-17 23:09:01.704772049 -0500
++++ ./etc/buildsys/lua.mk	2015-02-17 23:09:16.174330239 -0500
+@@ -20,7 +20,7 @@ endif
+ ifndef __buildsys_lua_mk_
+ __buildsys_lua_mk_ := 1
+ 
+-LUA_VERSION = 5.1
++LUA_VERSION = 5.2
+ 
+ # Check for Lua (Fedora packages lua and lua-devel)
+ ifneq ($(PKGCONFIG),)
+diff -up ./src/libs/lua/context.cpp.lua-52 ./src/libs/lua/context.cpp
+--- ./src/libs/lua/context.cpp.lua-52	2012-09-26 18:55:32.000000000 -0400
++++ ./src/libs/lua/context.cpp	2015-02-17 23:00:15.436545488 -0500
 @@ -34,6 +34,15 @@
  #include <cstring>
  #include <unistd.h>
diff --git a/fawkes-0.5.0-stdint.patch b/fawkes-0.5.0-stdint.patch
new file mode 100644
index 0000000..a2292f5
--- /dev/null
+++ b/fawkes-0.5.0-stdint.patch
@@ -0,0 +1,11 @@
+diff -up ./src/libs/tf/types.h.stdint ./src/libs/tf/types.h
+--- ./src/libs/tf/types.h.stdint	2015-02-13 11:35:21.539986859 -0500
++++ ./src/libs/tf/types.h	2015-02-13 11:35:31.926377347 -0500
+@@ -61,6 +61,7 @@
+ 
+ #include <string>
+ #include <cmath>
++#include <stdint.h>
+ 
+ namespace fawkes {
+   namespace tf {
diff --git a/fawkes.spec b/fawkes.spec
index 97b2b6b..6ee2885 100644
--- a/fawkes.spec
+++ b/fawkes.spec
@@ -13,7 +13,9 @@ Source0:        http://files.fawkesrobotics.org/releases/%{name}-%{version}.tar.
 # This patch adds the new argument in calls to agread
 Patch0:         %{name}-0.5.0-graphviz.patch
 Patch1:         %{name}-0.5.0-v4lkernel.patch
-Patch2:		fawkes-0.5.0-lua-5.2.patch
+Patch2:		%{name}-0.5.0-lua-5.2.patch
+Patch3:         %{name}-0.5.0-stdint.patch
+Patch4:         %{name}-0.5.0-cpp11.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  gcc-c++, make >= 3.81
@@ -464,7 +466,9 @@ functionality.
 %patch0 -p0 -b .graphviz
 %patch1 -p0 -b .v4lkernel
 %endif
-%patch2 -p1 -b .lua-52
+%patch2 -p0 -b .lua-52
+%patch3 -p0 -b .stdint
+%patch4 -p0 -b .cpp11
 
 %build
 %ifnarch %{arm}
@@ -474,7 +478,7 @@ functionality.
 %endif
 # No _smp_mflags; build is not parallel clean
 make uncolored-switch-buildtype-sysinstall
-make uncolored-all uncolored-gui CFLAGS_EXT="%{optflags}" PREFIX=%{_prefix} \
+make uncolored-all uncolored-gui CFLAGS_EXT="%{optflags} -std=gnu++11" PREFIX=%{_prefix} \
      %{feature_flags}
 # Ignore documentation errors until fresh doxygen release hits build machines.
 # Doxygen 1.7.1 is totally buggy and reports hundreds of false positives.
@@ -486,9 +490,9 @@ make install DESTDIR=%{buildroot} PREFIX=%{_prefix} EXEC_DOCDIR=%{_pkgdocdir} %{
 install -pm 644 README doc/DEPENDENCIES doc/LICENSE.* %{buildroot}%{_pkgdocdir}
 
 # We do not package OpenRAVE, yet.
-rm %{buildroot}%{_libdir}/fawkes/interfaces/libOpenRaveInterface*
-rm %{buildroot}%{_libdir}/fawkes/lua/interfaces/OpenRaveInterface*
-rm %{buildroot}%{_libdir}/libfawkesopenraveaspect.so*
+rm -f %{buildroot}%{_libdir}/fawkes/interfaces/libOpenRaveInterface*
+rm -f %{buildroot}%{_libdir}/fawkes/lua/interfaces/OpenRaveInterface*
+rm -f %{buildroot}%{_libdir}/libfawkesopenraveaspect.so*
 
 # Use xargs instead of exec to abort the build on desktop-file-validate fail
 find %{buildroot}%{_datadir}/applications -name '*.desktop' | xargs -L 1 desktop-file-validate
@@ -851,6 +855,12 @@ rm -rf %{buildroot}
 %exclude %{_pkgdocdir}/LICENSE.*
 
 %changelog
+* Tue Feb 17 2015 Rich Mattes <richmattes at gmail.com> - 0.5.0-20
+- Update lua 5.2 patch to detect correct version of lua
+- Replace variables and arguments named "errno" with "error_number"
+- Enable gnu++11 globally 
+- Fix gcc version based c++11 detection logic
+
 * Thu Jan 29 2015 Petr Machata <pmachata at redhat.com> - 0.5.0-20
 - Rebuild for boost 1.57.0
 


More information about the scm-commits mailing list