From d8c0bb87efb2be653bc4aa08d90a5fe1ac081ea7 Mon Sep 17 00:00:00 2001 From: Henri Gasc Date: Sat, 10 Jan 2026 16:46:41 +0100 Subject: [PATCH] app-editors/imhex: add 1.38.1, drop 1.37.4-r4 Signed-off-by: Henri Gasc --- app-editors/imhex/Manifest | 4 +- .../imhex/files/cmake_boost_regex.patch | 11 -- app-editors/imhex/files/cmake_mbedtls.patch | 6 +- .../files/imhex-1.37.4-fix-cmake-edlib.patch | 8 - .../files/imhex-1.37.4-update-libfmt.patch | 154 ------------------ ...emove-Werror.patch => remove_Werror.patch} | 24 +-- ...x-1.37.4-r4.ebuild => imhex-1.38.1.ebuild} | 32 ++-- 7 files changed, 35 insertions(+), 204 deletions(-) delete mode 100644 app-editors/imhex/files/cmake_boost_regex.patch delete mode 100644 app-editors/imhex/files/imhex-1.37.4-fix-cmake-edlib.patch delete mode 100644 app-editors/imhex/files/imhex-1.37.4-update-libfmt.patch rename app-editors/imhex/files/{imhex-1.37.4-remove-Werror.patch => remove_Werror.patch} (98%) rename app-editors/imhex/{imhex-1.37.4-r4.ebuild => imhex-1.38.1.ebuild} (82%) diff --git a/app-editors/imhex/Manifest b/app-editors/imhex/Manifest index ace7081a40..16ae18a8ed 100644 --- a/app-editors/imhex/Manifest +++ b/app-editors/imhex/Manifest @@ -1,2 +1,2 @@ -DIST imhex-1.37.4.gh.tar.gz 33717255 BLAKE2B 11f93ca310ddec8ec7d074d5450a02f3147d40aaa92387fbe7fce3be08445e129bbd7336d923e971a2f7f2b6df778a6210de73060cb91abe85161e7fd88588b7 SHA512 07ecc4776f3b82583f1137d1615ab8e73985a550203a127b084c0dfa1e6d7cdae4a558067968c726970c07bcd6fe85fb42302a18ed8b352e789becc5fa113768 -DIST imhex-patterns-1.37.4.gh.tar.gz 13620727 BLAKE2B c8699f9f26faeae784b4c4cb14b682d0f4d0c544ef8c9596b8688c19e6066d7101a7c32979ee807cd4a05225fe2548a8759b1fd0a07c578ea5c0fcdb9f104e69 SHA512 3d2f0dee58ad1e9261be71247dad41ed4437d65dc01fd37ff8b3a517ebf23e5a1123f51ae84f9c3b911d7c0b0c6044ffb580fc86f869f4c1ec1667a989125911 +DIST imhex-1.38.1.gh.tar.gz 40630321 BLAKE2B 481ba12521704923e5ea2588a2d046f7a5bac6a6e539ef14047243e4232452dd3ce2d999aa00593435dccf30726fcb84f91971589c3aa5b0c24e1794c48578fe SHA512 52c3119a4929bcc30ebfa9147c89a251ad5bf6b2bb793e3a494b2f65eb11c1f166d0a0d92ba1c9a24d4000d3264309788f34754a31e01175eda875181fdaf6dd +DIST imhex-patterns-1.38.1.gh.tar.gz 22634584 BLAKE2B a838e6d3add02351a7c2a1f465b305c9430d7acab969f6890d4d65574ea5870383b2a9c9e92fe08fbada79ac858da5b5e34ba81d4ce2c39a843546a5d8242fe6 SHA512 4dd70c332f432e1a187260a7c86e17bfc4ed6ad8906ac44844a3d758e0f0ecf42c68e1740b5679745e34f4c0c4de12c992e63c509220c0f86d9a87f56ad47328 diff --git a/app-editors/imhex/files/cmake_boost_regex.patch b/app-editors/imhex/files/cmake_boost_regex.patch deleted file mode 100644 index f76ea6d144..0000000000 --- a/app-editors/imhex/files/cmake_boost_regex.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/cmake/build_helpers.cmake -+++ b/cmake/build_helpers.cmake -@@ -823,7 +823,7 @@ macro(addBundledLibraries) - endif() - - if (USE_SYSTEM_BOOST) -- find_package(Boost REQUIRED) -+ find_package(Boost REQUIRED COMPONENTS regex) - set(BOOST_LIBRARIES Boost::regex) - else() - add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/boost ${CMAKE_CURRENT_BINARY_DIR}/boost EXCLUDE_FROM_ALL) diff --git a/app-editors/imhex/files/cmake_mbedtls.patch b/app-editors/imhex/files/cmake_mbedtls.patch index 8e3e8b6cbd..7bf8e0550a 100644 --- a/app-editors/imhex/files/cmake_mbedtls.patch +++ b/app-editors/imhex/files/cmake_mbedtls.patch @@ -12,9 +12,9 @@ -FIND_LIBRARY(MBEDTLS_LIBRARY NAMES mbedtls libmbedtls libmbedx509) -FIND_LIBRARY(MBEDX509_LIBRARY NAMES mbedx509 libmbedx509) -FIND_LIBRARY(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto) -+FIND_LIBRARY(MBEDTLS_LIBRARY NAMES mbedtls libmbedtls mbedtls-3 libmbedx509) ++FIND_LIBRARY(MBEDTLS_LIBRARY NAMES mbedtls libmbedtls libmbedx509 mbedtls-3) +FIND_LIBRARY(MBEDX509_LIBRARY NAMES mbedx509 libmbedx509 mbedx509-3) +FIND_LIBRARY(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto mbedcrypto-3) + FIND_LIBRARY(TFPSACRYPTO_LIBRARY NAMES libtfpsacrypto tfpsacrypto) - IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY) - SET(MBEDTLS_FOUND TRUE) + IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND (MBEDCRYPTO_LIBRARY OR TFPSACRYPTO_LIBRARY)) diff --git a/app-editors/imhex/files/imhex-1.37.4-fix-cmake-edlib.patch b/app-editors/imhex/files/imhex-1.37.4-fix-cmake-edlib.patch deleted file mode 100644 index 8e55b904b7..0000000000 --- a/app-editors/imhex/files/imhex-1.37.4-fix-cmake-edlib.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- a/lib/third_party/edlib/CMakeLists.txt -+++ b/lib/third_party/edlib/CMakeLists.txt -@@ -1,4 +1,4 @@ --cmake_minimum_required(VERSION 3.2 FATAL_ERROR) -+cmake_minimum_required(VERSION 3.5 FATAL_ERROR) - project(edlib VERSION 1.2.6) - - option(EDLIB_ENABLE_INSTALL "Generate the install target" ON) diff --git a/app-editors/imhex/files/imhex-1.37.4-update-libfmt.patch b/app-editors/imhex/files/imhex-1.37.4-update-libfmt.patch deleted file mode 100644 index e2a11eb5f2..0000000000 --- a/app-editors/imhex/files/imhex-1.37.4-update-libfmt.patch +++ /dev/null @@ -1,154 +0,0 @@ -# From: Myself and (mostly) WerWolv -# Fixes https://github.com/WerWolv/ImHex/issues/2225 ---- a/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp -+++ b/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp -@@ -11,7 +11,7 @@ - - namespace pl::lib::libstd::time { - -- static u128 packTMValue(std::tm tm) { -+ static u128 packTMValue(const std::tm &tm) { - return - (u128(tm.tm_sec) << 0) | - (u128(tm.tm_min) << 8) | -@@ -57,9 +57,10 @@ namespace pl::lib::libstd::time { - auto time = time_t(params[0].toUnsigned()); - - try { -- auto localTime = fmt::localtime(time); -+ auto localTime = std::localtime(&time); -+ if (localTime == nullptr) return u128(0); - -- return { packTMValue(localTime) }; -+ return { packTMValue(*localTime) }; - } catch (const fmt::format_error&) { - return u128(0); - } -@@ -70,9 +71,10 @@ namespace pl::lib::libstd::time { - auto time = time_t(params[0].toUnsigned()); - - try { -- auto gmTime = fmt::gmtime(time); -+ auto gmTime = std::gmtime(&time); -+ if (gmTime == nullptr) return u128(0); - -- return { packTMValue(gmTime) }; -+ return { packTMValue(*gmTime) }; - } catch (const fmt::format_error&) { - return u128(0); - } ---- a/lib/libimhex/source/helpers/logger.cpp -+++ b/lib/libimhex/source/helpers/logger.cpp -@@ -83,7 +83,8 @@ namespace hex::log { - - for (const auto &path : paths::Logs.all()) { - wolv::io::fs::createDirectories(path); -- s_loggerFile = wolv::io::File(path / hex::format("{0:%Y%m%d_%H%M%S}.log", fmt::localtime(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()))), wolv::io::File::Mode::Create); -+ time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); -+ s_loggerFile = wolv::io::File(path / hex::format("{0:%Y%m%d_%H%M%S}.log", *std::localtime(&time)), wolv::io::File::Mode::Create); - s_loggerFile.disableBuffering(); - - if (s_loggerFile.isValid()) { -@@ -120,7 +121,8 @@ namespace hex::log { - - - void printPrefix(FILE *dest, const fmt::text_style &ts, const std::string &level, const char *projectName) { -- const auto now = fmt::localtime(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())); -+ const auto time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); -+ const auto now = *std::localtime(&time); - - fmt::print(dest, "[{0:%H:%M:%S}] ", now); - ---- a/main/gui/source/init/splash_window.cpp -+++ b/main/gui/source/init/splash_window.cpp -@@ -111,7 +111,7 @@ namespace hex::init { - const auto now = std::chrono::system_clock::now(); - const auto time = std::chrono::system_clock::to_time_t(now); - -- return fmt::localtime(time); -+ return *std::localtime(&time); - }(); - - for (const auto &colorConfig : highlightConfig) { ---- a/plugins/builtin/source/content/data_inspector.cpp -+++ b/plugins/builtin/source/content/data_inspector.cpp -@@ -621,11 +621,16 @@ namespace hex::plugin::builtin { - ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) { - std::ignore = style; - -- auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); -+ time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); - - std::string value; - try { -- value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); -+ auto time = std::localtime(&endianAdjustedTime); -+ if (time == nullptr) { -+ value = "Invalid"; -+ } else { -+ value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); -+ } - } catch (fmt::format_error &) { - value = "Invalid"; - } -@@ -636,11 +641,16 @@ namespace hex::plugin::builtin { - ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(u64), [](auto buffer, auto endian, auto style) { - std::ignore = style; - -- auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); -+ time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); - - std::string value; - try { -- value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); -+ auto time = std::localtime(&endianAdjustedTime); -+ if (time == nullptr) { -+ value = "Invalid"; -+ } else { -+ value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); -+ } - } catch (fmt::format_error &) { - value = "Invalid"; - } -@@ -653,11 +663,16 @@ namespace hex::plugin::builtin { - ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) { - std::ignore = style; - -- auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); -+ time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); - - std::string value; - try { -- value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); -+ auto time = std::localtime(&endianAdjustedTime); -+ if (time == nullptr) { -+ value = "Invalid"; -+ } else { -+ value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); -+ } - } catch (fmt::format_error &e) { - value = "Invalid"; - } ---- a/plugins/builtin/source/content/providers/file_provider.cpp -+++ b/plugins/builtin/source/content/providers/file_provider.cpp -@@ -135,14 +135,14 @@ namespace hex::plugin::builtin { - if (m_fileStats.has_value()) { - std::string creationTime, accessTime, modificationTime; - -- try { creationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_ctime)); } -- catch (const std::exception&) { creationTime = "???"; } -+ try { creationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_ctime)); } -+ catch (const fmt::format_error&) { creationTime = "???"; } - -- try { accessTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_atime)); } -- catch (const std::exception&) { accessTime = "???"; } -+ try { accessTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_atime)); } -+ catch (const fmt::format_error&) { accessTime = "???"; } - -- try { modificationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_mtime)); } -- catch (const std::exception&) { modificationTime = "???"; } -+ try { modificationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_mtime)); } -+ catch (const fmt::format_error&) { modificationTime = "???"; } - - result.emplace_back("hex.builtin.provider.file.creation"_lang, creationTime); - result.emplace_back("hex.builtin.provider.file.access"_lang, accessTime); diff --git a/app-editors/imhex/files/imhex-1.37.4-remove-Werror.patch b/app-editors/imhex/files/remove_Werror.patch similarity index 98% rename from app-editors/imhex/files/imhex-1.37.4-remove-Werror.patch rename to app-editors/imhex/files/remove_Werror.patch index d835473c7d..153875cebf 100644 --- a/app-editors/imhex/files/imhex-1.37.4-remove-Werror.patch +++ b/app-editors/imhex/files/remove_Werror.patch @@ -1,14 +1,3 @@ ---- a/lib/external/disassembler/lib/CMakeLists.txt -+++ b/lib/external/disassembler/lib/CMakeLists.txt -@@ -14,5 +14,5 @@ target_include_directories(libdisassembler PUBLIC include) - target_link_libraries(libdisassembler PRIVATE wolv::types wolv::utils wolv::io wolv::math_eval ${NLOHMANN_JSON_LIBRARIES} ${FMT_LIBRARIES}) - - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") -- target_compile_options(libdisassembler PRIVATE -Wall -Wextra -Wpedantic -Werror) --endif() -\ No newline at end of file -+ target_compile_options(libdisassembler PRIVATE -Wall -Wextra -Wpedantic) -+endif() --- a/lib/external/pattern_language/cli/CMakeLists.txt +++ b/lib/external/pattern_language/cli/CMakeLists.txt @@ -32,7 +32,7 @@ else() @@ -22,7 +11,7 @@ target_link_libraries(plcli PRIVATE ${CLI11_LIBRARIES} ${NLOHMANN_JSON_LIBRARIES} libwolv libpl_includes libpl-gen ${FMT_LIBRARIES}) --- a/lib/external/pattern_language/lib/CMakeLists.txt +++ b/lib/external/pattern_language/lib/CMakeLists.txt -@@ -90,7 +90,7 @@ endif () +@@ -91,7 +91,7 @@ endif () if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_options(libpl PRIVATE /EHsc) elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") @@ -31,3 +20,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(libpl PRIVATE -Wno-stringop-overflow) endif() +--- a/lib/external/disassembler/lib/CMakeLists.txt ++++ b/lib/external/disassembler/lib/CMakeLists.txt +@@ -14,5 +14,5 @@ target_include_directories(libdisassembler PUBLIC include) + target_link_libraries(libdisassembler PRIVATE wolv::types wolv::utils wolv::io wolv::math_eval ${NLOHMANN_JSON_LIBRARIES} ${FMT_LIBRARIES}) + + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +- target_compile_options(libdisassembler PRIVATE -Wall -Wextra -Wpedantic -Werror) +-endif() +\ No newline at end of file ++ target_compile_options(libdisassembler PRIVATE -Wall -Wextra -Wpedantic) ++endif() diff --git a/app-editors/imhex/imhex-1.37.4-r4.ebuild b/app-editors/imhex/imhex-1.38.1.ebuild similarity index 82% rename from app-editors/imhex/imhex-1.37.4-r4.ebuild rename to app-editors/imhex/imhex-1.38.1.ebuild index 084f1adcf8..b4ddab0805 100644 --- a/app-editors/imhex/imhex-1.37.4-r4.ebuild +++ b/app-editors/imhex/imhex-1.38.1.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -LLVM_COMPAT=( {15..20} ) +LLVM_COMPAT=( {15..21} ) inherit cmake llvm-r1 toolchain-funcs flag-o-matic xdg-utils @@ -33,17 +33,11 @@ PATCHES=( "${FILESDIR}/remove_dotnet.patch" # Correct the cmake MbedTLS search call "${FILESDIR}/cmake_mbedtls.patch" - # Set boost components to regex - "${FILESDIR}/cmake_boost_regex.patch" - # Temporary (until the next update) patch - "${FILESDIR}/${P}-update-libfmt.patch" - # Temporary patch (until the next update) - "${FILESDIR}/${P}-fix-cmake-edlib.patch" - # Remove the -Werror flag - "${FILESDIR}/${P}-remove-Werror.patch" + # Remove -Werror + "${FILESDIR}/remove_Werror.patch" ) -DOCS+=( LICENSE PLUGINS.md ) +DOCS+=( LICENSE PLUGINS.md changelog.md ) DEPEND=" app-arch/bzip2 @@ -54,8 +48,9 @@ DEPEND=" dev-libs/boost >=dev-libs/capstone-5.0.3:= =dev-libs/nativefiledialog-extended-1.2.1[desktop-portal?] + dev-libs/md4c >=dev-libs/libfmt-11.0.2:= + >=dev-libs/nativefiledialog-extended-1.2.1[desktop-portal?] media-libs/fontconfig media-libs/freetype >=media-libs/glfw-3.4[X] @@ -98,8 +93,10 @@ src_configure() { sed -ie "s/tests EXCLUDE_FROM_ALL/tests ALL/" "${S}/CMakeLists.txt" fi + # The build hardening can be done by the user (by changing CFLAGS/CXXFLAGS) + # I need to disable system-llvm because on my system the llvm/Demangle/Demangle.h + # header was found by cmake, but not used during compilation, leading to errors (file not found) local mycmakeargs=( - -D IMHEX_PLUGINS_IN_SHARE=OFF \ -D IMHEX_STRIP_RELEASE=OFF \ -D IMHEX_OFFLINE_BUILD=ON \ -D IMHEX_IGNORE_BAD_CLONE=ON \ @@ -113,16 +110,23 @@ src_configure() { -D IMHEX_STRICT_WARNINGS=OFF \ -D IMHEX_STATIC_LINK_PLUGINS=OFF \ -D IMHEX_ENABLE_UNITY_BUILD=OFF \ + -D IMHEX_BUILD_HARDENING=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 LIBPL_ENABLE_TESTS=$(usex test) \ + -D LIBPL_ENABLE_EXAMPLE=ON \ + -D LIBWOLV_ENABLE_TESTS=$(usex test) \ + -D LIBWOLV_ENABLE_EXAMPLES=ON \ -D USE_SYSTEM_BOOST=ON \ -D USE_SYSTEM_CAPSTONE=ON \ -D USE_SYSTEM_FMT=ON \ - -D USE_SYSTEM_LLVM=$(usex system-llvm) \ + -D USE_SYSTEM_LLVM=OFF \ + # -D USE_SYSTEM_LLVM=$(usex system-llvm) \ + -D USE_SYSTEM_MD4C=ON \ -D USE_SYSTEM_NFD=ON \ -D USE_SYSTEM_NLOHMANN_JSON=ON \ -D USE_SYSTEM_YARA=ON \