git: 7348d8157eb7 - main - editors/imhex: Update to 1.12.1.

From: MANTANI Nobutaka <nobutaka_at_FreeBSD.org>
Date: Mon, 27 Dec 2021 09:16:14 UTC
The branch main has been updated by nobutaka:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7348d8157eb77ad4c49be1611f0d17747d07c534

commit 7348d8157eb77ad4c49be1611f0d17747d07c534
Author:     MANTANI Nobutaka <nobutaka@FreeBSD.org>
AuthorDate: 2021-12-27 09:12:56 +0000
Commit:     MANTANI Nobutaka <nobutaka@FreeBSD.org>
CommitDate: 2021-12-27 09:14:56 +0000

    editors/imhex: Update to 1.12.1.
---
 editors/imhex/Makefile                             |  6 +--
 editors/imhex/distinfo                             | 10 ++---
 .../imhex/files/patch-cmake_build__helpers.cmake   | 44 +++++++++++++---------
 ...iltin_source_content_pl__builtin__functions.cpp | 18 ++++-----
 ...tin_source_content_providers_disk__provider.cpp | 12 ++++++
 .../files/patch-plugins_libimhex_CMakeLists.txt    |  8 ----
 ...plugins_libimhex_include_hex_helpers_socket.hpp | 10 +++++
 ...-plugins_libimhex_include_hex_helpers_utils.hpp | 24 ++++++++++++
 ...hex_include_hex_pattern__language_ast__node.hpp | 20 ----------
 ...atch-plugins_libimhex_source_helpers_crypto.cpp | 26 +++++++++++++
 .../patch-plugins_libimhex_source_helpers_file.cpp |  8 ++--
 ...patch-plugins_libimhex_source_helpers_paths.cpp |  4 +-
 .../files/patch-source_helpers_encoding__file.cpp  | 19 ----------
 .../files/patch-source_views_view__bookmarks.cpp   | 10 -----
 editors/imhex/files/patch-source_window_window.cpp |  4 +-
 editors/imhex/pkg-plist                            |  2 +
 16 files changed, 126 insertions(+), 99 deletions(-)

diff --git a/editors/imhex/Makefile b/editors/imhex/Makefile
index fc324ff4bcad..65d069e4aa7d 100644
--- a/editors/imhex/Makefile
+++ b/editors/imhex/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	imhex
-PORTVERSION=	1.10.1
+PORTVERSION=	1.12.1
 DISTVERSIONPREFIX=	v
 CATEGORIES=	editors
 MASTER_SITES=	https://git.sr.ht/~danyspin97/xdgpp/blob/f01f810714443d0f10c333d4d1d9c0383be41375/:xdg
@@ -41,9 +41,9 @@ GH_PROJECT=	ImHex
 GH_TUPLE=	btzy:nativefiledialog-extended:${GH_TAG_NATIVEFILEDIALOG}:nativefiledialog \
 		fmtlib:fmt:${GH_TAG_FMT}:fmt
 GH_TAG_FMT=	d141cdb
-GH_TAG_NATIVEFILEDIALOG=	800e880
+GH_TAG_NATIVEFILEDIALOG=	322d1bc
 
-CMAKE_ARGS=	-DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_YARA=ON
+CMAKE_ARGS=	-DUSE_SYSTEM_CAPSTONE=ON -DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_YARA=ON -DUSE_SYSTEM_NLOHMANN_JSON=ON
 
 PORTDOCS=	README.md
 
diff --git a/editors/imhex/distinfo b/editors/imhex/distinfo
index 6daae9dc6794..daa2804126b2 100644
--- a/editors/imhex/distinfo
+++ b/editors/imhex/distinfo
@@ -1,9 +1,9 @@
-TIMESTAMP = 1633780013
+TIMESTAMP = 1640528524
 SHA256 (imhex/xdg.hpp) = 2e08ce74adb71ff9b9aa9e1c999733fccd4b00967b9cf0c0e51dbf049392a9ec
 SIZE (imhex/xdg.hpp) = 7674
