sumo: Update to 1.3.1
authorRosen Penev <redacted>
Fri, 4 Oct 2019 01:27:01 +0000 (18:27 -0700)
committerRosen Penev <redacted>
Tue, 8 Oct 2019 05:44:35 +0000 (22:44 -0700)
Converted to CMake for simplicity.

Added upstream patch to use sleep_for instead of deprecated usleep.

Added patch to fix compilation with musl.

Signed-off-by: Rosen Penev <redacted>
utils/sumo/Makefile
utils/sumo/patches/010-usleep.patch [new file with mode: 0644]
utils/sumo/patches/020-strerror.patch [new file with mode: 0644]
utils/sumo/patches/100-configure_fix.patch [deleted file]

index b034e2569f9554c23413fc2485a90f99905242e1..0a0b7ba81d1370ea99970d3c6582b7f44ececa83 100644 (file)
@@ -8,29 +8,29 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sumo
-PKG_VERSION:=1.1.0
+PKG_VERSION:=1.3.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-src-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/sumo
-PKG_HASH:=68630b6879a3331683443e8044cb0a81e5919f9e4cfb80722933da85b84e542e
+PKG_HASH:=dd089814499cc8d21ea90ab506adbb01e7fda9d9685d9d90a1a41cc3fe680505
 
 PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
-PKG_LICENSE:=GPL-3.0
+PKG_LICENSE:=GPL-3.0-or-later
 PKG_LICENSE_FILES:=COPYING
 
+CMAKE_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
-PKG_FIXUP:=autoreconf
-PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
 
 define Package/sumo
   SECTION:=utils
   CATEGORY:=Utilities
   TITLE:=SUMO - Simulation of Urban MObility
   URL:=https://sumo.dlr.de/
-  DEPENDS:=+libxerces-c
+  DEPENDS:=+libxerces-c +zlib
 endef
 
 define Package/sumo/description
@@ -42,15 +42,9 @@ define Package/sumo/description
   various APIs to remotely control the simulation.
 endef
 
