projects/guix·blob java-team · refs

434 lines · 17.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Kei Kebreau <[email protected]>
3;;; Copyright © 2017 Gábor Boskovits <[email protected]>
4;;; Copyright © 2018, 2020, 2022 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
6;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
7;;; Copyright © 2025 Sergio Pastor Pérez <[email protected]>
8;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages hexedit)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system go)
30 #:use-module (guix download)
31 #:use-module (guix gexp)
32 #:use-module (guix git-download)
33 #:use-module (guix packages)
34 #:use-module (guix utils)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages antivirus)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages backup)
39 #:use-module (gnu packages boost)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages cpp)
42 #:use-module (gnu packages curl)
43 #:use-module (gnu packages engineering)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages gcc)
46 #:use-module (gnu packages gl)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages golang)
49 #:use-module (gnu packages golang-build)
50 #:use-module (gnu packages golang-compression)
51 #:use-module (gnu packages golang-web)
52 #:use-module (gnu packages golang-xyz)
53 #:use-module (gnu packages libffi)
54 #:use-module (gnu packages llvm)
55 #:use-module (gnu packages man)
56 #:use-module (gnu packages ncurses)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages pretty-print)
59 #:use-module (gnu packages python)
60 #:use-module (gnu packages ruby)
61 #:use-module (gnu packages ssh)
62 #:use-module (gnu packages tls))
63
64(define-public hexedit
65 (package
66 (name "hexedit")
67 (version "1.6")
68 (source (origin
69 (method git-fetch)
70 (uri (git-reference
71 (url "https://github.com/pixel/hexedit")
72 (commit version)))
73 (file-name (git-file-name name version))
74 (sha256
75 (base32
76 "00l8vazbjzdg09azp6w3nzq4rl7qyh06i65dh621r6zaprp0z23w"))))
77 (build-system gnu-build-system)
78 (arguments
79 `(#:tests? #f ; no check target
80 #:phases
81 (modify-phases %standard-phases
82 ;; Make F1 open the man page even if man-db is not in the profile.
83 (add-after 'unpack 'patch-man-path
84 (lambda* (#:key inputs outputs #:allow-other-keys)
85 (substitute* "interact.c"
86 (("\"man\"")
87 (string-append "\"" (assoc-ref inputs "man-db") "/bin/man\""))
88 (("\"hexedit\"")
89 (string-append "\"" (assoc-ref outputs "out")
90 "/share/man/man1/hexedit.1.gz\""))))))))
91 (native-inputs
92 (list autoconf automake))
93 (inputs
94 (list man-db ncurses))
95 (synopsis "View and edit files or devices in hexadecimal or ASCII")
96 (description "hexedit shows a file both in ASCII and in hexadecimal. The
97file can be a device as the file is read a piece at a time. You can modify
98the file and search through it.")
99 (home-page "http://rigaux.org/hexedit.html")
100 (license license:gpl2+)))
101
102(define-public fq
103 (package
104 (name "fq")
105 (version "0.17.0")
106 (source
107 (origin
108 (method git-fetch)
109 (uri (git-reference
110 (url "https://github.com/wader/fq")
111 (commit (string-append "v" version))))
112 (file-name (git-file-name name version))
113 (sha256
114 (base32 "1i1xdfmra57vx1a79ww5x1rvxhvvc76xcckmnzm9m1dxxaz98sxc"))))
115 (build-system go-build-system)
116 (arguments
117 (list
118 #:install-source? #f
119 #:import-path "github.com/wader/fq"))
120 (native-inputs
121 (list go-github-com-burntsushi-toml
122 go-github-com-creasty-defaults
123 go-github-com-ergochat-readline
124 go-github-com-golang-snappy
125 go-github-com-gomarkdown-markdown
126 go-github-com-gopacket-gopacket
127 go-github-com-mitchellh-copystructure
128 go-github-com-mitchellh-mapstructure
129 go-github-com-wader-gojq
130 go-golang-org-x-crypto
131 go-golang-org-x-net
132 go-golang-org-x-term
133 go-golang-org-x-text
134 go-gopkg-in-yaml-v3))
135 (home-page "https://github.com/wader/fq")
136 (synopsis "Binary formats tool, like @command{jq} but for binary files")
137 (description
138 "This package provides tool, language and decoders for working with
139binary data, aiming to be @command{jq}, @command{hexdump}, @command{dd} and
140@command{gdb} for files combined into one.")
141 (license license:expat)))
142
143(define-public dhex
144 (package
145 (name "dhex")
146 (version "0.69")
147 (source (origin
148 (method url-fetch)
149 (uri (string-append "https://www.dettus.net/dhex/dhex_"
150 version ".tar.gz"))
151 (sha256
152 (base32
153 "06y4lrp29f2fh303ijk1xhspa1d4x4dm6hnyw3dd8szi3k6hnwsj"))))
154 (build-system gnu-build-system)
155 (arguments
156 (list
157 #:tests? #f ;no tests provided
158 #:make-flags
159 #~(list (string-append "CC=" #$(cc-for-target)))
160 #:phases
161 #~(modify-phases %standard-phases
162 (delete 'configure) ;no configure script
163 (replace 'install ;multiple issues with provided 'make install'
164 (lambda _
165 (let ((bin (string-append #$output "/bin"))
166 (man1 (string-append #$output
167 "/share/man/man1"))
168 (man5 (string-append #$output
169 "/share/man/man5")))
170 (install-file "dhex" bin)
171 (install-file "dhex.1" man1)
172 (install-file "dhexrc.5" man5)
173 (install-file "dhex_markers.5" man5)
174 (install-file "dhex_searchlog.5" man5)))))))
175 (inputs (list ncurses))
176 (home-page "https://www.dettus.net/dhex/")
177 (synopsis "View, edit, and diff files in hexadecimal")
178 (description
179 "Dhex is hex editor which includes a diff mode, which can be used to
180easily and conveniently compare two binary files. It is based on Ncurses
181and is themeable.")
182 (license license:gpl2+)))
183
184;; NOTE: The install target of imhex-pattern-language falls short in a few areas
185;; that make this package difficult to use outside of ImHex. Neither header
186;; files nor package information (using e.g. pkg-config or CMake files) are
187;; currently available.
188(define-public imhex-pattern-language
189 (package
190 (name "imhex-pattern-language")
191 (version "1.37.4")
192 (source
193 (origin
194 (method git-fetch)
195 (uri (git-reference
196 (url "https://github.com/WerWolv/PatternLanguage")
197 (commit (string-append "ImHex-v" version))
198 (recursive? #t)))
199 (file-name (git-file-name name version))
200 (sha256
201 (base32 "13mlbclg2r3axv6vz4dsyry5azc6xavcbdkvwan6zyaq9ngk7r3r"))
202 (modules '((guix build utils) (ice-9 ftw)))
203 (snippet #~(begin
204 ;; NOTE: the `throwing-ptr' hasn't been updated in 6 years
205 ;; and the testsuite expects to use an outdated version of
206 ;; Conan, since this library if not interesting to have it
207 ;; in Guix it will remain bundled.
208 ;; NOTE: `libwolf' does not have an install target. Until
209 ;; the maintainers create one, it will be bundled.
210 (with-directory-excursion "external"
211 (for-each
212 (lambda (dir)
213 (unless (member dir '("." ".." "libwolv" "throwing_ptr"))
214 (delete-file-recursively dir)))
215 (scandir ".")))))))
216 (build-system cmake-build-system)
217 (arguments
218 (list
219 #:configure-flags ''("-DLIBPL_SHARED_LIBRARY=ON"
220 "-DLIBPL_ENABLE_TESTS=ON"
221 "-DUSE_SYSTEM_NLOHMANN_JSON=ON"
222 "-DUSE_SYSTEM_CLI11=ON"
223 "-DUSE_SYSTEM_FMT=ON")
224 #:phases
225 #~(modify-phases %standard-phases
226 (add-after 'unpack 'fix-rel-paths
227 (lambda _
228 (substitute* "tests/include/test_patterns/test_pattern_format.hpp"
229 (("../tests/files/export/")
230 "../source/tests/files/export/"))))
231 (add-after 'build 'build-tests
232 (lambda _
233 (invoke "make" "pattern_language_tests" "plcli")))
234 (add-before 'check 'plcli-integration-tests
235 (lambda _
236 (with-directory-excursion "../source"
237 (invoke "python3" "tests/integration/integration.py"
238 "../build/cli/plcli")))))))
239 (native-inputs (list cli11 fmt-10 nlohmann-json python))
240 (home-page "https://imhex.werwolv.net")
241 (synopsis "Pattern language used by the ImHex Hex Editor")
242 (description "This package provides a C-like domain-specific language used
243for specifying patterns in the ImHex Hex Editor.")
244 (license license:lgpl2.1)))
245
246;; imhex-patterns can not currently be built by imhex-pattern-language alone,
247;; see above for a rationale. Thus, we only return an origin.
248(define (make-imhex-patterns version sha256-hash)
249 (origin
250 (method git-fetch)
251 (uri (git-reference
252 (url "https://github.com/WerWolv/ImHex-Patterns")
253 (commit (string-append "ImHex-v" version))))
254 (file-name (git-file-name "imhex-patterns" version))
255 (sha256 sha256-hash)))
256
257(define-public imhex
258 (let* ((version "1.38.1")
259 (imhex-patterns
260 (make-imhex-patterns
261 version
262 (base32 "14c0w3pj3bcrwd6c5b0lbwdxbw003dcmyj5a4d86hab53v6hg91j"))))
263 (package
264 (name "imhex")
265 (version version)
266 (source
267 (origin
268 (method git-fetch)
269 (uri (git-reference
270 (url "https://github.com/WerWolv/ImHex")
271 (commit (string-append "v" version))
272 (recursive? #t)))
273 (file-name (git-file-name name version))
274 (sha256
275 (base32 "17aj8k2zbj78347rvfdy9gassw7kz9xj5vj30skvs5w4gf4lajln"))
276 (modules '((guix build utils) (ice-9 ftw) (ice-9 match)))
277 (snippet
278 #~(begin
279 ;; XXX: imhex-pattern-language is missing the necessary packaging
280 ;; structure to be linked independently. See the comment on its
281 ;; package.
282 (copy-recursively #$imhex-pattern-language
283 "lib/external/pattern_language")
284 ;; Drop `imhex-patterns' in the source tree.
285 (copy-recursively #$imhex-patterns "ImHex-Patterns")
286
287 ;; NOTE: `libwolv' does not have an install target. Until the
288 ;; maintainers create one, it will remain bundled.
289 ;; NOTE: `libromfs' it's meant to be bundled and cannot be
290 ;; compiled independently. Until the maintainers support
291 ;; building it independently, it will remain bundled.
292 ;; NOTE: `hashlibplus' has been left as a submodule since it's a
293 ;; fork which only makes sense within ImHex.
294 ;; XXX: `imgui' is a fork with several experimental features.
295 ;; Unbundle once they're upstreamed.
296 (with-directory-excursion "lib/third_party"
297 (for-each
298 (lambda (dir)
299 (unless (member dir '("." ".."
300 "HashLibPlus" "libwolv" "libromfs"
301 "imgui"
302 ;; Needs source to include miniaudio.h
303 "miniaudio"
304 "md4c"
305 "microtar")) ; XXX: unbundle
306 (delete-file-recursively dir)))
307 (scandir "."))
308
309 ;; Force use of system miniaudio.
310 (delete-file "miniaudio/include/miniaudio.h")
311
312 (for-each
313 (match-lambda
314 ((src . dst) (copy-recursively src dst)))
315 `((#$(package-source xdgpp) . "xdgpp"))))
316
317 ;; Adjust CMake build scripts accordingly.
318 (substitute* "cmake/build_helpers.cmake"
319 (("add_subdirectory\\(\\$\\{THIRD_PARTY_.*\\}/jthread .*\\)")
320 "")
321 (("set\\(JTHREAD_LIBRARIES .*\\)") ""))
322
323 ;; Update sources.
324 (substitute* (append (find-files "lib/libimhex" "\\.[ch](pp)?")
325 (find-files "main" "\\.[ch](pp)?")
326 (find-files "plugins" "\\.[ch](pp)?"))
327 (("#include <jthread\\.hpp>") ""))
328 (substitute* "plugins/ui/source/ui/menu_items.cpp"
329 (("\\.\\./\\.\\./\\.\\./\\.\\./lib/libimhex/include/")
330 ""))))))
331 (build-system cmake-build-system)
332 (arguments
333 (list
334 ;; NOTE: there is an issue with the way the test library is linked
335 ;; with the output binaries. Tests are intrusive and should not be
336 ;; shipped with the release, when the issue is fixed we could add a
337 ;; phase which builds the package with the tests and runs the
338 ;; testsuite and a second build phase which prepares the output
339 ;; binary.
340 #:configure-flags
341 ''("-DIMHEX_ENABLE_UNIT_TESTS=ON"
342 "-DIMHEX_OFFLINE_BUILD=ON"
343 ;; NOTE: required for the `validate-runpath' phase.
344 ;; If OFF, the pluggings won't be able to find `libimhex.so'.
345 "-DIMHEX_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH=ON"
346
347 "-DUSE_SYSTEM_NLOHMANN_JSON=ON"
348 "-DUSE_SYSTEM_CAPSTONE=ON"
349 "-DUSE_SYSTEM_LUNASVG=ON"
350 "-DUSE_SYSTEM_CLI11=ON"
351 "-DUSE_SYSTEM_BOOST=ON"
352 "-DUSE_SYSTEM_EDLIB=ON"
353 "-DUSE_SYSTEM_YARA=ON"
354 "-DUSE_SYSTEM_LLVM=ON"
355 "-DUSE_SYSTEM_FMT=ON"
356 "-DUSE_SYSTEM_NFD=ON")
357 #:phases
358 #~(modify-phases %standard-phases
359 (add-after 'unpack 'fix-paths
360 (lambda _
361 (substitute* "main/gui/source/window/platform/linux.cpp"
362 (("dbus-send")
363 #$(file-append dbus "/bin/dbus-send")))
364 (substitute* "cmake/build_helpers.cmake"
365 (("Boost REQUIRED")
366 "Boost COMPONENTS regex REQUIRED"))))
367 (add-before 'check 'build-tests
368 (lambda _
369 (invoke "make" "unit_tests"))))))
370 (native-inputs
371 (list cli11
372 nlohmann-json
373 pkg-config
374 python
375 python-wrapper
376 ruby))
377 (inputs
378 (list yara
379 boost
380 capstone
381 curl
382 edlib
383 fmt
384 ;; ImHex supports Wayland on GLFW >= 3.4. More info in:
385 ;; https://github.com/WerWolv/ImHex/issues/1941#issuecomment-2446252019
386 glfw-3.4
387 libarchive
388 libffi
389 libssh2
390 llvm-17
391 lunasvg
392 plutovg
393 mbedtls
394 mesa
395 miniaudio
396 nativefiledialog-extended
397 openssl
398 xz
399 fontconfig
400 lz4
401 `(,zstd "lib")
402 zlib
403 freetype))
404 (home-page "https://imhex.werwolv.net")
405 (synopsis "Hex Editor to display, decode and analyze binary data")
406 (description "ImHex is a hex editor with many advanced features that can
407often only be found in paid applications. Such features are a completely
408custom binary template and pattern language to decode and highlight structures
409in the data, a graphical node-based data processor to pre-process values
410before they're displayed, a disassembler, diffing support, bookmarks and much
411much more.")
412 (license license:gpl2))))
413
414(define-public bvi
415 (package
416 (name "bvi")
417 (version "1.5.0")
418 (source (origin
419 (method url-fetch)
420 (uri (string-append
421 "mirror://sourceforge/bvi/bvi/" version
422 "/bvi-" version ".src.tar.gz"))
423 (sha256
424 (base32
425 "1jvldfxdpgf044hnhjhxi24a9bkbn8adl22icc8rfarv39m72h35"))))
426 (build-system gnu-build-system)
427 (arguments '(#:tests? #f)) ; no check target
428 (inputs
429 (list ncurses))
430 (synopsis "Binary file editor")
431 (description "@command{bvi} is a display-oriented editor for binary files,
432based on the @command{vi} text editor.")
433 (home-page "https://bvi.sourceforge.net/")
434 (license license:gpl3+)))