1 |
commit: 07bf3c91f77f1f1be8ae4c40af34415c2d7738ee |
2 |
Author: Ronny (tastytea) Gutbrod <gentoo <AT> tastytea <DOT> de> |
3 |
AuthorDate: Mon Aug 1 12:33:39 2022 +0000 |
4 |
Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me> |
5 |
CommitDate: Mon Aug 1 12:33:39 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=07bf3c91 |
7 |
|
8 |
dev-cpp/mastodonpp: add patch for catch 3 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/861668 |
11 |
Signed-off-by: Ronny (tastytea) Gutbrod <gentoo <AT> tastytea.de> |
12 |
|
13 |
.../mastodonpp-0.5.7-add-support-for-catch-3.patch | 139 +++++++++++++++++++++ |
14 |
dev-cpp/mastodonpp/mastodonpp-0.5.7-r1.ebuild | 61 +++++++++ |
15 |
2 files changed, 200 insertions(+) |
16 |
|
17 |
diff --git a/dev-cpp/mastodonpp/files/mastodonpp-0.5.7-add-support-for-catch-3.patch b/dev-cpp/mastodonpp/files/mastodonpp-0.5.7-add-support-for-catch-3.patch |
18 |
new file mode 100644 |
19 |
index 000000000..e63324cfc |
20 |
--- /dev/null |
21 |
+++ b/dev-cpp/mastodonpp/files/mastodonpp-0.5.7-add-support-for-catch-3.patch |
22 |
@@ -0,0 +1,139 @@ |
23 |
+# Upstream commit: <https://schlomp.space/tastytea/mastodonpp/commit/7255df0> |
24 |
+ |
25 |
+From 7255df01e047da9bf88dcb6945d07b49126e24b4 Mon Sep 17 00:00:00 2001 |
26 |
+From: tastytea <tastytea@××××××××.de> |
27 |
+Date: Mon, 1 Aug 2022 14:01:38 +0200 |
28 |
+Subject: [PATCH] add support for testing with catch 3 |
29 |
+ |
30 |
+--- |
31 |
+ tests/CMakeLists.txt | 11 ++++++++--- |
32 |
+ tests/main.cpp | 9 +++++++-- |
33 |
+ tests/test_connection.cpp | 9 +++++++-- |
34 |
+ tests/test_html_unescape.cpp | 9 +++++++-- |
35 |
+ tests/test_instance.cpp | 9 +++++++-- |
36 |
+ 5 files changed, 36 insertions(+), 11 deletions(-) |
37 |
+ |
38 |
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt |
39 |
+index 3f7107b..dacc10d 100644 |
40 |
+--- a/tests/CMakeLists.txt |
41 |
++++ b/tests/CMakeLists.txt |
42 |
+@@ -3,11 +3,16 @@ include(CTest) |
43 |
+ file(GLOB sources_tests test_*.cpp) |
44 |
+ |
45 |
+ find_package(Catch2 CONFIG) |
46 |
+-if(Catch2_FOUND) # Catch 2.x |
47 |
++if(Catch2_FOUND) # Catch 2.x / 3.x |
48 |
+ include(Catch) |
49 |
+ add_executable(all_tests main.cpp ${sources_tests}) |
50 |
+- target_link_libraries(all_tests |
51 |
+- PRIVATE Catch2::Catch2 ${PROJECT_NAME}) |
52 |
++ if(TARGET Catch2::Catch2WithMain) # Catch 3.x |
53 |
++ target_link_libraries(all_tests |
54 |
++ PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME}) |
55 |
++ else() # Catch 2.x |
56 |
++ target_link_libraries(all_tests |
57 |
++ PRIVATE Catch2::Catch2 ${PROJECT_NAME}) |
58 |
++ endif() |
59 |
+ target_include_directories(all_tests PRIVATE "/usr/include/catch2") |
60 |
+ catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}") |
61 |
+ else() # Catch 1.x |
62 |
+diff --git a/tests/main.cpp b/tests/main.cpp |
63 |
+index 162dfdf..c6d12ed 100644 |
64 |
+--- a/tests/main.cpp |
65 |
++++ b/tests/main.cpp |
66 |
+@@ -1,5 +1,5 @@ |
67 |
+ /* This file is part of mastodonpp. |
68 |
+- * Copyright © 2020 tastytea <tastytea@××××××××.de> |
69 |
++ * Copyright © 2020, 2022 tastytea <tastytea@××××××××.de> |
70 |
+ * |
71 |
+ * This program is free software: you can redistribute it and/or modify |
72 |
+ * it under the terms of the GNU Affero General Public License as published by |
73 |
+@@ -16,4 +16,9 @@ |
74 |
+ |
75 |
+ #define CATCH_CONFIG_MAIN |
76 |
+ |
77 |
+-#include <catch.hpp> |
78 |
++// catch 3 does not have catch.hpp anymore |
79 |
++#if __has_include(<catch.hpp>) |
80 |
++# include <catch.hpp> |
81 |
++#else |
82 |
++# include <catch_all.hpp> |
83 |
++#endif |
84 |
+diff --git a/tests/test_connection.cpp b/tests/test_connection.cpp |
85 |
+index 05d7668..208e8de 100644 |
86 |
+--- a/tests/test_connection.cpp |
87 |
++++ b/tests/test_connection.cpp |
88 |
+@@ -1,5 +1,5 @@ |
89 |
+ /* This file is part of mastodonpp. |
90 |
+- * Copyright © 2020 tastytea <tastytea@××××××××.de> |
91 |
++ * Copyright © 2020, 2022 tastytea <tastytea@××××××××.de> |
92 |
+ * |
93 |
+ * This program is free software: you can redistribute it and/or modify |
94 |
+ * it under the terms of the GNU Affero General Public License as published by |
95 |
+@@ -17,7 +17,12 @@ |
96 |
+ #include "connection.hpp" |
97 |
+ #include "instance.hpp" |
98 |
+ |
99 |
+-#include <catch.hpp> |
100 |
++// catch 3 does not have catch.hpp anymore |
101 |
++#if __has_include(<catch.hpp>) |
102 |
++# include <catch.hpp> |
103 |
++#else |
104 |
++# include <catch_all.hpp> |
105 |
++#endif |
106 |
+ |
107 |
+ #include <exception> |
108 |
+ |
109 |
+diff --git a/tests/test_html_unescape.cpp b/tests/test_html_unescape.cpp |
110 |
+index d141921..1c75dd8 100644 |
111 |
+--- a/tests/test_html_unescape.cpp |
112 |
++++ b/tests/test_html_unescape.cpp |
113 |
+@@ -1,5 +1,5 @@ |
114 |
+ /* This file is part of mastodonpp. |
115 |
+- * Copyright © 2020 tastytea <tastytea@××××××××.de> |
116 |
++ * Copyright © 2020, 2022 tastytea <tastytea@××××××××.de> |
117 |
+ * |
118 |
+ * This program is free software: you can redistribute it and/or modify |
119 |
+ * it under the terms of the GNU Affero General Public License as published by |
120 |
+@@ -16,7 +16,12 @@ |
121 |
+ |
122 |
+ #include "helpers.hpp" |
123 |
+ |
124 |
+-#include <catch.hpp> |
125 |
++// catch 3 does not have catch.hpp anymore |
126 |
++#if __has_include(<catch.hpp>) |
127 |
++# include <catch.hpp> |
128 |
++#else |
129 |
++# include <catch_all.hpp> |
130 |
++#endif |
131 |
+ |
132 |
+ #include <exception> |
133 |
+ #include <string> |
134 |
+diff --git a/tests/test_instance.cpp b/tests/test_instance.cpp |
135 |
+index 768cc2a..ebc2c0c 100644 |
136 |
+--- a/tests/test_instance.cpp |
137 |
++++ b/tests/test_instance.cpp |
138 |
+@@ -1,5 +1,5 @@ |
139 |
+ /* This file is part of mastodonpp. |
140 |
+- * Copyright © 2020 tastytea <tastytea@××××××××.de> |
141 |
++ * Copyright © 2020, 2022 tastytea <tastytea@××××××××.de> |
142 |
+ * |
143 |
+ * This program is free software: you can redistribute it and/or modify |
144 |
+ * it under the terms of the GNU Affero General Public License as published by |
145 |
+@@ -16,7 +16,12 @@ |
146 |
+ |
147 |
+ #include "instance.hpp" |
148 |
+ |
149 |
+-#include <catch.hpp> |
150 |
++// catch 3 does not have catch.hpp anymore |
151 |
++#if __has_include(<catch.hpp>) |
152 |
++# include <catch.hpp> |
153 |
++#else |
154 |
++# include <catch_all.hpp> |
155 |
++#endif |
156 |
+ |
157 |
+ #include <exception> |
158 |
+ #include <string> |
159 |
+-- |
160 |
+2.35.1 |
161 |
+ |
162 |
|
163 |
diff --git a/dev-cpp/mastodonpp/mastodonpp-0.5.7-r1.ebuild b/dev-cpp/mastodonpp/mastodonpp-0.5.7-r1.ebuild |
164 |
new file mode 100644 |
165 |
index 000000000..3f03ff4df |
166 |
--- /dev/null |
167 |
+++ b/dev-cpp/mastodonpp/mastodonpp-0.5.7-r1.ebuild |
168 |
@@ -0,0 +1,61 @@ |
169 |
+# Copyright 1999-2022 Gentoo Authors |
170 |
+# Distributed under the terms of the GNU General Public License v2 |
171 |
+ |
172 |
+EAPI=7 |
173 |
+ |
174 |
+inherit cmake |
175 |
+[[ "${PV}" == "9999" ]] && inherit git-r3 |
176 |
+ |
177 |
+DESCRIPTION="C++ wrapper for the Mastodon and Pleroma APIs." |
178 |
+HOMEPAGE="https://schlomp.space/tastytea/mastodonpp" |
179 |
+if [[ "${PV}" != "9999" ]]; then |
180 |
+ SRC_URI="https://schlomp.space/tastytea/mastodonpp/archive/${PV}.tar.gz -> ${P}.tar.gz" |
181 |
+ S="${WORKDIR}/${PN}" |
182 |
+ KEYWORDS="~amd64" |
183 |
+else |
184 |
+ EGIT_REPO_URI="https://schlomp.space/tastytea/mastodonpp.git" |
185 |
+fi |
186 |
+ |
187 |
+LICENSE="AGPL-3" |
188 |
+SLOT="0" |
189 |
+IUSE="doc examples test" |
190 |
+ |
191 |
+RDEPEND=">=net-misc/curl-7.56.0[ssl]" |
192 |
+DEPEND="${RDEPEND}" |
193 |
+BDEPEND=" |
194 |
+ doc? ( app-doc/doxygen[dot] ) |
195 |
+ test? ( dev-cpp/catch ) |
196 |
+" |
197 |
+ |
198 |
+RESTRICT="!test? ( test )" |
199 |
+ |
200 |
+PATCHES=( "${FILESDIR}"/${PN}-0.5.7-add-support-for-catch-3.patch ) |
201 |
+ |
202 |
+src_configure() { |
203 |
+ local mycmakeargs=( |
204 |
+ -DWITH_EXAMPLES=NO |
205 |
+ -DWITH_TESTS="$(usex test)" |
206 |
+ -DWITH_DOC="$(usex doc)" |
207 |
+ ) |
208 |
+ |
209 |
+ cmake_src_configure |
210 |
+} |
211 |
+ |
212 |
+src_test() { |
213 |
+ BUILD_DIR="${BUILD_DIR}/tests" cmake_src_test |
214 |
+} |
215 |
+ |
216 |
+src_install() { |
217 |
+ if use doc; then |
218 |
+ HTML_DOCS="${BUILD_DIR}/doc/html/*" |
219 |
+ fi |
220 |
+ |
221 |
+ if use examples; then |
222 |
+ docinto examples |
223 |
+ for file in examples/*.cpp; do |
224 |
+ dodoc ${file} |
225 |
+ done |
226 |
+ fi |
227 |
+ |
228 |
+ cmake_src_install |
229 |
+} |