-SHA256 (imhex/WerWolv-ImHex-v1.10.1_GH0.tar.gz) = 02339938409d304c5e3075de4fb9dac2e047cf02a6aaf3925661d9d4662852c8
-SIZE (imhex/WerWolv-ImHex-v1.10.1_GH0.tar.gz) = 8523483
-SHA256 (imhex/btzy-nativefiledialog-extended-800e880_GH0.tar.gz) = aa2d90478c512e8ff98a2e42adc1a775ec8424b192369cec8d671d055d54d6ea
-SIZE (imhex/btzy-nativefiledialog-extended-800e880_GH0.tar.gz) = 400335
+SHA256 (imhex/WerWolv-ImHex-v1.12.1_GH0.tar.gz) = 139679a7d7b5ad22dc2e54bc238b95f757cd468c69da94d10a43504d589851f1
+SIZE (imhex/WerWolv-ImHex-v1.12.1_GH0.tar.gz) = 8785197
+SHA256 (imhex/btzy-nativefiledialog-extended-322d1bc_GH0.tar.gz) = 1950e8870068b64f862da0dcaebabaeae9a8d0edacae80ec2208a2df9c1e360f
+SIZE (imhex/btzy-nativefiledialog-extended-322d1bc_GH0.tar.gz) = 400379
 SHA256 (imhex/fmtlib-fmt-d141cdb_GH0.tar.gz) = 06dc2fa0236b1b334b93f7e272cbb29554b05a19fd0a9b52039976e8b5dcd725
 SIZE (imhex/fmtlib-fmt-d141cdb_GH0.tar.gz) = 805703
diff --git a/editors/imhex/files/patch-cmake_build__helpers.cmake b/editors/imhex/files/patch-cmake_build__helpers.cmake
index fb929302d50d..20b6eb51d2c6 100644
--- a/editors/imhex/files/patch-cmake_build__helpers.cmake
+++ b/editors/imhex/files/patch-cmake_build__helpers.cmake
@@ -1,20 +1,30 @@
---- cmake/build_helpers.cmake.orig	2021-09-30 10:52:12 UTC
+--- cmake/build_helpers.cmake.orig	2021-12-26 13:48:48 UTC
 +++ cmake/build_helpers.cmake
