app-editors/imhex: add 1.21.2

Signed-off-by: Huang Rui <vowstar@gmail.com>
This commit is contained in:
Huang Rui
2022-08-20 19:21:23 +08:00
parent 323d2476f1
commit 4ae434e1de
8 changed files with 331 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
DIST imhex-1.10.0.tar.gz 8509953 BLAKE2B e258693f44d5524a86c88e29152bfe9777a149236f146a16b88bc7a49d3450f1b46138649a830c7164175afaea3c0d5e76c998e3e65020627b3c978c504431bb SHA512 03d84e30d5ee064ef2c3faf5cb40965f2c94b41e4d8b3e2e3e800f079d0710f0660b4c751dc0c4516b9b19bbf57df44a102ae61fa41d56606ce1f37c9aa8313c
DIST imhex-1.10.1.tar.gz 8523483 BLAKE2B 7d73a06cfe83fdd9fa8723f1c64a752212f8e2f0dbf902f2d1da1349e53e580684263b168569f092d32c129eddba40131d8f8bd3148d6d59340dcd67bcdc8b6e SHA512 0542ce5db530989367dfc98932bd09e3020c955e2bd666122644612e1c41e2bc3d6a6374c60e7afbb4bae86c75930dfbc7a48f37a8cd8a0d85a550231f470b91
DIST imhex-1.21.2.tar.gz 23473112 BLAKE2B 5e1dbcf246fc2b2ac57636efee71574eb38ee2d04678a6e09b4d8c2d61da01021bb169fa40a18725d609a3daae1bf9a4ca8aacbb21b6d381c3ff1345d9f788c6 SHA512 e5dd9c5b81f739ee37cc51cf37aa6b866b1af8b28f06e0731612612c5a56d5d68d9d50c20ebb9304a51efb88c07fde72656dcc7d6c249dd827d5d15e44de9698
DIST imhex-1.8.1.tar.gz 1758664 BLAKE2B 62c58358810bd4f1192495001d01fc6c6fe8f28a35adc1478c8b2d0dab0fd929c0f46018c9afd51c1094cbae0c04002f4887fb2fb9377b6c645abaee006b9a03 SHA512 c6ec73a282c9eb90b58d164c29abbef3dceba09aa706a8295cecdcb429d5efa4015fac0dd0a3111eae3efe667f5b16f063624bf188a00a400fc06b008e3b51f8
DIST imhex-patterns-1.21.2.tar.gz 4672663 BLAKE2B a0c4a9917ad44a4af0e01e67210bb025a01e6775b327248ba9259d36ea0596b2be74aed758d478b3f5c0d0aea669ed333c8aca2b7e43e275abc833bbdcef2490 SHA512 c5694bd5cc6a609dd8133f0566fbf3bfd4669cf4a20523d10afddbc39e4b7a8d52d8fdecff95883e40b6f06f858e1373c8dbe0713fd7f54380dac5ee3105b9ce

View File

@@ -0,0 +1,26 @@
From 63d0b8a6e2abe14f4d1947cc9ef9b2905f117801 Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
Date: Sun, 14 Aug 2022 23:59:30 +0200
Subject: [PATCH 2/3] makepkg: Fix build with clang
clang does not support some C++20 features
---
lib/libimhex/include/hex/data_processor/node.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libimhex/include/hex/data_processor/node.hpp b/lib/libimhex/include/hex/data_processor/node.hpp
index c5fcde80..1a5d9fde 100644
--- a/lib/libimhex/include/hex/data_processor/node.hpp
+++ b/lib/libimhex/include/hex/data_processor/node.hpp
@@ -90,7 +90,7 @@ namespace hex::dp {
protected:
[[noreturn]] void throwNodeError(const std::string &message) {
- throw NodeError(this, message);
+ throw NodeError { this, message };
}
std::vector<u8> getBufferOnInput(u32 index);
--
2.37.2

View File

@@ -0,0 +1,44 @@
From c5e69f9670f8b6e5d6f223c312807f2ecd204493 Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
Date: Sun, 14 Aug 2022 23:01:45 +0200
Subject: [PATCH 1/3] makepkg: Fix compiler check
---
cmake/build_helpers.cmake | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake
index e46ffa5e..c7aa712c 100644
--- a/cmake/build_helpers.cmake
+++ b/cmake/build_helpers.cmake
@@ -344,7 +344,7 @@ function(verifyCompiler)
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0.0")
message(FATAL_ERROR "ImHex requires Clang 14.0.0 or newer. Please use the latest Clang version.")
- elseif (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
endif()
endfunction()
@@ -384,10 +384,14 @@ function(downloadImHexPatternsFiles dest)
endfunction()
macro(setupCompilerWarnings target)
- set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Werror")
- set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-restrict -Wno-stringop-overread")
+ set(IMHEX_COMMON_FLAGS "")
+ set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS}")
+
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(IMHEX_C_FLAGS "${IMHEX_C_FLAGS} -Wno-restrict -Wno-stringop-overread")
+ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_C_FLAGS}")
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${IMHEX_COMMON_FLAGS}")
-endmacro()
\ No newline at end of file
+endmacro()
--
2.37.2

