Backported upstream patch with LTO fixes.
This commit is contained in:
parent
da1fc12b21
commit
beb22580b5
225
mtxclient-lto-fixes.patch
Normal file
225
mtxclient-lto-fixes.patch
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
From ea8bccf111ee9af510c3a28ff8a30e9b16e2ff66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nicolas Werner <nicolas.werner@hotmail.de>
|
||||||
|
Date: Wed, 20 Jan 2021 20:20:33 +0100
|
||||||
|
Subject: [PATCH] Fix LTO issues
|
||||||
|
|
||||||
|
---
|
||||||
|
include/mtxclient/http/client.hpp | 130 +++++++++++++++----------
|
||||||
|
include/mtxclient/http/client_impl.hpp | 52 ++++++++++
|
||||||
|
lib/http/client.cpp | 4 +
|
||||||
|
3 files changed, 136 insertions(+), 50 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/mtxclient/http/client.hpp b/include/mtxclient/http/client.hpp
|
||||||
|
index 138df843..1593f873 100644
|
||||||
|
--- a/include/mtxclient/http/client.hpp
|
||||||
|
+++ b/include/mtxclient/http/client.hpp
|
||||||
|
@@ -628,54 +628,84 @@ class Client : public std::enable_shared_from_this<Client>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-template<class Payload>
|
||||||
|
-[[gnu::used, llvm::used]] void
|
||||||
|
-mtx::http::Client::send_room_message(const std::string &room_id,
|
||||||
|
- const Payload &payload,
|
||||||
|
- Callback<mtx::responses::EventId> callback)
|
||||||
|
-{
|
||||||
|
- send_room_message<Payload>(room_id, generate_txn_id(), payload, callback);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-template<class Payload>
|
||||||
|
-[[gnu::used, llvm::used]] void
|
||||||
|
-mtx::http::Client::send_room_message(const std::string &room_id,
|
||||||
|
- const std::string &txn_id,
|
||||||
|
- const Payload &payload,
|
||||||
|
- Callback<mtx::responses::EventId> callback)
|
||||||
|
-{
|
||||||
|
- constexpr auto event_type = mtx::events::message_content_to_type<Payload>;
|
||||||
|
- static_assert(event_type != mtx::events::EventType::Unsupported);
|
||||||
|
-
|
||||||
|
- const auto api_path = "/client/r0/rooms/" + mtx::client::utils::url_encode(room_id) +
|
||||||
|
- "/send/" + mtx::events::to_string(event_type) + "/" +
|
||||||
|
- mtx::client::utils::url_encode(txn_id);
|
||||||
|
-
|
||||||
|
- put<Payload, mtx::responses::EventId>(api_path, payload, callback);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-template<class Payload>
|
||||||
|
-[[gnu::used, llvm::used]] void
|
||||||
|
-mtx::http::Client::send_state_event(const std::string &room_id,
|
||||||
|
- const std::string &state_key,
|
||||||
|
- const Payload &payload,
|
||||||
|
- Callback<mtx::responses::EventId> callback)
|
||||||
|
-{
|
||||||
|
- constexpr auto event_type = mtx::events::state_content_to_type<Payload>;
|
||||||
|
- static_assert(event_type != mtx::events::EventType::Unsupported);
|
||||||
|
-
|
||||||
|
- const auto api_path = "/client/r0/rooms/" + mtx::client::utils::url_encode(room_id) +
|
||||||
|
- "/state/" + mtx::events::to_string(event_type) + "/" +
|
||||||
|
- mtx::client::utils::url_encode(state_key);
|
||||||
|
-
|
||||||
|
- put<Payload, mtx::responses::EventId>(api_path, payload, callback);
|
||||||
|
-}
|
||||||
|
+// Template instantiations for the various send functions
|
||||||
|
+
|
||||||
|
+#define MTXCLIENT_SEND_STATE_EVENT_FWD(Content) \
|
||||||
|
+ extern template void mtx::http::Client::send_state_event<mtx::events::state::Content>( \
|
||||||
|
+ const std::string &, \
|
||||||
|
+ const std::string &state_key, \
|
||||||
|
+ const mtx::events::state::Content &, \
|
||||||
|
+ Callback<mtx::responses::EventId> cb); \
|
||||||
|
+ extern template void mtx::http::Client::send_state_event<mtx::events::state::Content>( \
|
||||||
|
+ const std::string &, \
|
||||||
|
+ const mtx::events::state::Content &, \
|
||||||
|
+ Callback<mtx::responses::EventId> cb);
|
||||||
|
+
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Aliases)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Avatar)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(CanonicalAlias)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Create)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Encryption)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(GuestAccess)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(HistoryVisibility)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(JoinRules)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Member)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Name)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(PinnedEvents)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(PowerLevels)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Tombstone)
|
||||||
|
+MTXCLIENT_SEND_STATE_EVENT_FWD(Topic)
|
||||||
|
+
|
||||||
|
+#define MTXCLIENT_SEND_ROOM_MESSAGE_FWD(Content) \
|
||||||
|
+ extern template void mtx::http::Client::send_room_message<Content>( \
|
||||||
|
+ const std::string &, \
|
||||||
|
+ const std::string &, \
|
||||||
|
+ const Content &, \
|
||||||
|
+ Callback<mtx::responses::EventId> cb); \
|
||||||
|
+ extern template void mtx::http::Client::send_room_message<Content>( \
|
||||||
|
+ const std::string &, const Content &, Callback<mtx::responses::EventId> cb);
|
||||||
|
+
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Encrypted)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::StickerImage)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Reaction)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Audio)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Emote)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::File)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Image)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Notice)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Text)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::Video)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationRequest)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationStart)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationReady)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationDone)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationAccept)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationCancel)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationKey)
|
||||||
|
+// MTXCLIENT_SEND_ROOM_MESSAGE(mtx::events::msg::KeyVerificationMac)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::CallInvite)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::CallCandidates)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::CallAnswer)
|
||||||
|
+MTXCLIENT_SEND_ROOM_MESSAGE_FWD(mtx::events::msg::CallHangUp)
|
||||||
|
+
|
||||||
|
+#define MTXCLIENT_SEND_TO_DEVICE_FWD(Content) \
|
||||||
|
+ extern template void mtx::http::Client::send_to_device<Content>( \
|
||||||
|
+ const std::string &txid, \
|
||||||
|
+ const std::map<mtx::identifiers::User, std::map<std::string, Content>> &messages, \
|
||||||
|
+ ErrCallback callback);
|
||||||
|
|
||||||
|
-template<class Payload>
|
||||||
|
-[[gnu::used, llvm::used]] void
|
||||||
|
-mtx::http::Client::send_state_event(const std::string &room_id,
|
||||||
|
- const Payload &payload,
|
||||||
|
- Callback<mtx::responses::EventId> callback)
|
||||||
|
-{
|
||||||
|
- send_state_event<Payload>(room_id, "", payload, callback);
|
||||||
|
-}
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::RoomKey)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::ForwardedRoomKey)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyRequest)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::OlmEncrypted)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::Encrypted)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationRequest)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationStart)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationReady)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationDone)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationAccept)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationCancel)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationKey)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::KeyVerificationMac)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::SecretSend)
|
||||||
|
+MTXCLIENT_SEND_TO_DEVICE_FWD(mtx::events::msg::SecretRequest)
|
||||||
|
diff --git a/include/mtxclient/http/client_impl.hpp b/include/mtxclient/http/client_impl.hpp
|
||||||
|
index 659800c7..54f54c8e 100644
|
||||||
|
--- a/include/mtxclient/http/client_impl.hpp
|
||||||
|
+++ b/include/mtxclient/http/client_impl.hpp
|
||||||
|
@@ -182,3 +182,55 @@ mtx::http::Client::send_to_device(
|
||||||
|
|
||||||
|
send_to_device(mtx::events::to_string(event_type), txid, j, callback);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+template<class Payload>
|
||||||
|
+[[gnu::used, llvm::used]] void
|
||||||
|
+mtx::http::Client::send_room_message(const std::string &room_id,
|
||||||
|
+ const Payload &payload,
|
||||||
|
+ Callback<mtx::responses::EventId> callback)
|
||||||
|
+{
|
||||||
|
+ send_room_message<Payload>(room_id, generate_txn_id(), payload, callback);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template<class Payload>
|
||||||
|
+[[gnu::used, llvm::used]] void
|
||||||
|
+mtx::http::Client::send_room_message(const std::string &room_id,
|
||||||
|
+ const std::string &txn_id,
|
||||||
|
+ const Payload &payload,
|
||||||
|
+ Callback<mtx::responses::EventId> callback)
|
||||||
|
+{
|
||||||
|
+ constexpr auto event_type = mtx::events::message_content_to_type<Payload>;
|
||||||
|
+ static_assert(event_type != mtx::events::EventType::Unsupported);
|
||||||
|
+
|
||||||
|
+ const auto api_path = "/client/r0/rooms/" + mtx::client::utils::url_encode(room_id) +
|
||||||
|
+ "/send/" + mtx::events::to_string(event_type) + "/" +
|
||||||
|
+ mtx::client::utils::url_encode(txn_id);
|
||||||
|
+
|
||||||
|
+ put<Payload, mtx::responses::EventId>(api_path, payload, callback);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template<class Payload>
|
||||||
|
+[[gnu::used, llvm::used]] void
|
||||||
|
+mtx::http::Client::send_state_event(const std::string &room_id,
|
||||||
|
+ const std::string &state_key,
|
||||||
|
+ const Payload &payload,
|
||||||
|
+ Callback<mtx::responses::EventId> callback)
|
||||||
|
+{
|
||||||
|
+ constexpr auto event_type = mtx::events::state_content_to_type<Payload>;
|
||||||
|
+ static_assert(event_type != mtx::events::EventType::Unsupported);
|
||||||
|
+
|
||||||
|
+ const auto api_path = "/client/r0/rooms/" + mtx::client::utils::url_encode(room_id) +
|
||||||
|
+ "/state/" + mtx::events::to_string(event_type) + "/" +
|
||||||
|
+ mtx::client::utils::url_encode(state_key);
|
||||||
|
+
|
||||||
|
+ put<Payload, mtx::responses::EventId>(api_path, payload, callback);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template<class Payload>
|
||||||
|
+[[gnu::used, llvm::used]] void
|
||||||
|
+mtx::http::Client::send_state_event(const std::string &room_id,
|
||||||
|
+ const Payload &payload,
|
||||||
|
+ Callback<mtx::responses::EventId> callback)
|
||||||
|
+{
|
||||||
|
+ send_state_event<Payload>(room_id, "", payload, callback);
|
||||||
|
+}
|
||||||
|
diff --git a/lib/http/client.cpp b/lib/http/client.cpp
|
||||||
|
index 2f039c9e..d477526b 100644
|
||||||
|
--- a/lib/http/client.cpp
|
||||||
|
+++ b/lib/http/client.cpp
|
||||||
|
@@ -1257,6 +1257,10 @@ Client::get_turn_server(Callback<mtx::responses::TurnServer> cb)
|
||||||
|
const std::string &, \
|
||||||
|
const std::string &state_key, \
|
||||||
|
const mtx::events::state::Content &, \
|
||||||
|
+ Callback<mtx::responses::EventId> cb); \
|
||||||
|
+ template void mtx::http::Client::send_state_event<mtx::events::state::Content>( \
|
||||||
|
+ const std::string &, \
|
||||||
|
+ const mtx::events::state::Content &, \
|
||||||
|
Callback<mtx::responses::EventId> cb);
|
||||||
|
|
||||||
|
MTXCLIENT_SEND_STATE_EVENT(Aliases)
|
@ -1,5 +1,4 @@
|
|||||||
%undefine __cmake_in_source_build
|
%undefine __cmake_in_source_build
|
||||||
%global _lto_cflags %{nil}
|
|
||||||
%bcond_with clang
|
%bcond_with clang
|
||||||
|
|
||||||
%if %{with clang}
|
%if %{with clang}
|
||||||
@ -8,25 +7,30 @@
|
|||||||
|
|
||||||
Name: mtxclient
|
Name: mtxclient
|
||||||
Version: 0.4.0
|
Version: 0.4.0
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
Summary: Client API library for Matrix, built on top of Boost.Asio
|
Summary: Client API library for Matrix, built on top of Boost.Asio
|
||||||
URL: https://github.com/Nheko-Reborn/%{name}
|
URL: https://github.com/Nheko-Reborn/%{name}
|
||||||
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
BuildRequires: spdlog-devel >= 0.16
|
# https://github.com/Nheko-Reborn/mtxclient/commit/ea8bccf111ee9af510c3a28ff8a30e9b16e2ff66
|
||||||
|
Patch100: %{name}-lto-fixes.patch
|
||||||
|
|
||||||
|
BuildRequires: cmake(mpark_variant)
|
||||||
|
BuildRequires: cmake(nlohmann_json) >= 3.1.2
|
||||||
|
BuildRequires: cmake(Olm) >= 3.1.0
|
||||||
|
BuildRequires: cmake(spdlog) >= 0.16
|
||||||
|
|
||||||
|
BuildRequires: pkgconfig(libcrypto)
|
||||||
|
BuildRequires: pkgconfig(openssl)
|
||||||
|
BuildRequires: pkgconfig(zlib)
|
||||||
|
|
||||||
BuildRequires: boost-devel >= 1.70
|
BuildRequires: boost-devel >= 1.70
|
||||||
BuildRequires: json-devel >= 3.1.2
|
|
||||||
BuildRequires: mpark-variant-devel
|
|
||||||
BuildRequires: libsodium-devel
|
|
||||||
BuildRequires: openssl-devel
|
|
||||||
BuildRequires: libolm-devel
|
|
||||||
BuildRequires: ninja-build
|
|
||||||
BuildRequires: zlib-devel
|
|
||||||
BuildRequires: gcc-c++
|
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: ninja-build
|
||||||
|
|
||||||
%if %{with clang}
|
%if %{with clang}
|
||||||
BuildRequires: compiler-rt
|
BuildRequires: compiler-rt
|
||||||
@ -82,6 +86,9 @@ ln -s libmatrix_client.so.%{version} %{buildroot}%{_libdir}/libmatrix_client.so.
|
|||||||
%{_libdir}/*.so
|
%{_libdir}/*.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 20 2021 Vitaly Zaitsev <vitaly@easycoding.org> - 0.4.0-3
|
||||||
|
- Backported upstream patch with LTO fixes.
|
||||||
|
|
||||||
* Wed Jan 20 2021 Vitaly Zaitsev <vitaly@easycoding.org> - 0.4.0-2
|
* Wed Jan 20 2021 Vitaly Zaitsev <vitaly@easycoding.org> - 0.4.0-2
|
||||||
- Disabled LTO due to nheko linkage issues.
|
- Disabled LTO due to nheko linkage issues.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user