-@@ -37,7 +37,7 @@ macro(findLibraries)
-     # Find packages
-     find_package(PkgConfig REQUIRED)
- 
--    find_package(mbedTLS 2.26.0 REQUIRED)
-+    find_library(mbedTLS mbedtls REQUIRED)
- 
-     pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
- 
-@@ -48,6 +48,8 @@ macro(findLibraries)
-         message(STATUS ${PYTHON_VERSION_MAJOR_MINOR})
-         message(FATAL_ERROR "No valid version of Python 3 was found.")
+@@ -68,10 +68,10 @@ macro(detectOS)
+         set(MAGIC_INSTALL_LOCATION "magic")
+     elseif(UNIX AND NOT APPLE)
+         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOS_LINUX")
+-        set(CMAKE_INSTALL_BINDIR "usr/bin")
+-        set(CMAKE_INSTALL_LIBDIR "usr/lib")
+-        set(PLUGINS_INSTALL_LOCATION "usr/share/imhex/plugins")
+-        set(MAGIC_INSTALL_LOCATION "usr/share/imhex/magic")
++        set(CMAKE_INSTALL_BINDIR "bin")
++        set(CMAKE_INSTALL_LIBDIR "lib")
++        set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins")
++        set(MAGIC_INSTALL_LOCATION "share/imhex/magic")
+     else()
+         message(FATAL_ERROR "Unknown / unsupported system!")
+     endif()
+@@ -208,10 +208,8 @@ macro(createPackage)
+         endforeach()
+         ]])
+     elseif(UNIX AND NOT APPLE)
+-        configure_file(${CMAKE_SOURCE_DIR}/dist/DEBIAN/control.in ${CMAKE_BINARY_DIR}/DEBIAN/control)
+-        install(FILES ${CMAKE_BINARY_DIR}/DEBIAN/control DESTINATION ${CMAKE_INSTALL_PREFIX}/DEBIAN)
+-        install(FILES ${CMAKE_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/applications)
+-        install(FILES ${CMAKE_SOURCE_DIR}/res/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/pixmaps RENAME imhex.png)
++        install(FILES ${CMAKE_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
++        install(FILES ${CMAKE_SOURCE_DIR}/res/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png)
      endif()
-+
-+    find_package(CURL REQUIRED)
- 
-     string(REPLACE "." ";" PYTHON_VERSION_MAJOR_MINOR ${Python_VERSION})
  
+     if (CREATE_BUNDLE)
diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_pl__builtin__functions.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_pl__builtin__functions.cpp
index 0229cf291d64..f21a728f65a6 100644
--- a/editors/imhex/files/patch-plugins_builtin_source_content_pl__builtin__functions.cpp
+++ b/editors/imhex/files/patch-plugins_builtin_source_content_pl__builtin__functions.cpp
@@ -1,11 +1,11 @@
---- plugins/builtin/source/content/pl_builtin_functions.cpp.orig	2021-09-30 10:52:12 UTC
+--- plugins/builtin/source/content/pl_builtin_functions.cpp.orig	2021-12-16 17:57:41 UTC
 +++ plugins/builtin/source/content/pl_builtin_functions.cpp
-@@ -192,7 +192,7 @@ namespace hex::plugin::builtin {
-                 auto string = Token::literalToString(params[0], false);
-                 auto index = Token::literalToSigned(params[1]);
+@@ -204,7 +204,7 @@ namespace hex::plugin::builtin {
+                 const auto signIndex = index >> (sizeof(index) * 8 - 1);
+                 const auto absIndex = (index ^ signIndex) - signIndex;
+ #else
+-                const auto absIndex = std::abs(index);
++                const auto absIndex = std::abs((long)index);
+ #endif
  
--                if (std::abs(index) >= string.length())
-+                if (std::abs((long)index) >= string.length())
-                     LogConsole::abortEvaluation("character index out of range");
- 
-                 if (index >= 0)
+                 if (absIndex > string.length())
diff --git a/editors/imhex/files/patch-plugins_builtin_source_content_providers_disk__provider.cpp b/editors/imhex/files/patch-plugins_builtin_source_content_providers_disk__provider.cpp
new file mode 100644
index 000000000000..e8c51c383290
--- /dev/null
+++ b/editors/imhex/files/patch-plugins_builtin_source_content_providers_disk__provider.cpp
@@ -0,0 +1,12 @@
+--- plugins/builtin/source/content/providers/disk_provider.cpp.orig	2021-12-16 17:57:41 UTC
++++ plugins/builtin/source/content/providers/disk_provider.cpp
+@@ -11,7 +11,9 @@
+     #include <sys/stat.h>
+     #include <sys/types.h>
+ 
++# if !defined(__FreeBSD__)
+     #define lseek lseek64
++# endif
+ #elif defined (OS_MACOS)
+     #include <fcntl.h>
+     #include <unistd.h>
diff --git a/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt b/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt
deleted file mode 100644
index a8c6cd803f60..000000000000
--- a/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
---- plugins/libimhex/CMakeLists.txt.orig	2021-09-30 10:52:12 UTC
-+++ plugins/libimhex/CMakeLists.txt
-@@ -111,4 +111,4 @@ if (APPLE)
-     target_link_libraries(libimhex PUBLIC ${FOUNDATION})
- endif ()
- 
--target_link_libraries(libimhex PUBLIC imgui nfd magic capstone LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES})
-+target_link_libraries(libimhex PUBLIC imgui nfd magic capstone LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} mbedtls mbedcrypto mbedx509 ${FMT_LIBRARIES} ${Python_LIBRARIES})
diff --git a/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_socket.hpp b/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_socket.hpp
new file mode 100644
index 000000000000..d994b0773c89
--- /dev/null
+++ b/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_socket.hpp
@@ -0,0 +1,10 @@
+--- plugins/libimhex/include/hex/helpers/socket.hpp.orig	2021-12-16 17:57:41 UTC
++++ plugins/libimhex/include/hex/helpers/socket.hpp
+@@ -14,6 +14,7 @@
+ #else
+     #include <unistd.h>
+     #include <sys/socket.h>
++    #include <netinet/in.h>
+     #include <netinet/ip.h>
+     #include <arpa/inet.h>
+ 
diff --git a/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_utils.hpp b/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_utils.hpp
new file mode 100644
index 000000000000..99645f8e87ff
--- /dev/null
+++ b/editors/imhex/files/patch-plugins_libimhex_include_hex_helpers_utils.hpp
@@ -0,0 +1,24 @@
+--- plugins/libimhex/include/hex/helpers/utils.hpp.orig	2021-12-26 14:58:20 UTC
++++ plugins/libimhex/include/hex/helpers/utils.hpp
+@@ -79,6 +79,12 @@ namespace hex {
+     template<size_t Size>
+     using SizeType = typename SizeTypeImpl<Size>::Type;
+ 
++    // Workaround for FreeBSD versions that std::has_single_bit() is not available
++    template <class T>
++    constexpr bool has_single_bit(T x) {
++        return x != 0 && (((x & (x - 1)) == 0));
++    }
++
+     template<typename T>
+     constexpr T changeEndianess(const T &value, std::endian endian) {
+         if (endian == std::endian::native)
+@@ -91,7 +97,7 @@ namespace hex {
+ 
+         SizeType<Size> swapped;
+ 
+-        if constexpr (!std::has_single_bit(Size) || Size > 16)
++        if constexpr (!has_single_bit(Size) || Size > 16)
+                 static_assert(always_false<T>::value, "Invalid type provided!");
+ 
+         switch (Size) {
diff --git a/editors/imhex/files/patch-plugins_libimhex_include_hex_pattern__language_ast__node.hpp b/editors/imhex/files/patch-plugins_libimhex_include_hex_pattern__language_ast__node.hpp
deleted file mode 100644
index 1db19e1e0dd9..000000000000
--- a/editors/imhex/files/patch-plugins_libimhex_include_hex_pattern__language_ast__node.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- plugins/libimhex/include/hex/pattern_language/ast_node.hpp.orig	2021-10-09 12:03:58 UTC
-+++ plugins/libimhex/include/hex/pattern_language/ast_node.hpp
-@@ -9,7 +9,7 @@
- #include <map>
- #include <variant>
- #include <vector>
--#include <ranges>
-+#include <range/v3/view.hpp>
- 
- #include <hex/pattern_language/ast_node_base.hpp>
- 
-@@ -1437,7 +1437,7 @@ namespace hex::pl {
-                         continue;
-                     } else {
-                         bool found = false;
--                        for (const auto &variable : (searchScope | std::views::reverse)) {
-+                        for (const auto &variable : (searchScope | ranges::views::reverse)) {
-                             if (variable->getVariableName() == name) {
-                                 auto newPattern = variable->clone();
-                                 delete currPattern;
diff --git a/editors/imhex/files/patch-plugins_libimhex_source_helpers_crypto.cpp b/editors/imhex/files/patch-plugins_libimhex_source_helpers_crypto.cpp
new file mode 100644
index 000000000000..1e40da6d04ff
--- /dev/null
+++ b/editors/imhex/files/patch-plugins_libimhex_source_helpers_crypto.cpp
@@ -0,0 +1,26 @@
+--- plugins/libimhex/source/helpers/crypto.cpp.orig	2021-12-16 17:57:41 UTC
++++ plugins/libimhex/source/helpers/crypto.cpp
+@@ -15,12 +15,13 @@
+ 
+ #include <array>
+ #include <span>
+-#include <concepts>
+ #include <functional>
+ #include <algorithm>
+ #include <cstddef>
+ #include <cstdint>
+ 
++#include <range/v3/functional/concepts.hpp>
++
+ #if MBEDTLS_VERSION_MAJOR <= 2
+ 
+ #define mbedtls_md5_starts mbedtls_md5_starts_ret
+@@ -44,7 +45,7 @@
+ namespace hex::crypt {
+     using namespace std::placeholders;
+ 
+-    template<std::invocable<unsigned char*, size_t> Func>
++    template<ranges::invocable<unsigned char*, size_t> Func>
+     void processDataByChunks(prv::Provider* data, u64 offset, size_t size, Func func)
+     {
+         std::array<u8, 512> buffer = { 0 };
diff --git a/editors/imhex/files/patch-plugins_libimhex_source_helpers_file.cpp b/editors/imhex/files/patch-plugins_libimhex_source_helpers_file.cpp
index fa341698c61e..70647c3041c4 100644
--- a/editors/imhex/files/patch-plugins_libimhex_source_helpers_file.cpp
+++ b/editors/imhex/files/patch-plugins_libimhex_source_helpers_file.cpp
@@ -1,4 +1,4 @@
---- plugins/libimhex/source/helpers/file.cpp.orig	2021-09-30 10:52:12 UTC
+--- plugins/libimhex/source/helpers/file.cpp.orig	2021-11-28 20:34:17 UTC
 +++ plugins/libimhex/source/helpers/file.cpp
 @@ -5,12 +5,12 @@ namespace hex {
  
@@ -10,7 +10,7 @@
 -            this->m_file = fopen64(path.c_str(), "r+b");
 +            this->m_file = fopen(path.c_str(), "r+b");
  
-         if (mode == File::Mode::Create || this->m_file == nullptr)
+         if (mode == File::Mode::Create || (mode == File::Mode::Write && this->m_file == nullptr))
 -            this->m_file = fopen64(path.c_str(), "w+b");
 +            this->m_file = fopen(path.c_str(), "w+b");
      }
@@ -25,7 +25,7 @@
      }
  
      void File::close() {
-@@ -81,10 +81,10 @@ namespace hex {
+@@ -85,10 +85,10 @@ namespace hex {
      size_t File::getSize() const {
          if (!isValid()) return 0;
  
@@ -40,7 +40,7 @@
  
          return size;
      }
-@@ -92,7 +92,7 @@ namespace hex {
+@@ -96,7 +96,7 @@ namespace hex {
      void File::setSize(u64 size) {
          if (!isValid()) return;
  
diff --git a/editors/imhex/files/patch-plugins_libimhex_source_helpers_paths.cpp b/editors/imhex/files/patch-plugins_libimhex_source_helpers_paths.cpp
index d6a8420fa66c..82ceeee458c6 100644
--- a/editors/imhex/files/patch-plugins_libimhex_source_helpers_paths.cpp
+++ b/editors/imhex/files/patch-plugins_libimhex_source_helpers_paths.cpp
@@ -1,6 +1,6 @@
---- plugins/libimhex/source/helpers/paths.cpp.orig	2021-09-10 13:54:59 UTC
+--- plugins/libimhex/source/helpers/paths.cpp.orig	2021-12-16 17:57:41 UTC
 +++ plugins/libimhex/source/helpers/paths.cpp
-@@ -6,10 +6,15 @@
+@@ -8,10 +8,15 @@
      #include <shlobj.h>
  #elif defined(OS_LINUX)
      #include <xdg.hpp>
diff --git a/editors/imhex/files/patch-source_helpers_encoding__file.cpp b/editors/imhex/files/patch-source_helpers_encoding__file.cpp
deleted file mode 100644
index 1e3371855b28..000000000000
--- a/editors/imhex/files/patch-source_helpers_encoding__file.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
---- source/helpers/encoding_file.cpp.orig	2021-09-12 05:41:36 UTC
-+++ source/helpers/encoding_file.cpp
-@@ -1,6 +1,6 @@
- #include "helpers/encoding_file.hpp"
- 
--#include <ranges>
-+#include <range/v3/view.hpp>
- #include <hex/helpers/utils.hpp>
- 
- #include <fstream>
-@@ -17,7 +17,7 @@ namespace hex {
-     }
- 
-     std::pair<std::string_view, size_t> EncodingFile::getEncodingFor(const std::vector<u8> &buffer) const {
--        for (const auto &[size, mapping] : this->m_mapping | std::views::reverse) {
-+        for (const auto &[size, mapping] : this->m_mapping | ranges::views::reverse) {
-             if (size > buffer.size()) continue;
- 
-             auto key = std::vector<u8>(buffer.begin(), buffer.begin() + size);
diff --git a/editors/imhex/files/patch-source_views_view__bookmarks.cpp b/editors/imhex/files/patch-source_views_view__bookmarks.cpp
deleted file mode 100644
index 1a26325d7042..000000000000
--- a/editors/imhex/files/patch-source_views_view__bookmarks.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- source/views/view_bookmarks.cpp.orig	2021-09-12 06:22:00 UTC
-+++ source/views/view_bookmarks.cpp
-@@ -5,6 +5,7 @@
- 
- #include "helpers/project_file_handler.hpp"
- 
-+#include <array>
- #include <cstring>
- 
- namespace hex {
diff --git a/editors/imhex/files/patch-source_window_window.cpp b/editors/imhex/files/patch-source_window_window.cpp
index 36747d47ac7a..6d2825a995a8 100644
--- a/editors/imhex/files/patch-source_window_window.cpp
+++ b/editors/imhex/files/patch-source_window_window.cpp
@@ -1,6 +1,6 @@
---- source/window/window.cpp.orig	2021-09-30 10:52:12 UTC
+--- source/window/window.cpp.orig	2021-11-28 20:34:17 UTC
 +++ source/window/window.cpp
-@@ -248,7 +248,6 @@ namespace hex {
+@@ -252,7 +252,6 @@ namespace hex {
          std::signal(SIGSEGV, signalHandler);
          std::signal(SIGINT,  signalHandler);
          std::signal(SIGILL,  signalHandler);
diff --git a/editors/imhex/pkg-plist b/editors/imhex/pkg-plist
index e413c9a129fc..15a4f054707b 100644
--- a/editors/imhex/pkg-plist
+++ b/editors/imhex/pkg-plist
@@ -1,3 +1,5 @@
 bin/imhex
 lib/libimhex.so
+share/applications/imhex.desktop
 %%DATADIR%%/plugins/builtin.hexplug
+share/pixmaps/imhex.png