From f05f493f780f4234a50f4a195f45b353c3ec100e Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 3 May 2022 02:27:08 -0400 Subject: [PATCH] New package: imhex-1.25.0 closes #36954 --- srcpkgs/imhex-patterns | 1 + srcpkgs/imhex/patches/cross.patch | 11 +++ srcpkgs/imhex/patches/musl.patch | 29 +++++++ srcpkgs/imhex/patches/no-update-check.patch | 90 +++++++++++++++++++++ srcpkgs/imhex/template | 50 ++++++++++++ 5 files changed, 181 insertions(+) create mode 120000 srcpkgs/imhex-patterns create mode 100644 srcpkgs/imhex/patches/cross.patch create mode 100644 srcpkgs/imhex/patches/musl.patch create mode 100644 srcpkgs/imhex/patches/no-update-check.patch create mode 100644 srcpkgs/imhex/template diff --git a/srcpkgs/imhex-patterns b/srcpkgs/imhex-patterns new file mode 120000 index 000000000000..9f335cad9f82 --- /dev/null +++ b/srcpkgs/imhex-patterns @@ -0,0 +1 @@ +imhex \ No newline at end of file diff --git a/srcpkgs/imhex/patches/cross.patch b/srcpkgs/imhex/patches/cross.patch new file mode 100644 index 000000000000..ae18dae4430a --- /dev/null +++ b/srcpkgs/imhex/patches/cross.patch @@ -0,0 +1,11 @@ +--- a/ImHex/lib/external/libromfs/lib/CMakeLists.txt ++++ b/ImHex/lib/external/libromfs/lib/CMakeLists.txt +@@ -18,7 +18,7 @@ + + # Make sure libromfs gets rebuilt when any of the resources are changed + add_custom_command(OUTPUT ${ROMFS} +- COMMAND $ ++ COMMAND generator-${LIBROMFS_PROJECT_NAME} + DEPENDS ../generator ${ROMFS_FILES} + ) + diff --git a/srcpkgs/imhex/patches/musl.patch b/srcpkgs/imhex/patches/musl.patch new file mode 100644 index 000000000000..b8e2ba476367 --- /dev/null +++ b/srcpkgs/imhex/patches/musl.patch @@ -0,0 +1,29 @@ +From a966cab1551e0e15e4261c55349b27f84d29cecc Mon Sep 17 00:00:00 2001 +From: WerWolv +Date: Mon, 19 Dec 2022 07:15:18 +0100 +Subject: [PATCH] build: Use correct fcntl.h include on Linux + +--- + plugins/builtin/include/content/providers/file_provider.hpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/ImHex/plugins/builtin/include/content/providers/file_provider.hpp b/ImHex/plugins/builtin/include/content/providers/file_provider.hpp +index 61da65cc8db2..ce8ee7084e0c 100644 +--- a/ImHex/plugins/builtin/include/content/providers/file_provider.hpp ++++ b/ImHex/plugins/builtin/include/content/providers/file_provider.hpp +@@ -9,10 +9,14 @@ + #if defined(OS_WINDOWS) + #define WIN32_LEAN_AND_MEAN + #include ++#elif defined(OS_MACOS) ++ #include ++ #include ++ #include + #else + #include + #include +- #include ++ #include + #endif + + namespace hex::plugin::builtin { diff --git a/srcpkgs/imhex/patches/no-update-check.patch b/srcpkgs/imhex/patches/no-update-check.patch new file mode 100644 index 000000000000..c600bceac07e --- /dev/null +++ b/srcpkgs/imhex/patches/no-update-check.patch @@ -0,0 +1,90 @@ +running the internal update checker is pointless when updates are managed by xbps + +--- a/ImHex/plugins/builtin/source/content/welcome_screen.cpp ++++ b/ImHex/plugins/builtin/source/content/welcome_screen.cpp +@@ -517,20 +517,6 @@ + loadDefaultLayout(); + }); + +- EventManager::subscribe([] { +- // documentation of the value above the setting definition +- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2); +- if (showCheckForUpdates == 2) { +- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 0); +- View::showYesNoQuestionPopup("hex.builtin.welcome.check_for_updates_text"_lang, +- [] { // yes +- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 1); +- ImGui::CloseCurrentPopup(); +- }, [] { // no +- ImGui::CloseCurrentPopup(); +- }); +- } +- }); + + ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1075, [&] { + if (ImGui::BeginMenu("hex.builtin.menu.file.open_recent"_lang, !s_recentProvidersUpdating && !s_recentProviders.empty())) { +--- a/ImHex/plugins/builtin/source/content/settings_entries.cpp ++++ b/ImHex/plugins/builtin/source/content/settings_entries.cpp +@@ -35,21 +35,6 @@ + + /* General */ + +- /* Values of this setting : +- 0 - do not check for updates on startup +- 1 - check for updates on startup +- 2 - default value - ask the user if he wants to check for updates. This value should only be encountered on the first startup. +- */ +- ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2, [](auto name, nlohmann::json &setting) { +- static bool enabled = static_cast(setting) == 1; +- +- if (ImGui::Checkbox(name.data(), &enabled)) { +- setting = static_cast(enabled); +- return true; +- } +- +- return false; +- }); + + ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1, [](auto name, nlohmann::json &setting) { + static bool enabled = static_cast(setting); +--- a/ImHex/main/source/init/tasks.cpp ++++ b/ImHex/main/source/init/tasks.cpp +@@ -24,30 +24,6 @@ + + using namespace std::literals::string_literals; + +- static bool checkForUpdates() { +- // documentation of the value above the setting definition +- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2); +- if (showCheckForUpdates == 1){ +- hex::Net net; +- +- auto releases = net.getJson(GitHubApiURL + "/releases/latest"s, 2000).get(); +- if (releases.code != 200) +- return false; +- +- if (!releases.body.contains("tag_name") || !releases.body["tag_name"].is_string()) +- return false; +- +- auto versionString = std::string(IMHEX_VERSION); +- size_t versionLength = std::min(versionString.find_first_of('-'), versionString.length()); +- auto currVersion = "v" + versionString.substr(0, versionLength); +- auto latestVersion = releases.body["tag_name"].get(); +- +- if (latestVersion != currVersion) +- ImHexApi::System::impl::addInitArgument("update-available", latestVersion.data()); +- +- } +- return true; +- } + + bool createDirectories() { + bool result = true; +@@ -283,7 +283,6 @@ + { "Creating directories", createDirectories, false }, + { "Loading settings", loadSettings, false }, + { "Loading plugins", loadPlugins, false }, +- { "Checking for updates", checkForUpdates, true }, + { "Loading fonts", loadFonts, true }, + }; + } diff --git a/srcpkgs/imhex/template b/srcpkgs/imhex/template new file mode 100644 index 000000000000..912bed5dd60d --- /dev/null +++ b/srcpkgs/imhex/template @@ -0,0 +1,50 @@ +# Template file for 'imhex' +pkgname=imhex +version=1.25.0 +revision=1 +build_wrksrc="ImHex" +build_style=cmake +build_helper=qemu +# XXX: when capstone v5 is out, -DUSE_SYSTEM_CAPSTONE=ON +configure_args="-DIMHEX_OFFLINE_BUILD=ON -DIMHEX_STRIP_RELEASE=OFF + -DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_FMT=ON -DUSE_SYSTEM_LLVM=ON + -DUSE_SYSTEM_YARA=ON -DUSE_SYSTEM_NLOHMANN_JSON=ON" +hostmakedepends="pkg-config clang-tools-extra" +makedepends="libcurl-devel fmt-devel llvm12 jansson-devel yara-devel json-c++ + freetype-devel glfw-devel gtk+3-devel python3-devel file-devel mbedtls-devel + clang-tools-extra" +short_desc="Hex editor for reverse engineers and programmers" +maintainer="classabbyamp " +license="GPL-2.0-or-later" +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="59817990bb1ab2377143480d4a26171ea631bcecdbc6682b2f79bed2a30e7eed + aff9b14a67bea48a06365b1d702af3b6c9cee9161912dd4daadd3f34ae8ee204" + +if [ "$XBPS_TARGET_WORDSIZE" = 32 ]; then + broken="uses i128" +fi + +do_check() { + cd build + ninja ${makejobs} unit_tests + # StoreAPI, TipsAPI, ContentAPI tests are flaky + ctest ${makejobs} -E '^.*API$' +} + +post_install() { + vmkdir usr/share/imhex + for d in constants encodings includes magic patterns yara; do + vcopy ../ImHex-Patterns-ImHex-v${version}/$d usr/share/imhex + done +} + +imhex-patterns_package() { + short_desc+=" - patterns and magic files" + depends="imhex" + pkg_install() { + vmove usr/share/imhex + } +}