sipp: bump to 3.6.1 584/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Mon, 12 Oct 2020 07:49:52 +0000 (09:49 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Mon, 12 Oct 2020 07:53:35 +0000 (09:53 +0200)
Upstream dropped autotools support, so this converts the build to use
cmake. Adds a simple include fix as well as a fix for older c++
compilers (the latter is a patch from upstream).

Support for pcaps is now also compiled in, to follow what upstream
considers a "common" build.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/sipp/Makefile
net/sipp/patches/01-locale-include.patch [new file with mode: 0644]
net/sipp/patches/02-Fix_compatibility_with_older_C++_in_3.6.x_branch.patch [new file with mode: 0644]

index 25c9fbdb49bc4b4a0446fa41bfedebc3c48f9f15..a2add58cbbd27a058ce0f2e94973d59c46c699da 100644 (file)
@@ -8,26 +8,27 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sipp
-PKG_VERSION:=3.6.0
+PKG_VERSION:=3.6.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/SIPp/sipp/releases/download/v$(PKG_VERSION)
-PKG_HASH:=e47e7b11fec0769cf76b30623a66390333bdb20323c66043ca535460858fa1bb
+PKG_HASH:=6a560e83aff982f331ddbcadfb3bd530c5896cd5b757dd6eb682133cc860ecb1
 
 PKG_LICENSE:=GPL-2.0+ BSD-3-Clause Zlib
 PKG_LICENSE_FILES:=LICENSE.txt
 
-PKG_FIXUP:=autoreconf
-
 include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_INSTALL:=1
 
 define Package/sipp
   SECTION:=net
   CATEGORY:=Network
   SUBMENU:=Telephony
-  DEPENDS:=$(CXX_DEPENDS) +libncurses +libpthread
+  DEPENDS:=$(CXX_DEPENDS) +libncurses +libpcap +libpthread
   TITLE:=test tool / traffic generator for the SIP protocol
   URL:=http://sipp.sourceforge.net/
 endef
@@ -39,16 +40,19 @@ define Package/sipp/description
  methods.
 endef
 
-CONFIGURE_ARGS+= \
-       --enable-epoll \
-       --without-gsl \
-       --without-pcap \
-       --with-rtpstream \
-       --without-sctp
+# Otherwise OpenWrt's CPPFLAGS are ignored
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
+
+# Use "common" options, see build.sh (we don't have gsl though)
+CMAKE_OPTIONS += \
+       -DUSE_GSL= \
+       -DUSE_PCAP=1 \
+       -DUSE_SCTP= \
+       -DUSE_SSL=
 
 define Package/sipp/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sipp $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sipp $(1)/usr/bin
 endef
 
 $(eval $(call BuildPackage,sipp))
diff --git a/net/sipp/patches/01-locale-include.patch b/net/sipp/patches/01-locale-include.patch
new file mode 100644 (file)
index 0000000..5562297
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/screen.cpp
++++ b/src/screen.cpp
+@@ -18,6 +18,7 @@
+  */
+ #include <curses.h>
++#include <locale.h>
+ #include "screen.hpp"
+ #include "sipp.hpp"
diff --git a/net/sipp/patches/02-Fix_compatibility_with_older_C++_in_3.6.x_branch.patch b/net/sipp/patches/02-Fix_compatibility_with_older_C++_in_3.6.x_branch.patch
new file mode 100644 (file)
index 0000000..8826f21
--- /dev/null
@@ -0,0 +1,149 @@
+commit 626de652455a6c061d5a045fb226212c1f7eaeb5
+Author: Walter Doekes <walter+github@wjd.nu>
+Date:   Fri Sep 18 09:56:40 2020 +0200
+
+    Fix compatibility with older C++ in 3.6.x branch
+    
+    - no auto keyword (auto x = 1)
+    - no range based loop (for (*iter) : iterable)
+    - no std::to_string
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 111c137..f1f815a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -32,6 +32,7 @@ file(GLOB all_SRCS
+   "${PROJECT_SOURCE_DIR}/src/*.c"
+   )
++include(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
+ include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+ include(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
+ include(${CMAKE_ROOT}/Modules/CheckStructHasMember.cmake)
+@@ -43,6 +44,10 @@ CHECK_STRUCT_HAS_MEMBER("struct udphdr" uh_sport "sys/types.h;netinet/udp.h"  HA
+ CHECK_SYMBOL_EXISTS(le16toh "endian.h" HAVE_DECL_LE16TOH)
+ CHECK_SYMBOL_EXISTS(le16toh "sys/endian.h" HAVE_DECL_LE16TOH_BSD)
++CHECK_CXX_SOURCE_COMPILES("
++#include <string>
++int main() { std::to_string(1).c_str(); return 0; }
++" HAVE_STD_TOSTRING)
+ configure_file("${PROJECT_SOURCE_DIR}/include/config.h.in"
+                "${PROJECT_BINARY_DIR}/config.h" )
+diff --git a/include/config.h.in b/include/config.h.in
+index 8c22504..cf39ea1 100644
+--- a/include/config.h.in
++++ b/include/config.h.in
+@@ -1,5 +1,5 @@
+ /*--------------------------------------------------------------------------
+- * This file is autogenerated from config.h.in 
++ * This file is autogenerated from include/config.h.in
+  * during the cmake configuration of your project. If you need to make changes
+  * edit the original file NOT THIS FILE.
+  * --------------------------------------------------------------------------*/
+@@ -18,5 +18,6 @@
+ #endif
+ #cmakedefine HAVE_IP_COMPAT_H @HAVE_IP_COMPAT_H@
+ #cmakedefine HAVE_UDP_UH_PREFIX @HAVE_UDP_UH_PREFIX@
++#cmakedefine HAVE_STD_TOSTRING @HAVE_STD_TOSTRING@
+ #endif
+diff --git a/include/screen.hpp b/include/screen.hpp
+index 13a9708..37c8ddf 100644
+--- a/include/screen.hpp
++++ b/include/screen.hpp
+@@ -43,9 +43,12 @@ void print_statistics(int last);
+ extern int key_backspace;
+ extern int key_dc;
++typedef std::vector<std::string> string_array;
++
+ class ScreenPrinter {
+ public:
+     ScreenPrinter():
++        M_last(false),
+         M_headless(!isatty(fileno(stdout)))
+     {};
+     void redraw();
+@@ -63,9 +66,9 @@ private:
+     void draw_repartition_detailed(CStat::T_dynamicalRepartition * tabRepartition,
+                                  int sizeOfTab);
+-    std::vector<std::string> lines;
++    string_array lines;
+-    bool M_last = false;
++    bool M_last;
+ };
+ extern ScreenPrinter* sp;
+diff --git a/include/sipp.hpp b/include/sipp.hpp
+index 878c99f..b04a619 100644
+--- a/include/sipp.hpp
++++ b/include/sipp.hpp
+@@ -83,6 +83,18 @@
+ #include "ratetask.hpp"
+ #include "watchdog.hpp"
++/* Backwards compatibility */
++#ifndef HAVE_STD_TOSTRING
++#include <sstream>
++namespace std {
++template <typename T> string to_string(T value) {
++    ostringstream os;
++    os << value;
++    return os.str();
++}
++}
++#endif
++
+ /*
+  * If this files is included in the Main, then extern definitions
+  * are removed, and the DEFVAL macro becomes '= value;'. Else
+diff --git a/src/screen.cpp b/src/screen.cpp
+index bbf9cd2..5521a44 100644
+--- a/src/screen.cpp
++++ b/src/screen.cpp
+@@ -83,15 +83,15 @@ void print_statistics(int last)
+ void ScreenPrinter::print_closing_stats() {
+     M_last = true;
+     get_lines();
+-    for (auto line : lines) {
+-        printf("%s\n", line.c_str());
++    for (string_array::iterator it = lines.begin(); it != lines.end(); ++it) {
++        printf("%s\n", (*it).c_str());
+     }
+     if (currentScreenToDisplay != DISPLAY_STAT_SCREEN) {
+         currentScreenToDisplay = DISPLAY_STAT_SCREEN;
+         get_lines();
+-        for (auto line : lines) {
+-            printf("%s\n", line.c_str());
++        for (string_array::iterator it = lines.begin(); it != lines.end(); ++it) {
++            printf("%s\n", (*it).c_str());
+         }
+     }
+@@ -100,8 +100,8 @@ void ScreenPrinter::print_closing_stats() {
+ void ScreenPrinter::print_to_file(FILE* f)
+ {
+     get_lines();
+-    for (auto line : lines) {
+-        fprintf(f, "%s\n", line.c_str());
++    for (string_array::iterator it = lines.begin(); it != lines.end(); ++it) {
++        fprintf(f, "%s\n", (*it).c_str());
+     }
+ }
+@@ -114,8 +114,8 @@ void ScreenPrinter::redraw()
+     if (!M_headless) {
+         get_lines();
+         erase();
+-        for (auto line : lines) {
+-            printw("%s\n", line.c_str());
++        for (string_array::iterator it = lines.begin(); it != lines.end(); ++it) {
++            printw("%s\n", (*it).c_str());
+         }
+         if (command_mode) {