View File

@@ -0,0 +1,25 @@
From 90241ef46d52fb00f3941b526a9b4d20d9170ef0 Mon Sep 17 00:00:00 2001
From: WerWolv <werwolv98@gmail.com>
Date: Thu, 18 Aug 2022 00:23:31 +0200
Subject: [PATCH 1/2] fix: Copy elision not applying
---
lib/source/pl/core/evaluator.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/source/pl/core/evaluator.cpp b/lib/source/pl/core/evaluator.cpp
index 37e7168..0bc9133 100644
--- a/lib/external/pattern_language/lib/source/pl/core/evaluator.cpp
+++ b/lib/external/pattern_language/lib/source/pl/core/evaluator.cpp
@@ -59,7 +59,7 @@ namespace pl::core {
pattern->setVariableName(name);
- variables.push_back(std::move(std::unique_ptr<ptrn::Pattern>(pattern)));
+ variables.push_back(std::unique_ptr<ptrn::Pattern>(pattern));
}
void Evaluator::createVariable(const std::string &name, ast::ASTNode *type, const std::optional<Token::Literal> &value, bool outVariable) {
--
2.37.2

View File

@@ -0,0 +1,64 @@
From 013aed0e9131461157c199edfd9565a82657f293 Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
Date: Sat, 11 Jun 2022 23:08:31 +0200
Subject: [PATCH 3/3] fix: Deduplicate resources directories
It seems to actually happens despite xdgpp already doing that...
---
lib/libimhex/include/hex/helpers/utils.hpp | 11 +++++++++++
lib/libimhex/source/helpers/fs.cpp | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp
index f5666254..5d86768a 100644
--- a/lib/libimhex/include/hex/helpers/utils.hpp
+++ b/lib/libimhex/include/hex/helpers/utils.hpp
@@ -189,6 +189,17 @@ namespace hex {
return result;
}
+ template<typename T>
+ void deduplicateVector(std::vector<T> &items) {
+ auto end = items.end();
+
+ for (auto it = items.begin(); it != end; ++it) {
+ end = std::remove(it + 1, end, *it);
+ }
+
+ items.erase(end, items.end());
+ }
+
std::vector<std::string> splitString(const std::string &string, const std::string &delimiter);
std::string combineStrings(const std::vector<std::string> &strings, const std::string &delimiter = "");
diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp
index dc58ced3..5c346ec8 100644
--- a/lib/libimhex/source/helpers/fs.cpp
+++ b/lib/libimhex/source/helpers/fs.cpp
@@ -1,4 +1,5 @@
#include <hex/helpers/fs.hpp>
+#include <hex/helpers/utils.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/helpers/fs_macos.hpp>
@@ -156,6 +157,8 @@ namespace hex::fs {
auto additionalDirs = ImHexApi::System::getAdditionalFolderPaths();
std::copy(additionalDirs.begin(), additionalDirs.end(), std::back_inserter(paths));
+ hex::deduplicateVector(paths);
+
return paths;
}
@@ -175,6 +178,8 @@ namespace hex::fs {
for (auto &path : paths)
path = path / "imhex";
+ hex::deduplicateVector(paths);
+
return paths;
#endif
}
--
2.37.2

View File

@@ -0,0 +1,20 @@
Date: Thu, 19 Aug 2022 17:57:02 +0800
Subject: [PATCH 1/1] Remove LLVMDemangle
---
lib/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt
index 1822efa..1141abf 100644
--- a/plugins/builtin/CMakeLists.txt 2022-08-19 17:02:46.348471178 +0800
+++ b/plugins/builtin/CMakeLists.txt 2022-08-19 17:03:24.748001036 +0800
@@ -69,7 +69,7 @@
target_include_directories(${PROJECT_NAME} PRIVATE include)
# Add additional libraries here #
-target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle)
+target_link_libraries(${PROJECT_NAME} PRIVATE libimhex)
# ---- No need to change anything from here downwards unless you know what you're doing ---- #

View File

@@ -0,0 +1,26 @@
From 5a5a97b49ff7fb6dc3786917f59322df67e42816 Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
Date: Thu, 18 Aug 2022 00:57:02 +0200
Subject: [PATCH 2/2] Use C++23 standard
---
lib/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 5822e0a..11511ba 100644
--- a/lib/external/pattern_language/lib/CMakeLists.txt
+++ b/lib/external/pattern_language/lib/CMakeLists.txt
@@ -1,7 +1,7 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.20)
project(libpl)
-set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD 23)
if (LIBPL_SHARED_LIBRARY)
set(LIBRARY_TYPE SHARED)
--
2.37.2

