;;; Copyright © 2025 bdunahu ;;; ;;; SPDX-License-Identifier: GPL-3.0-or-later (define-module (tanelorn packages engineering) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system meson) #:use-module (guix build-system gnu) #:use-module (guix git-download) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (tanelorn packages) #:use-module (gnu packages autotools) #:use-module (gnu packages compression) #:use-module (gnu packages digest) #:use-module (gnu packages engineering) #:use-module (gnu packages javascript) #:use-module (gnu packages libevent) #:use-module (gnu packages multiprecision) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages tls)) (define-public sdb (package (name "sdb") (version "2.2.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/radareorg/sdb.git") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "15pc807s2nmhnr3mspyz9h47rkxkv1r07x959ir17v5b6zs7wxvw")))) (build-system meson-build-system) (arguments (list #:phases #~(modify-phases %standard-phases ;; The meson config offloads the work of running the tests to ;; the Makefile, which 1) assumes the source directory is the parent ;; of the build directory, and 2) the CC environment variable is set. (add-before 'check 'fix-meson-test-declaration (lambda _ (substitute* "../source/meson.build" (("env: \\[(.*)$" _ end) (string-append "env: ['CC=gcc', " end)) (("workdir: join_paths.*$") "workdir: meson.project_source_root(),\n"))))))) (home-page "https://github.com/radareorg/sdb") (synopsis "Simple and fast string based key-value database") (description "SDB is a simple key/value database based on djb's cdb disk storage that supports JSON and array introspection.") (license license:expat))) (define-public radare2-6.0.7 (package (name "radare2") (version "6.0.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/radareorg/radare2") (commit version))) (sha256 (base32 "1nkqa8mkmvmbc3812gf5ayfmzyf0krjgc1695rpkphw3fsl76rgx")) (file-name (git-file-name name version)) (patches (tanelorn-patches "radare2-fix-meson-build-to-use-sys-sdb.patch" "radare2-fix-meson-build-to-use-sys-qjs.patch")))) (build-system meson-build-system) (arguments (list #:configure-flags #~(list "-Duse_sys_capstone=true" "-Duse_sys_magic=true" "-Duse_sys_zip=true" "-Duse_sys_zlib=true" "-Duse_sys_lz4=true" "-Duse_sys_xxhash=true" "-Duse_sys_openssl=true") #:phases #~(modify-phases %standard-phases ;; CHECK LATER: This patches an incorrect relative include. (add-before 'build 'fix-relative-include (lambda* _ (substitute* "../source/libr/arch/p/java/plugin.c" (("include \".." all) (string-append all "/.."))))) ;; These tests require sample binaries from an external repository. (add-before 'check 'skip-tests (lambda* _ (substitute* '("../source/test/unit/test_bin.c" "../source/test/unit/test_dwarf.c" "../source/test/unit/test_dwarf_info.c" "../source/test/unit/test_dwarf_integration.c" "../source/test/unit/test_pdb.c" "../source/test/unit/test_r2pipe.c") (("(^| )main *\\(.*" all) (string-append all " exit (77);\n")))))))) (inputs (list capstone gmp libuv libzip lz4 openssl python quickjs-ng sdb zip zlib)) (native-inputs (list pkg-config)) (propagated-inputs (list xxhash)) (home-page "https://radare.org/") (synopsis "Reverse engineering framework") (description "Radare2 is a complete framework for reverse-engineering, debugging, and analyzing binaries. It is composed of a set of small utilities that can be used together or independently from the command line. Radare2 is built around a scriptable disassembler and hexadecimal editor that support a variety of executable formats for different processors and operating systems, through multiple back ends for local and remote files and disk images. It can also compare (@dfn{diff}) binaries with graphs and extract information like relocation symbols. It is able to deal with malformed binaries, making it suitable for security research and analysis.") (license license:lgpl3))) (define-public python-austin (package (name "python-austin") (version "3.7.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/P403n1x87/austin") (commit (string-append "v" version)) (recursive? #f))) (sha256 (base32 "0074gjkf7agkbgs7k9py2gk7i4ir27bq12mbnslm3fwnxl3vyxk0")) (file-name (git-file-name name version)))) (build-system gnu-build-system) (native-inputs (list autoconf automake)) (home-page "https://github.com/P403n1x87/austin") (synopsis "Python frame stack sampler for CPython") (description "Austin is a Python frame stack sampler for CPython written in pure C. Samples are collected by reading the CPython interpreter virtual memory space to retrieve information about the currently running threads along with the stack of the frames that are being executed. Hence, one can use Austin to easily make powerful statistical profilers that have minimal impact on the target application and that don't require any instrumentation.") (license (list license:gpl3+))))