From 0da6d94aa02ca8dd00a04457210fc6a9cfbd263c Mon Sep 17 00:00:00 2001 From: Roger Freitas Pereira Date: Thu, 25 Dec 2025 16:52:09 -0300 Subject: [PATCH] imhex: update to 1.38.1. --- srcpkgs/imhex-plugin-sdk | 1 + srcpkgs/imhex/patches/fix-fmt11.patch | 153 -------------------------- srcpkgs/imhex/template | 33 ++++-- 3 files changed, 25 insertions(+), 162 deletions(-) create mode 120000 srcpkgs/imhex-plugin-sdk delete mode 100644 srcpkgs/imhex/patches/fix-fmt11.patch diff --git a/srcpkgs/imhex-plugin-sdk b/srcpkgs/imhex-plugin-sdk new file mode 120000 index 00000000000000..9f335cad9f82e6 --- /dev/null +++ b/srcpkgs/imhex-plugin-sdk @@ -0,0 +1 @@ +imhex \ No newline at end of file diff --git a/srcpkgs/imhex/patches/fix-fmt11.patch b/srcpkgs/imhex/patches/fix-fmt11.patch deleted file mode 100644 index 452264b3de3819..00000000000000 --- a/srcpkgs/imhex/patches/fix-fmt11.patch +++ /dev/null @@ -1,153 +0,0 @@ -# From: https://data.gpo.zugaina.org/guru/app-editors/imhex/files/imhex-1.37.4-update-libfmt.patch ---- 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/srcpkgs/imhex/template b/srcpkgs/imhex/template index 077242cb1fc3b1..c06b51f1216310 100644 --- a/srcpkgs/imhex/template +++ b/srcpkgs/imhex/template @@ -1,7 +1,7 @@ # Template file for 'imhex' pkgname=imhex -version=1.37.4 -revision=2 +version=1.38.1 +revision=1 build_wrksrc="ImHex" build_style=cmake build_helper=qemu @@ -21,11 +21,13 @@ homepage="https://imhex.werwolv.net/" changelog="https://github.com/WerWolv/ImHex/releases" distfiles="https://github.com/WerWolv/ImHex/releases/download/v${version}/Full.Sources.tar.gz>imhex-${version}.tar.gz https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v${version}.tar.gz>imhex-patterns-${version}.tar.gz" -checksum="711481cc8dfc368d1b88f5d3e8a44d65f23fa43eb9db092599924f3a4cf1aaa2 - 541eddc8cc427d1aeb749bc455911fccc87f64a7784bd4bbc35ecb7b56c03ad5" +checksum="cd3531066a41dde1f0751e5d3146a936897df35ad5ba1fa49a9f3ace88e6901d + 3aae4c0970bc1b85bf4dc566bdf31de33c7dce593375645600549643ce6f9841" patch_args="-Np1 -d $build_wrksrc" python_version=3 +subpackages="imhex-plugin-sdk imhex-patterns" + if [ "$XBPS_TARGET_WORDSIZE" = 32 ]; then broken="uses i128" fi @@ -34,6 +36,10 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then configure_args+=" -DIMHEX_DISABLE_STACKTRACE=ON" fi +post_extract() { + mv ImHex-Patterns-ImHex-v${version} ImHex-Patterns +} + do_check() { cd build ninja ${makejobs} unit_tests @@ -42,16 +48,25 @@ do_check() { } post_install() { - rm ${DESTDIR}/usr/bin/imhex-updater - vmkdir usr/share/imhex - for d in constants encodings includes magic patterns yara; do - vcopy ../ImHex-Patterns-ImHex-v${version}/$d usr/share/imhex + rm -f ${DESTDIR}/usr/bin/imhex-updater + + # Extras from ImHex-Patterns that upstream does not install by default + for d in disassemblers plugins scripts themes tips; do + vcopy "../ImHex-Patterns/${d}" usr/share/imhex done } +imhex-plugin-sdk_package() { + short_desc+=" - plugin SDK" + depends="imhex>=${version}_${revision}" + pkg_install() { + vmove usr/share/imhex/sdk + } +} + imhex-patterns_package() { short_desc+=" - patterns and magic files" - depends="imhex" + depends="imhex>=${version}_${revision}" pkg_install() { vmove usr/share/imhex }