Files
js/boost-compatible.diff
tomFlowee 10ca339b57 Make floweejs compile with ancient boost.
For people that want to compile in docker this is needed as there
are not really any dockers with an up-to-date boost.
2021-02-12 14:37:13 +01:00

107 lines
3.4 KiB
Diff

From a63e1dfacdeee3e3249df94f237d6064e126a2e9 Mon Sep 17 00:00:00 2001
From: TomZ <tom@flowee.org>
Date: Fri, 12 Feb 2021 11:49:29 +0100
Subject: [PATCH] Re-add backwards compatibility hack for old boost
---
external/NetworkManager_p.h | 3 ++-
external/boost_compat.h | 32 ++++++++++++++++++++++++
external/utils/WaitUntilFinishedHelper.h | 6 ++---
3 files changed, 37 insertions(+), 4 deletions(-)
create mode 100644 external/boost_compat.h
diff --git a/external/NetworkManager_p.h b/external/NetworkManager_p.h
index c0168a4..1d69af4 100644
--- a/external/NetworkManager_p.h
+++ b/external/NetworkManager_p.h
@@ -30,6 +30,7 @@
#include "NetworkEndPoint.h"
#include "NetworkConnection.h"
+#include "boost_compat.h"
#include <Message.h>
#include <streaming/BufferPool.h>
@@ -225,7 +226,7 @@ public:
void recycleConnection();
- boost::asio::io_context::strand m_strand;
+ BoostCompatStrand m_strand;
/// move a call to the thread that the strand represents
void runOnStrand(const std::function<void()> &function);
diff --git a/external/boost_compat.h b/external/boost_compat.h
new file mode 100644
index 0000000..bff6bc5
--- /dev/null
+++ b/external/boost_compat.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the Flowee project
+ * Copyright (C) 2018 Tom Zander <tomz@freedommail.ch>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef FLOWEE_BOOST_COMPAT
+#define FLOWEE_BOOST_COMPAT
+
+#include <boost/version.hpp>
+
+// boost didn't leave much of backwards compatibility in this one.
+#if BOOST_VERSION < 106600
+# define BoostCompatStrand boost::asio::strand
+# include <boost/asio/strand.hpp>
+#else
+# define BoostCompatStrand boost::asio::io_context::strand
+# include <boost/asio/io_context_strand.hpp>
+#endif
+
+#endif
diff --git a/external/utils/WaitUntilFinishedHelper.h b/external/utils/WaitUntilFinishedHelper.h
index bb1dbb3..1a9f02b 100644
--- a/external/utils/WaitUntilFinishedHelper.h
+++ b/external/utils/WaitUntilFinishedHelper.h
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "../boost_compat.h"
#include <functional>
-#include <boost/asio/io_context_strand.hpp>
#include <mutex>
#include <atomic>
@@ -30,7 +30,7 @@
class WaitUntilFinishedHelper
{
public:
- WaitUntilFinishedHelper(const std::function<void()> &target, boost::asio::io_context::strand *strand);
+ WaitUntilFinishedHelper(const std::function<void()> &target, BoostCompatStrand *strand);
WaitUntilFinishedHelper(const WaitUntilFinishedHelper &other);
~WaitUntilFinishedHelper();
@@ -41,7 +41,7 @@ private:
mutable std::mutex mutex;
std::function<void()> target;
std::atomic<int> ref;
- boost::asio::io_context::strand *strand;
+ BoostCompatStrand *strand;
};
Private *d;
--
2.30.1