Browse Source

zmq: Fix compilation for c++ stdlib

Compilation for the zmq lib is broken for c++ stdlib in openwrt since the
patches add uclibc++ specific code.

This diffs changes the patch to only include the code conditioned
on if we are actually using uclibc++.

Signed-off-by: Amol Bhave <amol@amolbhave.com>
lilik-openwrt-22.03
Amol Bhave 6 years ago
committed by Amol Bhave
parent
commit
acabcd4c23
3 changed files with 16 additions and 91 deletions
  1. +1
    -1
      libs/zmq/Makefile
  2. +15
    -6
      libs/zmq/patches/020-map_with_const_string_with_ublic++.patch
  3. +0
    -84
      libs/zmq/patches/100-fix-cxx-include-order.patch

+ 1
- 1
libs/zmq/Makefile View File

@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=zeromq PKG_NAME:=zeromq
PKG_VERSION:=4.1.6 PKG_VERSION:=4.1.6
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=Dirk Chang <dirk@kooiot.com> PKG_MAINTAINER:=Dirk Chang <dirk@kooiot.com>
PKG_LICENSE:=GPL-3.0+ PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILES:=LICENCE.txt PKG_LICENSE_FILES:=LICENCE.txt


+ 15
- 6
libs/zmq/patches/020-map_with_const_string_with_ublic++.patch View File

@ -1,11 +1,14 @@
--- a/src/metadata.hpp --- a/src/metadata.hpp
+++ b/src/metadata.hpp +++ b/src/metadata.hpp
@@ -41,7 +41,7 @@ namespace zmq
@@ -41,7 +41,11 @@ namespace zmq
{ {
public: public:
- typedef std::map <std::string, const std::string> dict_t;
+#ifdef __UCLIBCXX_MAJOR__
+ typedef std::map <std::string, std::string> dict_t; + typedef std::map <std::string, std::string> dict_t;
+#else
typedef std::map <std::string, const std::string> dict_t;
+#endif
metadata_t (const dict_t &dict); metadata_t (const dict_t &dict);
virtual ~metadata_t (); virtual ~metadata_t ();
@ -21,21 +24,27 @@
--- a/src/stream_engine.cpp --- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp +++ b/src/stream_engine.cpp
@@ -208,7 +208,7 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
@@ -208,7 +208,11 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
// Compile metadata. // Compile metadata.
typedef metadata_t::dict_t properties_t; typedef metadata_t::dict_t properties_t;
properties_t properties; properties_t properties;
- properties.insert(std::make_pair("Peer-Address", peer_address));
+#ifdef __UCLIBCXX_MAJOR__
+ properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address)); + properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
+#else
properties.insert(std::make_pair("Peer-Address", peer_address));
+#endif
zmq_assert (metadata == NULL); zmq_assert (metadata == NULL);
metadata = new (std::nothrow) metadata_t (properties); metadata = new (std::nothrow) metadata_t (properties);
} }
@@ -815,7 +815,7 @@ void zmq::stream_engine_t::mechanism_ready ()
@@ -815,7 +815,11 @@ void zmq::stream_engine_t::mechanism_ready ()
// If we have a peer_address, add it to metadata // If we have a peer_address, add it to metadata
if (!peer_address.empty()) { if (!peer_address.empty()) {
- properties.insert(std::make_pair("Peer-Address", peer_address));
+#ifdef __UCLIBCXX_MAJOR__
+ properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address)); + properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
+#else
properties.insert(std::make_pair("Peer-Address", peer_address));
+#endif
} }
// Add ZAP properties. // Add ZAP properties.

+ 0
- 84
libs/zmq/patches/100-fix-cxx-include-order.patch View File

@ -1,84 +0,0 @@
--- a/src/mtrie.cpp
+++ b/src/mtrie.cpp
@@ -27,11 +27,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-
#include <new>
#include <algorithm>
+#include <stdlib.h>
+
#include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
--- a/src/raw_encoder.cpp
+++ b/src/raw_encoder.cpp
@@ -27,6 +27,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <basic_definitions>
+#include <exception>
+#include <cstddef>
+#include <algorithm>
+
#include "encoder.hpp"
#include "raw_encoder.hpp"
#include "likely.hpp"
--- a/src/trie.cpp
+++ b/src/trie.cpp
@@ -27,11 +27,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-
#include <new>
#include <algorithm>
+#include <stdlib.h>
+
#include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
--- a/src/encoder.hpp
+++ b/src/encoder.hpp
@@ -39,7 +39,6 @@
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
-#include <algorithm>
#include "err.hpp"
#include "msg.hpp"
--- a/src/v1_encoder.cpp
+++ b/src/v1_encoder.cpp
@@ -27,6 +27,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <basic_definitions>
+#include <exception>
+#include <cstddef>
+#include <algorithm>
+
#include "encoder.hpp"
#include "v1_encoder.hpp"
#include "likely.hpp"
--- a/src/v2_encoder.cpp
+++ b/src/v2_encoder.cpp
@@ -27,6 +27,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <basic_definitions>
+#include <exception>
+#include <cstddef>
+#include <algorithm>
+
#include "v2_protocol.hpp"
#include "v2_encoder.hpp"
#include "likely.hpp"

Loading…
Cancel
Save