diff --git a/app-editors/imhex/Manifest b/app-editors/imhex/Manifest new file mode 100644 index 0000000..f213b25 --- /dev/null +++ b/app-editors/imhex/Manifest @@ -0,0 +1,2 @@ +DIST imhex-1.36.2.gh.tar.gz 33211537 BLAKE2B e0c9c8ae8ce003a3115a239d89a660e7dd1c2c709c8aa1007463ddfc7861a5f10394cef1621a09ed9f7bd90fbfa5249a14aed619bd9f50c53500a1a9dc090aa0 SHA512 071bde53b20d68e9300922d507f20ee847bcb7c26e87c4a896126355cc9107dd0fd0226a6b74cc9792c1d1d1f6e75b50fa185f3556e490de96893cdce9e20031 +DIST imhex-patterns-1.36.2.gh.tar.gz 13564417 BLAKE2B 891f8610f643616c5e7625a2a1ca6035038ef67aa6e425fe9fb997a2b18484800bc8caa0ebb52bdeadd61595409b1b768d4bedc22621622c5865143a663507a7 SHA512 d19ca8d9eaa56a6e3e10ffe70aa6df6df49ae008365c182d6c6f7ffda3eae0f41ff40ab6d7670132e753fc7723555064a7cc61122ad20f5b77a35c48119fea26 diff --git a/app-editors/imhex/files/remove_Werror.patch b/app-editors/imhex/files/remove_Werror.patch new file mode 100644 index 0000000..cfd65aa --- /dev/null +++ b/app-editors/imhex/files/remove_Werror.patch @@ -0,0 +1,25 @@ +Remove -Werror where we can not control it using flags +https://bugs.gentoo.org/921663 +Submodule lib/external/pattern_language contains modified content +--- a/lib/external/pattern_language/cli/CMakeLists.txt ++++ b/lib/external/pattern_language/cli/CMakeLists.txt +@@ -29,7 +29,7 @@ else() + find_package(CLI11 CONFIG QUIET) + endif() + +-target_compile_options(plcli PRIVATE -Wall -Wextra -Werror -Wno-unknown-pragmas -Wno-array-bounds) ++target_compile_options(plcli PRIVATE -Wall -Wextra -Wno-unknown-pragmas -Wno-array-bounds) + target_include_directories(plcli PUBLIC include ${CLI11_INCLUDE_DIRS}) + target_link_libraries(plcli PRIVATE ${CLI11_LIBRARIES} ${NLOHMANN_JSON_LIBRARIES} libpl libpl-gen ${FMT_LIBRARIES}) + +--- a/lib/external/pattern_language/lib/CMakeLists.txt ++++ b/lib/external/pattern_language/lib/CMakeLists.txt +@@ -86,7 +86,7 @@ if (LIBPL_ENABLE_PRECOMPILED_HEADERS) + endif () + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +- target_compile_options(libpl PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-unknown-pragmas -Wno-array-bounds) ++ target_compile_options(libpl PRIVATE -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-array-bounds) + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(libpl PRIVATE -Wno-stringop-overflow) + endif() diff --git a/app-editors/imhex/files/remove_dotnet.patch b/app-editors/imhex/files/remove_dotnet.patch new file mode 100644 index 0000000..fab61ad --- /dev/null +++ b/app-editors/imhex/files/remove_dotnet.patch @@ -0,0 +1,20 @@ +Remove dotnet from the application +https://bugs.gentoo.org/926761 +--- a/plugins/script_loader/CMakeLists.txt ++++ b/plugins/script_loader/CMakeLists.txt +@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.16) + + include(ImHexPlugin) + +-find_package(CoreClrEmbed) +-add_library(dotnet INTERFACE) + if (CoreClrEmbed_FOUND) + set(IMHEX_DOTNET_SCRIPT_SUPPORT ON) + +@@ -55,5 +53,4 @@ add_imhex_plugin( + c_api + fonts + ui +- dotnet + ) +\ No newline at end of file diff --git a/app-editors/imhex/imhex-1.36.2-r1.ebuild b/app-editors/imhex/imhex-1.36.2-r1.ebuild new file mode 100644 index 0000000..2fad900 --- /dev/null +++ b/app-editors/imhex/imhex-1.36.2-r1.ebuild @@ -0,0 +1,123 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {15..19} ) + +inherit cmake llvm-r1 toolchain-funcs flag-o-matic xdg-utils + +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}.gh.tar.gz + https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v${PV}.tar.gz -> ${PN}-patterns-${PV}.gh.tar.gz +" +S="${WORKDIR}/ImHex" +S_PATTERNS="${WORKDIR}/ImHex-Patterns-ImHex-v${PV}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="+system-llvm test lto +desktop-portal" +RESTRICT="!test? ( test )" + +PATCHES=( + # If virtual/dotnet-sdk is installed on your system, then cmake + # will use it at some point and try to access internet. + # Because it did not cause any issue, we can disable it + "${FILESDIR}/remove_dotnet.patch" + # Remove the different -Werror flags + "${FILESDIR}/remove_Werror.patch" +) + +DEPEND=" + app-arch/bzip2 + app-arch/xz-utils + app-arch/zstd:= + app-forensics/yara:= + >=dev-cpp/nlohmann_json-3.10.2 + dev-libs/capstone:= + >=dev-libs/nativefiledialog-extended-1.2.1[desktop-portal?] + >=dev-libs/libfmt-8.0.0:= + media-libs/fontconfig + media-libs/freetype + >=media-libs/glfw-3.4[X] + media-libs/glm + media-libs/libglvnd + net-libs/mbedtls:0= + net-misc/curl + sys-apps/file + sys-libs/zlib + virtual/libiconv + virtual/libintl +" +RDEPEND="${DEPEND}" +BDEPEND=" + system-llvm? ( llvm-core/llvm ) + app-admin/chrpath + gnome-base/librsvg +" + +pkg_pretend() { + if tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then + die "${PN} requires GCC 14 or newer" + fi +} + +src_unpack() { + default + + mv "${S_PATTERNS}" "${S}/ImHex-Patterns" +} + +src_configure() { + # Building ImHex with -Werror=strict-aliasing gives a failed build + # for tests/algorithms/source/endian.cpp, and ImHex usually has pretty + # clean build (without warnings), so it should be safe to do + filter-flags -Werror=strict-aliasing + + if use test; then + sed -ie "s/tests EXCLUDE_FROM_ALL/tests ALL/" "${S}/CMakeLists.txt" + fi + + local mycmakeargs=( + -D IMHEX_PLUGINS_IN_SHARE=OFF \ + -D IMHEX_STRIP_RELEASE=OFF \ + -D IMHEX_OFFLINE_BUILD=ON \ + -D IMHEX_IGNORE_BAD_CLONE=ON \ + -D IMHEX_PATTERNS_PULL_MASTER=OFF \ + -D IMHEX_IGNORE_BAD_COMPILER=OFF \ + -D IMHEX_USE_GTK_FILE_PICKER=$(usex !desktop-portal) \ + -D IMHEX_DISABLE_STACKTRACE=OFF \ + -D IMHEX_BUNDLE_DOTNET=OFF \ + -D IMHEX_ENABLE_LTO=$(usex lto) \ + -D IMHEX_USE_DEFAULT_BUILD_SETTINGS=OFF \ + -D IMHEX_STRICT_WARNINGS=OFF \ + -D IMHEX_STATIC_LINK_PLUGINS=OFF \ + -D IMHEX_ENABLE_UNITY_BUILD=OFF \ + -D IMHEX_ENABLE_STD_ASSERTS=OFF \ + -D IMHEX_ENABLE_UNIT_TESTS=$(usex test) \ + -D IMHEX_ENABLE_PRECOMPILED_HEADERS=OFF \ + -D IMHEX_COMPRESS_DEBUG_INFO=OFF \ + -D IMHEX_VERSION="${PV}" \ + -D PROJECT_VERSION="${PV}" \ + -D USE_SYSTEM_CAPSTONE=ON \ + -D USE_SYSTEM_FMT=ON \ + -D USE_SYSTEM_LLVM=$(usex system-llvm) \ + -D USE_SYSTEM_NFD=ON \ + -D USE_SYSTEM_NLOHMANN_JSON=ON \ + -D USE_SYSTEM_YARA=ON \ + ) + + cmake_src_configure +} + +pkg_postinst() { + xdg_desktop_database_update + xdg_mimeinfo_database_update +} +pkg_postrm() { + xdg_desktop_database_update + xdg_mimeinfo_database_update +} diff --git a/app-editors/imhex/metadata.xml b/app-editors/imhex/metadata.xml new file mode 100644 index 0000000..18ad0a7 --- /dev/null +++ b/app-editors/imhex/metadata.xml @@ -0,0 +1,81 @@ + + + + + gasc@eurecom.fr + Gasc Henri + + + https://github.com/WerWolv/ImHex/releases + https://github.com/WerWolv/ImHex/issues + WerWolv/ImHex + + + Use the system LLVM installation + Use sys-apps/xdg-desktop-portal file picker instead of the GTK one + + + Features + + Featureful hex view + Byte patching + Patch management + Copy bytes as feature + Bytes + Hex string + C, C++, C sharp, Rust, Python, Java and JavaScript array + ASCII-Art hex view + HTML self contained div + String and hex search + Colorful highlighting + Goto from start, end and current cursor position + Custom C++-like pattern language for parsing highlighting a file's content + Automatic loading based on MIME type + arrays, pointers, structs, unions, enums, bitfields, using declarations, little and big endian support, conditionals and much more! + Useful error messages, syntax highlighting and error marking + Data importing + Base64 files + IPS and IPS32 patches + Data exporting + IPS and IPS32 patches + Data inspector allowing interpretation of data as many different types (little and big endian) + Huge file support with fast and efficient loading + String search + Copying of strings + Copying of demangled strings + File hashing support + CRC16 and CRC32 with custom initial values and polynomials + MD4, MD5 + SHA-1, SHA-224, SHA-256, SHA-384, SHA-512 + Disassembler supporting many different architectures + ARM32 (ARM, Thumb, Cortex-M, AArch32) + ARM64 + MIPS (MIPS32, MIPS64, MIPS32R6, Micro) + x86 (16-bit, 32-bit, 64-bit) + PowerPC (32-bit, 64-bit) + SPARC + IBM SystemZ + xCORE + M68K + TMS320C64X + M680X + Ethereum + Bookmarks + Region highlighting + Comments + Data Analyzer + File magic-based file parser and MIME type database + Byte distribution graph + Entropy graph + Highest and average entropy + Encrypted / Compressed file detection + Helpful tools + Itanium and MSVC demangler + ASCII table + Regex replacer + Mathematical expression evaluator (Calculator) + Hexadecimal Color picker + Built-in cheat sheet for pattern language and Math evaluator + Doesn't burn out your retinas when used in late-night sessions + +