Gentoo Archives: gentoo-commits

From: Ronny Gutbrod <gentoo@××××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: app-editors/imhex/files/, app-editors/imhex/
Date: Wed, 24 Aug 2022 15:52:32
Message-Id: 1660994483.4ae434e1de980cd13e2ed22df4966a9523286cb8.tastytea@gentoo
1 commit: 4ae434e1de980cd13e2ed22df4966a9523286cb8
2 Author: Huang Rui <vowstar <AT> gmail <DOT> com>
3 AuthorDate: Sat Aug 20 11:21:23 2022 +0000
4 Commit: Ronny Gutbrod <gentoo <AT> tastytea <DOT> de>
5 CommitDate: Sat Aug 20 11:21:23 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4ae434e1
7
8 app-editors/imhex: add 1.21.2
9
10 Signed-off-by: Huang Rui <vowstar <AT> gmail.com>
11
12 app-editors/imhex/Manifest | 2 +
13 .../files/imhex-1.21.2-fix-build-with-clang.patch | 26 +++++
14 .../files/imhex-1.21.2-fix-compiler-check.patch | 44 ++++++++
15 ...mhex-1.21.2-fix-copy-elision-not-applying.patch | 25 +++++
16 ...ex-1.21.2-fix-dedup-resources-directories.patch | 64 +++++++++++
17 .../files/imhex-1.21.2-fix-llvmdemangle.patch | 20 ++++
18 .../files/imhex-1.21.2-fix-use-c-23-standard.patch | 26 +++++
19 app-editors/imhex/imhex-1.21.2.ebuild | 124 +++++++++++++++++++++
20 8 files changed, 331 insertions(+)
21
22 diff --git a/app-editors/imhex/Manifest b/app-editors/imhex/Manifest
23 index d07eb6afc..e5404a712 100644
24 --- a/app-editors/imhex/Manifest
25 +++ b/app-editors/imhex/Manifest
26 @@ -1,3 +1,5 @@
27 DIST imhex-1.10.0.tar.gz 8509953 BLAKE2B e258693f44d5524a86c88e29152bfe9777a149236f146a16b88bc7a49d3450f1b46138649a830c7164175afaea3c0d5e76c998e3e65020627b3c978c504431bb SHA512 03d84e30d5ee064ef2c3faf5cb40965f2c94b41e4d8b3e2e3e800f079d0710f0660b4c751dc0c4516b9b19bbf57df44a102ae61fa41d56606ce1f37c9aa8313c
28 DIST imhex-1.10.1.tar.gz 8523483 BLAKE2B 7d73a06cfe83fdd9fa8723f1c64a752212f8e2f0dbf902f2d1da1349e53e580684263b168569f092d32c129eddba40131d8f8bd3148d6d59340dcd67bcdc8b6e SHA512 0542ce5db530989367dfc98932bd09e3020c955e2bd666122644612e1c41e2bc3d6a6374c60e7afbb4bae86c75930dfbc7a48f37a8cd8a0d85a550231f470b91
29 +DIST imhex-1.21.2.tar.gz 23473112 BLAKE2B 5e1dbcf246fc2b2ac57636efee71574eb38ee2d04678a6e09b4d8c2d61da01021bb169fa40a18725d609a3daae1bf9a4ca8aacbb21b6d381c3ff1345d9f788c6 SHA512 e5dd9c5b81f739ee37cc51cf37aa6b866b1af8b28f06e0731612612c5a56d5d68d9d50c20ebb9304a51efb88c07fde72656dcc7d6c249dd827d5d15e44de9698
30 DIST imhex-1.8.1.tar.gz 1758664 BLAKE2B 62c58358810bd4f1192495001d01fc6c6fe8f28a35adc1478c8b2d0dab0fd929c0f46018c9afd51c1094cbae0c04002f4887fb2fb9377b6c645abaee006b9a03 SHA512 c6ec73a282c9eb90b58d164c29abbef3dceba09aa706a8295cecdcb429d5efa4015fac0dd0a3111eae3efe667f5b16f063624bf188a00a400fc06b008e3b51f8
31 +DIST imhex-patterns-1.21.2.tar.gz 4672663 BLAKE2B a0c4a9917ad44a4af0e01e67210bb025a01e6775b327248ba9259d36ea0596b2be74aed758d478b3f5c0d0aea669ed333c8aca2b7e43e275abc833bbdcef2490 SHA512 c5694bd5cc6a609dd8133f0566fbf3bfd4669cf4a20523d10afddbc39e4b7a8d52d8fdecff95883e40b6f06f858e1373c8dbe0713fd7f54380dac5ee3105b9ce
32
33 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-build-with-clang.patch b/app-editors/imhex/files/imhex-1.21.2-fix-build-with-clang.patch
34 new file mode 100644
35 index 000000000..86dc4ffce
36 --- /dev/null
37 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-build-with-clang.patch
38 @@ -0,0 +1,26 @@
39 +From 63d0b8a6e2abe14f4d1947cc9ef9b2905f117801 Mon Sep 17 00:00:00 2001
40 +From: KokaKiwi <kokakiwi+git@××××××××.net>
41 +Date: Sun, 14 Aug 2022 23:59:30 +0200
42 +Subject: [PATCH 2/3] makepkg: Fix build with clang
43 +
44 +clang does not support some C++20 features
45 +---
46 + lib/libimhex/include/hex/data_processor/node.hpp | 2 +-
47 + 1 file changed, 1 insertion(+), 1 deletion(-)
48 +
49 +diff --git a/lib/libimhex/include/hex/data_processor/node.hpp b/lib/libimhex/include/hex/data_processor/node.hpp
50 +index c5fcde80..1a5d9fde 100644
51 +--- a/lib/libimhex/include/hex/data_processor/node.hpp
52 ++++ b/lib/libimhex/include/hex/data_processor/node.hpp
53 +@@ -90,7 +90,7 @@ namespace hex::dp {
54 +
55 + protected:
56 + [[noreturn]] void throwNodeError(const std::string &message) {
57 +- throw NodeError(this, message);
58 ++ throw NodeError { this, message };
59 + }
60 +
61 + std::vector<u8> getBufferOnInput(u32 index);
62 +--
63 +2.37.2
64 +
65
66 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-compiler-check.patch b/app-editors/imhex/files/imhex-1.21.2-fix-compiler-check.patch
67 new file mode 100644
68 index 000000000..57a04849a
69 --- /dev/null
70 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-compiler-check.patch
71 @@ -0,0 +1,44 @@
72 +From c5e69f9670f8b6e5d6f223c312807f2ecd204493 Mon Sep 17 00:00:00 2001
73 +From: KokaKiwi <kokakiwi+git@××××××××.net>
74 +Date: Sun, 14 Aug 2022 23:01:45 +0200
75 +Subject: [PATCH 1/3] makepkg: Fix compiler check
76 +
77 +---
78 + cmake/build_helpers.cmake | 12 ++++++++----
79 + 1 file changed, 8 insertions(+), 4 deletions(-)
80 +
81 +diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake
82 +index e46ffa5e..c7aa712c 100644
83 +--- a/cmake/build_helpers.cmake
84 ++++ b/cmake/build_helpers.cmake
85 +@@ -344,7 +344,7 @@ function(verifyCompiler)
86 + message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
87 + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0.0")
88 + message(FATAL_ERROR "ImHex requires Clang 14.0.0 or newer. Please use the latest Clang version.")
89 +- elseif (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
90 ++ elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
91 + message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
92 + endif()
93 + endfunction()
94 +@@ -384,10 +384,14 @@ function(downloadImHexPatternsFiles dest)
95 + endfunction()
96 +
97 + macro(setupCompilerWarnings target)
98 +- set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Werror")
99 +- set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-restrict -Wno-stringop-overread")
100 ++ set(IMHEX_COMMON_FLAGS "")
101 ++ set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS}")
102 ++
103 ++ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
104 ++ set(IMHEX_C_FLAGS "${IMHEX_C_FLAGS} -Wno-restrict -Wno-stringop-overread")
105 ++ endif()
106 +
107 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_C_FLAGS}")
108 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_C_FLAGS}")
109 + set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${IMHEX_COMMON_FLAGS}")
110 +-endmacro()
111 +\ No newline at end of file
112 ++endmacro()
113 +--
114 +2.37.2
115 +
116
117 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-copy-elision-not-applying.patch b/app-editors/imhex/files/imhex-1.21.2-fix-copy-elision-not-applying.patch
118 new file mode 100644
119 index 000000000..e4606a626
120 --- /dev/null
121 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-copy-elision-not-applying.patch
122 @@ -0,0 +1,25 @@
123 +From 90241ef46d52fb00f3941b526a9b4d20d9170ef0 Mon Sep 17 00:00:00 2001
124 +From: WerWolv <werwolv98@×××××.com>
125 +Date: Thu, 18 Aug 2022 00:23:31 +0200
126 +Subject: [PATCH 1/2] fix: Copy elision not applying
127 +
128 +---
129 + lib/source/pl/core/evaluator.cpp | 2 +-
130 + 1 file changed, 1 insertion(+), 1 deletion(-)
131 +
132 +diff --git a/lib/source/pl/core/evaluator.cpp b/lib/source/pl/core/evaluator.cpp
133 +index 37e7168..0bc9133 100644
134 +--- a/lib/external/pattern_language/lib/source/pl/core/evaluator.cpp
135 ++++ b/lib/external/pattern_language/lib/source/pl/core/evaluator.cpp
136 +@@ -59,7 +59,7 @@ namespace pl::core {
137 +
138 + pattern->setVariableName(name);
139 +
140 +- variables.push_back(std::move(std::unique_ptr<ptrn::Pattern>(pattern)));
141 ++ variables.push_back(std::unique_ptr<ptrn::Pattern>(pattern));
142 + }
143 +
144 + void Evaluator::createVariable(const std::string &name, ast::ASTNode *type, const std::optional<Token::Literal> &value, bool outVariable) {
145 +--
146 +2.37.2
147 +
148
149 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-dedup-resources-directories.patch b/app-editors/imhex/files/imhex-1.21.2-fix-dedup-resources-directories.patch
150 new file mode 100644
151 index 000000000..30fb38235
152 --- /dev/null
153 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-dedup-resources-directories.patch
154 @@ -0,0 +1,64 @@
155 +From 013aed0e9131461157c199edfd9565a82657f293 Mon Sep 17 00:00:00 2001
156 +From: KokaKiwi <kokakiwi+git@××××××××.net>
157 +Date: Sat, 11 Jun 2022 23:08:31 +0200
158 +Subject: [PATCH 3/3] fix: Deduplicate resources directories
159 +
160 +It seems to actually happens despite xdgpp already doing that...
161 +---
162 + lib/libimhex/include/hex/helpers/utils.hpp | 11 +++++++++++
163 + lib/libimhex/source/helpers/fs.cpp | 5 +++++
164 + 2 files changed, 16 insertions(+)
165 +
166 +diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp
167 +index f5666254..5d86768a 100644
168 +--- a/lib/libimhex/include/hex/helpers/utils.hpp
169 ++++ b/lib/libimhex/include/hex/helpers/utils.hpp
170 +@@ -189,6 +189,17 @@ namespace hex {
171 + return result;
172 + }
173 +
174 ++ template<typename T>
175 ++ void deduplicateVector(std::vector<T> &items) {
176 ++ auto end = items.end();
177 ++
178 ++ for (auto it = items.begin(); it != end; ++it) {
179 ++ end = std::remove(it + 1, end, *it);
180 ++ }
181 ++
182 ++ items.erase(end, items.end());
183 ++ }
184 ++
185 + std::vector<std::string> splitString(const std::string &string, const std::string &delimiter);
186 + std::string combineStrings(const std::vector<std::string> &strings, const std::string &delimiter = "");
187 +
188 +diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp
189 +index dc58ced3..5c346ec8 100644
190 +--- a/lib/libimhex/source/helpers/fs.cpp
191 ++++ b/lib/libimhex/source/helpers/fs.cpp
192 +@@ -1,4 +1,5 @@
193 + #include <hex/helpers/fs.hpp>
194 ++#include <hex/helpers/utils.hpp>
195 +
196 + #include <hex/api/content_registry.hpp>
197 + #include <hex/helpers/fs_macos.hpp>
198 +@@ -156,6 +157,8 @@ namespace hex::fs {
199 + auto additionalDirs = ImHexApi::System::getAdditionalFolderPaths();
200 + std::copy(additionalDirs.begin(), additionalDirs.end(), std::back_inserter(paths));
201 +
202 ++ hex::deduplicateVector(paths);
203 ++
204 + return paths;
205 + }
206 +
207 +@@ -175,6 +178,8 @@ namespace hex::fs {
208 + for (auto &path : paths)
209 + path = path / "imhex";
210 +
211 ++ hex::deduplicateVector(paths);
212 ++
213 + return paths;
214 + #endif
215 + }
216 +--
217 +2.37.2
218 +
219
220 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-llvmdemangle.patch b/app-editors/imhex/files/imhex-1.21.2-fix-llvmdemangle.patch
221 new file mode 100644
222 index 000000000..eaa1d9b8e
223 --- /dev/null
224 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-llvmdemangle.patch
225 @@ -0,0 +1,20 @@
226 +Date: Thu, 19 Aug 2022 17:57:02 +0800
227 +Subject: [PATCH 1/1] Remove LLVMDemangle
228 +
229 +---
230 + lib/CMakeLists.txt | 4 ++--
231 + 1 file changed, 2 insertions(+), 2 deletions(-)
232 +
233 +diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt
234 +index 1822efa..1141abf 100644
235 +--- a/plugins/builtin/CMakeLists.txt 2022-08-19 17:02:46.348471178 +0800
236 ++++ b/plugins/builtin/CMakeLists.txt 2022-08-19 17:03:24.748001036 +0800
237 +@@ -69,7 +69,7 @@
238 + target_include_directories(${PROJECT_NAME} PRIVATE include)
239 +
240 + # Add additional libraries here #
241 +-target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle)
242 ++target_link_libraries(${PROJECT_NAME} PRIVATE libimhex)
243 +
244 + # ---- No need to change anything from here downwards unless you know what you're doing ---- #
245 +
246
247 diff --git a/app-editors/imhex/files/imhex-1.21.2-fix-use-c-23-standard.patch b/app-editors/imhex/files/imhex-1.21.2-fix-use-c-23-standard.patch
248 new file mode 100644
249 index 000000000..2b76128bb
250 --- /dev/null
251 +++ b/app-editors/imhex/files/imhex-1.21.2-fix-use-c-23-standard.patch
252 @@ -0,0 +1,26 @@
253 +From 5a5a97b49ff7fb6dc3786917f59322df67e42816 Mon Sep 17 00:00:00 2001
254 +From: KokaKiwi <kokakiwi+git@××××××××.net>
255 +Date: Thu, 18 Aug 2022 00:57:02 +0200
256 +Subject: [PATCH 2/2] Use C++23 standard
257 +
258 +---
259 + lib/CMakeLists.txt | 4 ++--
260 + 1 file changed, 2 insertions(+), 2 deletions(-)
261 +
262 +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
263 +index 5822e0a..11511ba 100644
264 +--- a/lib/external/pattern_language/lib/CMakeLists.txt
265 ++++ b/lib/external/pattern_language/lib/CMakeLists.txt
266 +@@ -1,7 +1,7 @@
267 +-cmake_minimum_required(VERSION 3.16)
268 ++cmake_minimum_required(VERSION 3.20)
269 + project(libpl)
270 +
271 +-set(CMAKE_CXX_STANDARD 20)
272 ++set(CMAKE_CXX_STANDARD 23)
273 +
274 + if (LIBPL_SHARED_LIBRARY)
275 + set(LIBRARY_TYPE SHARED)
276 +--
277 +2.37.2
278 +
279
280 diff --git a/app-editors/imhex/imhex-1.21.2.ebuild b/app-editors/imhex/imhex-1.21.2.ebuild
281 new file mode 100644
282 index 000000000..980671dc4
283 --- /dev/null
284 +++ b/app-editors/imhex/imhex-1.21.2.ebuild
285 @@ -0,0 +1,124 @@
286 +# Copyright 1999-2022 Gentoo Authors
287 +# Distributed under the terms of the GNU General Public License v2
288 +
289 +EAPI=8
290 +
291 +CMAKE_BUILD_TYPE="Release"
292 +CMAKE_MAKEFILE_GENERATOR="emake"
293 +PYTHON_COMPAT=( python3_{8..11} )
294 +
295 +inherit cmake desktop llvm python-r1 xdg
296 +
297 +DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
298 +HOMEPAGE="https://github.com/WerWolv/ImHex"
299 +SRC_URI="
300 + https://github.com/WerWolv/ImHex/releases/download/v${PV}/Full.Sources.tar.gz -> ${P}.tar.gz
301 + https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v${PV}.tar.gz -> ${PN}-patterns-${PV}.tar.gz
302 +"
303 +S="${WORKDIR}/ImHex"
304 +S_PATTERNS="${WORKDIR}/ImHex-Patterns-ImHex-v${PV}"
305 +
306 +LICENSE="GPL-2"
307 +SLOT="0"
308 +KEYWORDS="~amd64"
309 +IUSE="python"
310 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
311 +
312 +DEPEND="
313 + python? ( ${PYTHON_DEPS} )
314 + app-forensics/yara
315 + dev-libs/capstone
316 + >=dev-libs/libfmt-8.0.0
317 + dev-libs/openssl
318 + dev-libs/tre
319 + media-libs/freetype
320 + media-libs/glfw
321 + media-libs/glm
322 + net-libs/libssh2
323 + net-libs/mbedtls
324 + net-misc/curl
325 + sys-apps/dbus
326 + sys-apps/file
327 + sys-apps/xdg-desktop-portal
328 + virtual/libiconv
329 + virtual/libintl
330 +"
331 +RDEPEND="${DEPEND}"
332 +BDEPEND="
333 + app-admin/chrpath
334 + >=dev-cpp/nlohmann_json-3.10.2
335 + gnome-base/librsvg
336 + sys-devel/llvm
337 +"
338 +
339 +PATCHES=(
340 + "${FILESDIR}/${PN}-1.21.2-fix-compiler-check.patch"
341 + "${FILESDIR}/${PN}-1.21.2-fix-build-with-clang.patch"
342 + "${FILESDIR}/${PN}-1.21.2-fix-dedup-resources-directories.patch"
343 + "${FILESDIR}/${PN}-1.21.2-fix-copy-elision-not-applying.patch"
344 + "${FILESDIR}/${PN}-1.21.2-fix-use-c-23-standard.patch"
345 + "${FILESDIR}/${PN}-1.21.2-fix-llvmdemangle.patch"
346 +)
347 +
348 +src_configure() {
349 + use python && python_setup
350 +
351 + local mycmakeargs=(
352 + -D CMAKE_SKIP_RPATH=ON \
353 + -D IMHEX_IGNORE_BAD_CLONE=ON \
354 + -D IMHEX_OFFLINE_BUILD=ON \
355 + -D IMHEX_STRIP_RELEASE=OFF \
356 + -D IMHEX_VERSION="${PV}" \
357 + -D PROJECT_VERSION="${PV}" \
358 + -D USE_SYSTEM_CAPSTONE=ON \
359 + -D USE_SYSTEM_CURL=ON \
360 + -D USE_SYSTEM_FMT=ON \
361 + -D USE_SYSTEM_LLVM=ON \
362 + -D USE_SYSTEM_NLOHMANN_JSON=ON \
363 + -D USE_SYSTEM_YARA=ON
364 + )
365 + if use python; then
366 + mycmakeargs+=( -D PYTHON_VERSION_MAJOR_MINOR="\"${EPYTHON/python/}\"" )
367 + fi
368 + cmake_src_configure
369 +}
370 +
371 +src_install() {
372 + # Can't use cmake_src_install, doing it manual
373 + # Executable
374 + dobin "${BUILD_DIR}/${PN}"
375 + chrpath -d "${ED}/usr/bin/${PN}"
376 + # Shared lib and plugins
377 + dolib.so "${BUILD_DIR}"/lib/lib"${PN}"/lib"${PN}".so*
378 + chrpath -d "${ED}"/usr/bin/lib"${PN}"/lib"${PN}".so*
379 + exeinto "/usr/$(get_libdir)/${PN}/plugins"
380 + for plugin in builtin; do
381 + doexe "${BUILD_DIR}/plugins/${plugin}.hexplug"
382 + chrpath -d "${ED}/usr/$(get_libdir)/${PN}/plugins/${plugin}.hexplug"
383 + done
384 + # Desktop and icon files
385 + domenu "${S}/dist/${PN}.desktop"
386 + newicon -s scalable "${S}/resources/icon.svg" "${PN}.svg"
387 + for i in 16 22 24 32 36 48 64 72 96 128 192 256 512; do
388 + mkdir "${T}/${i}x${i}" || die
389 + rsvg-convert -a -f png -w "${i}" -o "${T}/${i}x${i}/${PN}.png" "${S}/resources/icon.svg" || die
390 + doicon -s "${i}" "${T}/${i}x${i}/${PN}.png"
391 + done
392 +
393 + if use python; then
394 + installation() {
395 + mypythondir="${D}/$(python_get_sitedir)/${PN}"
396 + mkdir -p "${mypythondir}" || die
397 + cp -r "${S}"/resources/lib/python/lib/* "${mypythondir}" || die
398 + python_optimize "${mypythondir}"
399 + }
400 + python_foreach_impl installation
401 + fi
402 +
403 + # Install docs
404 + einstalldocs
405 +
406 + # Install patterns
407 + insinto /usr/share/imhex
408 + doins -r "${S_PATTERNS}"/*
409 +}