From patchwork Wed Mar 19 17:00:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 40447 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 526EA27BBEA; Wed, 19 Mar 2025 17:04:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8C62127BBE2 for ; Wed, 19 Mar 2025 17:04:55 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuwpy-0006Xw-Jb; Wed, 19 Mar 2025 13:04:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuwpo-0006E1-NX for guix-patches@gnu.org; Wed, 19 Mar 2025 13:04:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuwpo-0007wr-CO for guix-patches@gnu.org; Wed, 19 Mar 2025 13:04:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Vc4vQm9BpiN9AALj9yRjXmTIehVVrlYqj291RrSSvcI=; b=TIB2Zkg2O7SUvOa3AJCUgFdmA+DKlYWkiOVjbFDs91ayow8bcmm9iWVQf4Wj7t4FXl6JnucAihl12oOQpSgx3/mhF/NwaJ9hZojMva3y2C4/GhKA/sqRxSzZ72ZrhDFEo1ca6N2w17XreMCdzAzvsArCz8+0+nBLRXq7S5cOHhnyKJ3kG2rhSi3oRQZQw7D+LmyLkwLNBDAmelknydDD2pfgtqwl0w5+pDWp4NhY0MdP8irlGhjMod1OLxP3rtpeOgJuM+F2/ZsPZp/0DjmUrrVFVNp6mjuYr8KcJtS2uN0D1DwHGsRxAeg/beTHx4BwyrKxu3im+sjPt9bH5Sks6g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tuwpo-0005mE-7Y for guix-patches@gnu.org; Wed, 19 Mar 2025 13:04:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#67755] [PATCH v6 8/8] gnu: Add imhex. Resent-From: "Sergio Pastor =?utf-8?b?UMOpcmV6?= " Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 19 Mar 2025 17:04:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67755 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67755@debbugs.gnu.org Cc: Sergio Pastor =?utf-8?b?UMOpcmV6?= Received: via spool by 67755-submit@debbugs.gnu.org id=B67755.174240381122118 (code B ref 67755); Wed, 19 Mar 2025 17:04:04 +0000 Received: (at 67755) by debbugs.gnu.org; 19 Mar 2025 17:03:31 +0000 Received: from localhost ([127.0.0.1]:52896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuwpG-0005ka-V2 for submit@debbugs.gnu.org; Wed, 19 Mar 2025 13:03:31 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:53287) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tuwoq-0005h1-5T for 67755@debbugs.gnu.org; Wed, 19 Mar 2025 13:03:05 -0400 Received: by mail-wm1-x342.google.com with SMTP id 5b1f17b1804b1-43cf06eabdaso47525925e9.2 for <67755@debbugs.gnu.org>; Wed, 19 Mar 2025 10:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742403778; x=1743008578; darn=debbugs.gnu.org; h=mime-version:cc:to:subject:date:references:in-reply-to:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Vc4vQm9BpiN9AALj9yRjXmTIehVVrlYqj291RrSSvcI=; b=GVDJxYRLeJYjO8PKIIMeXzvubA8hlpvIc5Nn48UI96ry/Feu42+H2GSAa0wxK/Vq5S rIIyyBczXp+v5Q0wE8LttHrxSBNPcAi09pZeMqP2mkroL3sgz9izoev1vpMLkSW8qUJ3 PbcnwgRIW5KTqWzXaeDIQR1/TSTXGiCTyFfpqWnGau/0YsbFFBvn0PIeAStv48CNWIUA 2DKoQOK32cEFkj0GTYlUcVLuyR26HUKoihY4pikpDJDDUziT+XEGzY8bdq4KyJ/3NRJR hNm3l3ThivnVwh7Y4CmffmtDSXL2iEzcyQQN0GgRqs7NnuGG4/L1KM0/Itfm2QSFFwTR sIGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742403778; x=1743008578; h=mime-version:cc:to:subject:date:references:in-reply-to:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Vc4vQm9BpiN9AALj9yRjXmTIehVVrlYqj291RrSSvcI=; b=SvFDccv+JCPi3KmFJhhUoCoaKGVTiMOH+uwwtN7EH5GKpIy9A/bZIhaHyOPDC9R2MT AVhXMBLseTns3EazXS+rizmiAjpDfvrO/xRH9xE+vQjWEBwSH/ZvPclmxl1ii6Y4uABu qut5ZigomyG++cdMDAk5s3qFTHmM/BFZvYfeJ2JPf10tYrN+wSIYbbclVRpzfxkmpUwq q/5PMgemeuDrGWQd8lociU3z4bYdP1VYuaxigMzEoFfNA8WZPu+B1BVBh8sU4LpX6JkX TvgnNutZTKUDC8mITZ1+5QehzxrG1hPWsLtQxmymGAJYUex9WXdU5/gLCPW1qM+25ZJr ckFw== X-Gm-Message-State: AOJu0Yw8MS4MLS5Bj/New46AbeGmL/OtHbYEbPhqfCLTR/N9bj4JQ7R2 nUXVpMLPabOk1jnWrMrnd4FTjdBDj9WplJQtVXKK0zL8R2cnC9Y7x107Jz9EI9k= X-Gm-Gg: ASbGncsbNi9Pm8fRDSvklBc34EvQ4GZuMj3k2nXUSxWTsG1FJVgy98HFQHXiA2oVYBy MFHf1isxwh1CCxRbUIvWaSrVdgM4pxtw0bqOmhJV93lmZyF05mBpCMSmp9kUKfCPsQQXyLuiIgy xiJv95trheu6mKMEz92uvRJRcOY3fAN+DJcZyO6NvEZwOvhSBEDLr5Pj8E5XP/wdMmLAUZgBlxH 6T8fi/r1msBsP4duFuj0s2N2lIAJlG1Mmn5w7GBlad6UZBSDi2SoePG5kiLPz9r8fuXCSPDVcB+ +UngAaAa0kpFACI+MZvww6mANraDKFc3adoydnoO1SDGVOD6vi55PQqUaAynNJV0DVSvsQK6/tc R1w6bq+RmTH4Wng+EJKZmWe1Sclsz7+8= X-Google-Smtp-Source: AGHT+IGA3NjsbcE62GmYUOe5FmPbAAsF5ZwpCmJS6HKhHu70SOoVeV6l0iOybvechoeEr6NJ2gI4pw== X-Received: by 2002:a5d:6dac:0:b0:38d:d666:5457 with SMTP id ffacd0b85a97d-39973afad3cmr3387080f8f.42.1742403777484; Wed, 19 Mar 2025 10:02:57 -0700 (PDT) Received: from lumine.fritz.box (85-127-114-32.dsl.dynamic.surfer.at. [85.127.114.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c7df3419sm21049661f8f.9.2025.03.19.10.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Mar 2025 10:02:57 -0700 (PDT) From: "Sergio Pastor =?utf-8?b?UMOpcmV6?= " X-Google-Original-From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Message-ID: In-Reply-To: References: Date: Wed, 19 Mar 2025 18:00:08 +0100 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/hexedit.scm (make-imhex-patterns, imhex): New variables. Change-Id: I114d3a6c0dae32ea434a77a6bd88b8ff6870b70c --- Changes from v5: * Outlined make-imhex-patterns. * Use keep lists rather than delete lists. * Unbundle jthread. I haven't sorted the inputs yet, but IMHO they should be sorted. Same goes for the #:use-module lines, which would require sorting in an extra commit. Would you like to explain this note? + ;; NOTE: there is an issue with the way the test library is linked + ;; with the output binaries. Tests are intrusive and should not be + ;; shipped with the release, when the issue is fixed we could add a + ;; phase which builds the package with the tests and runs the + ;; testsuite and a second build phase which prepares the output + ;; binary. IMHO it is the build system that should separate test-only code from installed code. gnu/packages/hexedit.scm | 177 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/gnu/packages/hexedit.scm b/gnu/packages/hexedit.scm index ed30e882847..0ab684ded1b 100644 --- a/gnu/packages/hexedit.scm +++ b/gnu/packages/hexedit.scm @@ -28,11 +28,24 @@ (define-module (gnu packages hexedit) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages compression) + #:use-module (gnu packages gl) #:use-module (gnu packages man) #:use-module (gnu packages cpp) #:use-module (gnu packages gcc) + #:use-module (gnu packages tls) + #:use-module (gnu packages curl) + #:use-module (gnu packages llvm) + #:use-module (gnu packages ruby) + #:use-module (gnu packages glib) + #:use-module (gnu packages boost) + #:use-module (gnu packages backup) #:use-module (gnu packages python) + #:use-module (gnu packages libffi) #:use-module (gnu packages ncurses) + #:use-module (gnu packages antivirus) + #:use-module (gnu packages fontutils) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages engineering) #:use-module (gnu packages pretty-print) #:use-module (guix download) #:use-module (guix git-download) @@ -206,6 +219,170 @@ (define-public imhex-pattern-language for specifying patterns in the ImHex Hex Editor.") (license license:lgpl2.1))) +;; imhex-patterns can not currently be built by imhex-pattern-language alone, +;; see above for a rationale. Thus, we only return an origin. +(define (make-imhex-patterns version sha256-hash) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/WerWolv/ImHex-Patterns") + (commit (string-append "ImHex-v" version)))) + (file-name (git-file-name "imhex-patterns" version)) + (sha256 sha256-hash))) + +(define-public imhex + (let* ((version "1.37.4") + (imhex-patterns + (make-imhex-patterns + version + (base32 "0m9g93fzmj2rsgaq25y4mmfigjh1xxyh41zjs6lp5ydsl5hhrn6q")))) + (package + (name "imhex") + (version version) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/WerWolv/ImHex") + (commit (string-append "v" version)) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0l3fpizkz2ykdirbn9alddnnsg75w6kwpp92nvmird13l80z1sdr")) + (modules '((guix build utils) (ice-9 ftw) (ice-9 match))) + (snippet + #~(begin + ;; XXX: imhex-pattern-language is missing the necessary packaging + ;; structure to be linked independently. See the comment on its + ;; package. + (copy-recursively #$imhex-pattern-language + "lib/external/pattern_language") + ;; Drop `imhex-patterns' in the source tree. + (copy-recursively #$imhex-patterns "ImHex-Patterns") + + ;; NOTE: `libwolv' does not have an install target. Until the + ;; maintainers create one, it will remain bundled. + ;; NOTE: `libromfs' it's meant to be bundled and cannot be + ;; compiled independently. Until the maintainers support + ;; building it independently, it will remain bundled. + ;; NOTE: `hashlibplus' has been left as a submodule since it's a + ;; fork which only makes sense within ImHex. + ;; XXX: `imgui' is a fork with several experimental features. + ;; Unbundle once they're upstreamed. + (with-directory-excursion "lib/third_party" + (for-each + (lambda (dir) + (unless (member dir '("." ".." + "HashLibPlus" "libwolv" "libromfs" + "imgui" + ;; Needs source to include miniaudio.h + "miniaudio" + "microtar")) ; XXX: unbundle + (delete-file-recursively dir))) + (scandir ".")) + + ;; Force use of system miniaudio. + (delete-file "miniaudio/include/miniaudio.h") + + (for-each + (match-lambda + ((src . dst) (copy-recursively src dst))) + `((#$(package-source xdgpp) . "xdgpp")))) + + ;; Adjust CMake build scripts accordingly. + (substitute* "cmake/build_helpers.cmake" + (("add_subdirectory\\(\\$\\{THIRD_PARTY_.*\\}/jthread .*\\)") + "") + (("set\\(JTHREAD_LIBRARIES .*\\)") "")) + + ;; Update sources. + (substitute* (append (find-files "lib/libimhex" "\\.[ch](pp)?") + (find-files "main" "\\.[ch](pp)?") + (find-files "plugins" "\\.[ch](pp)?")) + (("#include ") "")) + (substitute* "plugins/ui/source/ui/menu_items.cpp" + (("\\.\\./\\.\\./\\.\\./\\.\\./lib/libimhex/include/") + "")))))) + (build-system cmake-build-system) + (arguments + (list + ;; NOTE: there is an issue with the way the test library is linked + ;; with the output binaries. Tests are intrusive and should not be + ;; shipped with the release, when the issue is fixed we could add a + ;; phase which builds the package with the tests and runs the + ;; testsuite and a second build phase which prepares the output + ;; binary. + #:configure-flags + ''("-DIMHEX_ENABLE_UNIT_TESTS=ON" + "-DIMHEX_OFFLINE_BUILD=ON" + ;; NOTE: required for the `validate-runpath' phase. + ;; If OFF, the pluggings won't be able to find `libimhex.so'. + "-DIMHEX_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH=ON" + + "-DUSE_SYSTEM_NLOHMANN_JSON=ON" + "-DUSE_SYSTEM_CAPSTONE=ON" + "-DUSE_SYSTEM_LUNASVG=ON" + "-DUSE_SYSTEM_CLI11=ON" + "-DUSE_SYSTEM_BOOST=ON" + "-DUSE_SYSTEM_EDLIB=ON" + "-DUSE_SYSTEM_YARA=ON" + "-DUSE_SYSTEM_LLVM=ON" + "-DUSE_SYSTEM_FMT=ON" + "-DUSE_SYSTEM_NFD=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-paths + (lambda _ + (substitute* "main/gui/source/window/linux_window.cpp" + (("dbus-send") + #$(file-append dbus "/bin/dbus-send"))) + (substitute* "cmake/build_helpers.cmake" + (("Boost REQUIRED") + "Boost COMPONENTS regex REQUIRED")))) + (add-before 'check 'build-tests + (lambda _ + (invoke "make" "unit_tests")))))) + (native-inputs + (list cli11 + nlohmann-json + pkg-config + python + python-wrapper + ruby + gcc-14)) + (inputs + (list yara + boost + capstone + curl + edlib + fmt + glfw + libarchive + libffi + llvm-17 + lunasvg + plutovg + mbedtls + mesa + miniaudio + nativefiledialog-extended + xz + fontconfig + lz4 + `(,zstd "lib") + zlib + freetype)) + (home-page "https://imhex.werwolv.net") + (synopsis "Hex Editor to display, decode and analyze binary data") + (description "ImHex is a hex editor with many advanced features that can +often only be found in paid applications. Such features are a completely +custom binary template and pattern language to decode and highlight structures +in the data, a graphical node-based data processor to pre-process values +before they're displayed, a disassembler, diffing support, bookmarks and much +much more.") + (license license:gpl2)))) + (define-public bvi (package (name "bvi")