-CONFIGURE_ARGS += \
-       --with-xerces=$(STAGING_DIR)/usr \
-       --disable-debug \
-       --disable-dependency-tracking \
-       --disable-silent-rules
-
 define Package/sumo/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{activitygen,dfrouter,duarouter,emissionsDrivingCycle,emissionsMap,jtrrouter,marouter,netconvert,netgenerate,od2trips,polyconvert,TraCITestClient} $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{activitygen,dfrouter,duarouter,emissionsDrivingCycle,emissionsMap,jtrrouter,marouter,netconvert,netgenerate,od2trips,polyconvert} $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sumo $(1)/usr/bin/sumo-bin
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) files/sumo.sh $(1)/usr/sbin/sumo
diff --git a/utils/sumo/patches/010-usleep.patch b/utils/sumo/patches/010-usleep.patch
new file mode 100644 (file)
index 0000000..39eb5b3
--- /dev/null
@@ -0,0 +1,73 @@
+From d35215b50bfea42c8a1d884c65fda1dee8b62d50 Mon Sep 17 00:00:00 2001
+From: Michael Behrisch <michael.behrisch@dlr.de>
+Date: Fri, 4 Oct 2019 11:41:29 +0200
+Subject: [PATCH] removing usleep, refs #12, fix #6133
+
+---
+ src/utils/foxtools/FXSingleEventThread.cpp   |  9 +++------
+ src/utils/iodevices/OutputDevice_Network.cpp | 17 ++++-------------
+ 2 files changed, 7 insertions(+), 19 deletions(-)
+
+diff --git a/src/utils/foxtools/FXSingleEventThread.cpp b/src/utils/foxtools/FXSingleEventThread.cpp
+index 4b12fb920f..f545c18439 100644
+--- a/src/utils/foxtools/FXSingleEventThread.cpp
++++ b/src/utils/foxtools/FXSingleEventThread.cpp
+@@ -35,6 +35,8 @@
+ #else
+ #include <process.h>
+ #endif
++#include <chrono>
++#include <thread>
+ #ifndef WIN32
+ # define PIPE_READ 0
+@@ -137,12 +139,7 @@ FXSingleEventThread::onThreadEvent(FXObject*, FXSelector, void*) {
+ void
+ FXSingleEventThread::sleep(long ms) {
+-#ifdef WIN32
+-    Sleep(ms);
+-#else
+-    long long us = ms * 1000;
+-    usleep(us);
+-#endif
++    std::this_thread::sleep_for(std::chrono::milliseconds(ms));
+ }
+diff --git a/src/utils/iodevices/OutputDevice_Network.cpp b/src/utils/iodevices/OutputDevice_Network.cpp
+index 2c20ce96aa..6bde32e1e6 100644
+--- a/src/utils/iodevices/OutputDevice_Network.cpp
++++ b/src/utils/iodevices/OutputDevice_Network.cpp
+@@ -21,15 +21,10 @@
+ // ==========================================================================
+ // included modules
+ // ==========================================================================
+-#include <config.h> // #ifdef _MSC_VER
++#include <config.h>
+-#ifdef WIN32
+-#define NOMINMAX
+-#include <windows.h>
+-#undef NOMINMAX
+-#else
+-#include <unistd.h>
+-#endif
++#include <thread>
++#include <chrono>
+ #include <vector>
+ #include "OutputDevice_Network.h"
+ #include "foreign/tcpip/socket.h"
+@@ -57,11 +52,7 @@ OutputDevice_Network::OutputDevice_Network(const std::string& host,
+             if (wait == 9000) {
+                 throw IOError(toString(e.what()) + " (host: " + host + ", port: " + toString(port) + ")");
+             }
+-#ifdef WIN32
+-            Sleep(wait);
+-#else
+-            usleep(wait * 1000);
+-#endif
++            std::this_thread::sleep_for(std::chrono::milliseconds(wait));
+         }
+     }
+     myFilename = host + ":" + toString(port);
diff --git a/utils/sumo/patches/020-strerror.patch b/utils/sumo/patches/020-strerror.patch
new file mode 100644 (file)
index 0000000..e9529ad
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/src/foreign/zstr/strict_fstream.hpp
++++ b/src/foreign/zstr/strict_fstream.hpp
+@@ -33,17 +33,17 @@ static std::string strerror()
+     {
+         buff = "Unknown error";
+     }
+-#elif __APPLE__ || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
++#elif defined(__GLIBC__)
++// GNU-specific strerror_r()
++    auto p = strerror_r(errno, &buff[0], buff.size());
++    std::string tmp(p, std::strlen(p));
++    std::swap(buff, tmp);
++#else
+ // XSI-compliant strerror_r()
+     if (strerror_r(errno, &buff[0], buff.size()) != 0)
+     {
+         buff = "Unknown error";
+     }
+-#else
+-// GNU-specific strerror_r()
+-    auto p = strerror_r(errno, &buff[0], buff.size());
+-    std::string tmp(p, std::strlen(p));
+-    std::swap(buff, tmp);
+ #endif
+     buff.resize(buff.find('\0'));
+     return buff;
diff --git a/utils/sumo/patches/100-configure_fix.patch b/utils/sumo/patches/100-configure_fix.patch
deleted file mode 100644 (file)
index e5deea5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -87,11 +87,6 @@ dnl - - - - - - - - - - - - - - - - - -
- case "$host" in
-    x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux*)
- dnl Make sure we are on architecture that supports SIMD
--   if test x$CXX = xclang++; then
--       CXXFLAGS="-msse2 $CXXFLAGS"
--   else
--       CXXFLAGS="-msse2 -mfpmath=sse $CXXFLAGS"
--   fi
-    ;;
-    *-cygwin*)
-    AC_DEFINE([HAVE_CYGWIN], [1], [Define if compiling under cygwin])
git clone https://git.99rst.org/PROJECT