View File

@@ -0,0 +1,124 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CMAKE_BUILD_TYPE="Release"
CMAKE_MAKEFILE_GENERATOR="emake"
PYTHON_COMPAT=( python3_{8..11} )
inherit cmake desktop llvm python-r1 xdg
DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
HOMEPAGE="https://github.com/WerWolv/ImHex"
SRC_URI="
https://github.com/WerWolv/ImHex/releases/download/v${PV}/Full.Sources.tar.gz -> ${P}.tar.gz
https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v${PV}.tar.gz -> ${PN}-patterns-${PV}.tar.gz
"
S="${WORKDIR}/ImHex"
S_PATTERNS="${WORKDIR}/ImHex-Patterns-ImHex-v${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="python"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND="
python? ( ${PYTHON_DEPS} )
app-forensics/yara
dev-libs/capstone
>=dev-libs/libfmt-8.0.0
dev-libs/openssl
dev-libs/tre
media-libs/freetype
media-libs/glfw
media-libs/glm
net-libs/libssh2
net-libs/mbedtls
net-misc/curl
sys-apps/dbus
sys-apps/file
sys-apps/xdg-desktop-portal
virtual/libiconv
virtual/libintl
"
RDEPEND="${DEPEND}"
BDEPEND="
app-admin/chrpath
>=dev-cpp/nlohmann_json-3.10.2
gnome-base/librsvg
sys-devel/llvm
"
PATCHES=(
"${FILESDIR}/${PN}-1.21.2-fix-compiler-check.patch"
"${FILESDIR}/${PN}-1.21.2-fix-build-with-clang.patch"
"${FILESDIR}/${PN}-1.21.2-fix-dedup-resources-directories.patch"
"${FILESDIR}/${PN}-1.21.2-fix-copy-elision-not-applying.patch"
"${FILESDIR}/${PN}-1.21.2-fix-use-c-23-standard.patch"
"${FILESDIR}/${PN}-1.21.2-fix-llvmdemangle.patch"
)
src_configure() {
use python && python_setup
local mycmakeargs=(
-D CMAKE_SKIP_RPATH=ON \
-D IMHEX_IGNORE_BAD_CLONE=ON \
-D IMHEX_OFFLINE_BUILD=ON \
-D IMHEX_STRIP_RELEASE=OFF \
-D IMHEX_VERSION="${PV}" \
-D PROJECT_VERSION="${PV}" \
-D USE_SYSTEM_CAPSTONE=ON \
-D USE_SYSTEM_CURL=ON \
-D USE_SYSTEM_FMT=ON \
-D USE_SYSTEM_LLVM=ON \
-D USE_SYSTEM_NLOHMANN_JSON=ON \
-D USE_SYSTEM_YARA=ON
)
if use python; then
mycmakeargs+=( -D PYTHON_VERSION_MAJOR_MINOR="\"${EPYTHON/python/}\"" )
fi
cmake_src_configure
}
src_install() {
# Can't use cmake_src_install, doing it manual
# Executable
dobin "${BUILD_DIR}/${PN}"
chrpath -d "${ED}/usr/bin/${PN}"
# Shared lib and plugins
dolib.so "${BUILD_DIR}"/lib/lib"${PN}"/lib"${PN}".so*
chrpath -d "${ED}"/usr/bin/lib"${PN}"/lib"${PN}".so*
exeinto "/usr/$(get_libdir)/${PN}/plugins"
for plugin in builtin; do
doexe "${BUILD_DIR}/plugins/${plugin}.hexplug"
chrpath -d "${ED}/usr/$(get_libdir)/${PN}/plugins/${plugin}.hexplug"
done
# Desktop and icon files
domenu "${S}/dist/${PN}.desktop"
newicon -s scalable "${S}/resources/icon.svg" "${PN}.svg"
for i in 16 22 24 32 36 48 64 72 96 128 192 256 512; do
mkdir "${T}/${i}x${i}" || die
rsvg-convert -a -f png -w "${i}" -o "${T}/${i}x${i}/${PN}.png" "${S}/resources/icon.svg" || die
doicon -s "${i}" "${T}/${i}x${i}/${PN}.png"
done
if use python; then
installation() {
mypythondir="${D}/$(python_get_sitedir)/${PN}"
mkdir -p "${mypythondir}" || die
cp -r "${S}"/resources/lib/python/lib/* "${mypythondir}" || die
python_optimize "${mypythondir}"
}
python_foreach_impl installation
fi
# Install docs
einstalldocs
# Install patterns
insinto /usr/share/imhex
doins -r "${S_PATTERNS}"/*
}