Merge branch 'version-1.2.0'
[jackhill/guix/guix.git] / gnu / packages / assembly.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
3 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
8 ;;; Copyright © 2019 Andy Tai <atai@atai.org>
9 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
10 ;;; Copyright © 2020 Christopher Lemmer Webber <cwebber@dustycloud.org>
11 ;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages assembly)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages admin)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages gettext)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages man)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages texinfo)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages sphinx)
51 #:use-module (gnu packages shells)
52 #:use-module (gnu packages xml)
53 #:use-module ((guix utils)
54 #:select (%current-system)))
55
56 (define-public nasm
57 (package
58 (name "nasm")
59 (version "2.14.02")
60 (source (origin
61 (method url-fetch)
62 (uri (string-append "http://www.nasm.us/pub/nasm/releasebuilds/"
63 version "/nasm-" version ".tar.xz"))
64 (sha256
65 (base32
66 "1xg8dfr49py15vbwk1rzcjc3zpqydmr49ahlijm56wlgj8zdwjp2"))))
67 (build-system gnu-build-system)
68 (native-inputs `(("perl" ,perl) ;for doc and test target
69 ("texinfo" ,texinfo)))
70 (arguments
71 `(#:test-target "test"
72 #:phases
73 (modify-phases %standard-phases
74 (add-after 'unpack 'dont-build-ps-pdf-outputs
75 (lambda _
76 (substitute* "doc/Makefile.in"
77 (("html nasmdoc.txt nasmdoc.pdf")
78 "html nasmdoc.txt")
79 (("\\$\\(INSTALL_DATA\\) nasmdoc.pdf")
80 "$(INSTALL_DATA)"))
81 #t))
82 (add-after 'install 'install-info
83 (lambda _
84 (invoke "make" "install_doc"))))))
85 (home-page "https://www.nasm.us/")
86 (synopsis "80x86 and x86-64 assembler")
87 (description
88 "NASM, the Netwide Assembler, is an 80x86 and x86-64 assembler designed
89 for portability and modularity. It supports a range of object file formats,
90 including Linux and *BSD a.out, ELF, COFF, Mach-O, Microsoft 16-bit OBJ,
91 Windows32 and Windows64. It will also output plain binary files. Its syntax
92 is designed to be simple and easy to understand, similar to Intel's but less
93 complex. It supports all currently known x86 architectural extensions, and
94 has strong support for macros.")
95 (license license:bsd-2)))
96
97 (define-public yasm
98 (package
99 (name "yasm")
100 (version "1.3.0")
101 (source (origin
102 (method url-fetch)
103 (uri (string-append
104 "http://www.tortall.net/projects/yasm/releases/yasm-"
105 version ".tar.gz"))
106 (sha256
107 (base32
108 "0gv0slmm0qpq91za3v2v9glff3il594x5xsrbgab7xcmnh0ndkix"))))
109 (build-system gnu-build-system)
110 (arguments
111 '(#:parallel-tests? #f)) ; Some tests fail
112 ; non-deterministically when run in
113 ; parallel
114 (inputs
115 `(("python" ,python-wrapper)
116 ("xmlto" ,xmlto)))
117 (home-page "https://yasm.tortall.net/")
118 (synopsis "Rewrite of the NASM assembler")
119 (description
120 "Yasm is a complete rewrite of the NASM assembler.
121
122 Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM
123 and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit
124 Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source
125 debugging information in STABS, DWARF 2, and CodeView 8 formats.")
126 (license (license:non-copyleft "file://COPYING"
127 "See COPYING in the distribution."))))
128
129 (define-public lightning
130 (package
131 (name "lightning")
132 (version "2.1.3")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "mirror://gnu/lightning/lightning-"
136 version ".tar.gz"))
137 (sha256
138 (base32
139 "1jgxbq2cm51dzi3zhz38mmgwdcgs328mfl8iviw8dxn6dn36p1gd"))))
140 (build-system gnu-build-system)
141 (native-inputs `(("zlib" ,zlib)))
142 (synopsis "Library for generating assembly code at runtime")
143 (description
144 "GNU Lightning is a library that generates assembly language code at
145 run-time. Thus, it is useful in creating Just-In-Time compilers. It
146 abstracts over the target CPU by exposing a standardized RISC instruction set
147 to the clients.")
148 (home-page "https://www.gnu.org/software/lightning/")
149 (license license:gpl3+)))
150
151 (define-public fasm
152 (package
153 (name "fasm")
154 (version "1.73.25")
155 (source
156 (origin
157 (method url-fetch)
158 (uri (string-append "https://flatassembler.net/fasm-"
159 version ".tgz"))
160 (sha256
161 (base32 "0k3h61mfwslyb34kf4dnapfwl8jxlmrp4dv666wc057hkj047knn"))))
162 (build-system gnu-build-system)
163 (arguments
164 `(#:tests? #f ; no tests exist
165 #:strip-binaries? #f ; fasm has no sections
166 #:phases
167 (modify-phases %standard-phases
168 (delete 'configure) ; no "configure" script
169 (replace 'build
170 (lambda _
171 (chdir "source/Linux/")
172 (if (string=? ,(%current-system) "x86_64-linux")
173 ;; Use pre-compiled binaries in top-level directory to build
174 ;; fasm.
175 (invoke "../../fasm.x64" "fasm.asm")
176 (invoke "../../fasm" "fasm.asm"))))
177 (replace 'install
178 (lambda _
179 (let ((out (assoc-ref %outputs "out")))
180 (install-file "fasm" (string-append out "/bin")))
181 #t)))))
182 (supported-systems '("x86_64-linux" "i686-linux"))
183 (synopsis "Assembler for x86 processors")
184 (description
185 "@acronym{FASM, the Flat ASseMbler} is an assembler that supports x86 and
186 IA-64 Intel architectures. It does multiple passes to optimize machine code.
187 It has macro abilities and focuses on operating system portability.")
188 (home-page "https://flatassembler.net/")
189 (license license:bsd-2)))
190
191 (define-public dev86
192 (package
193 (name "dev86")
194 (version "0.16.21")
195 (source (origin
196 (method url-fetch)
197 (uri (string-append "http://v3.sk/~lkundrak/dev86/Dev86src-"
198 version ".tar.gz"))
199 (sha256
200 (base32
201 "154dyr2ph4n0kwi8yx0n78j128kw29rk9r9f7s2gddzrdl712jr3"))))
202 (build-system gnu-build-system)
203 (arguments
204 `(#:parallel-build? #f ; They use submakes wrong
205 #:make-flags (list "CC=gcc"
206 (string-append "PREFIX="
207 (assoc-ref %outputs "out")))
208 #:system "i686-linux" ; Standalone ld86 had problems otherwise
209 #:tests? #f ; No tests exist
210 #:phases
211 (modify-phases %standard-phases
212 (delete 'configure)
213 (add-before 'install 'mkdir
214 (lambda* (#:key outputs #:allow-other-keys)
215 (let ((out (assoc-ref outputs "out")))
216 (mkdir-p (string-append out "/bin"))
217 (mkdir-p (string-append out "/man/man1"))
218 #t))))))
219 (synopsis "Intel 8086 (primarily 16-bit) assembler, C compiler and
220 linker")
221 (description "This package provides a Intel 8086 (primarily 16-bit)
222 assembler, a C compiler and a linker. The assembler uses Intel syntax
223 (also Intel order of operands).")
224 (home-page "https://github.com/jbruchon/dev86")
225 (supported-systems '("i686-linux" "x86_64-linux"))
226 (license license:gpl2+)))
227
228 (define-public libjit
229 (let ((commit "554c9f5c750daa6e13a6a5cd416873c81c7b8226"))
230 (package
231 (name "libjit")
232 (version "0.1.4")
233 (source (origin
234 (method git-fetch)
235 (uri (git-reference
236 (url "https://git.savannah.gnu.org/r/libjit.git")
237 (commit commit)))
238 (file-name (git-file-name name version))
239 (sha256
240 (base32
241 "0p6wklslkkp3s4aisj3w5a53bagqn5fy4m6088ppd4fcfxgqkrcd"))))
242 (build-system gnu-build-system)
243 (native-inputs
244 `(("autoconf" ,autoconf)
245 ("automake" ,automake)
246 ("bison" ,bison)
247 ("flex" ,flex)
248 ("help2man" ,help2man)
249 ("gettext" ,gettext-minimal)
250 ("libtool" ,libtool)
251 ("makeinfo" ,texinfo)
252 ("pkg-config" ,pkg-config)))
253 (home-page "https://www.gnu.org/software/libjit/")
254 (synopsis "Just-In-Time compilation library")
255 (description
256 "GNU libjit is a library that provides generic Just-In-Time compiler
257 functionality independent of any particular bytecode, language, or
258 runtime")
259 (license license:lgpl2.1+))))
260
261 (define-public rgbds
262 (package
263 (name "rgbds")
264 (version "0.4.1")
265 (source (origin
266 (method git-fetch)
267 (uri (git-reference
268 (url "https://github.com/gbdev/rgbds")
269 (commit (string-append "v" version))))
270 (file-name (git-file-name name version))
271 (sha256
272 (base32
273 "05djzl3h18zg2z5p2a881wjbmgikzkhf67cgk00frhw4v05sq0lf"))))
274 (build-system gnu-build-system)
275 (arguments
276 `(#:phases
277 (modify-phases %standard-phases
278 (delete 'configure)
279 (replace 'check
280 (lambda _
281 (with-directory-excursion "test/asm"
282 (invoke "./test.sh"))
283 (with-directory-excursion "test/link"
284 (invoke "./test.sh")))))
285 #:make-flags `("CC=gcc"
286 ,(string-append "PREFIX="
287 (assoc-ref %outputs "out")))))
288 (native-inputs
289 `(("bison" ,bison)
290 ("flex" ,flex)
291 ("pkg-config" ,pkg-config)
292 ("util-linux" ,util-linux)))
293 (inputs
294 `(("libpng" ,libpng)))
295 (home-page "https://github.com/gbdev/rgbds")
296 (synopsis "Rednex Game Boy Development System")
297 (description
298 "RGBDS (Rednex Game Boy Development System) is an assembler/linker
299 package for the Game Boy and Game Boy Color. It consists of:
300 @itemize @bullet
301 @item rgbasm (assembler)
302 @item rgblink (linker)
303 @item rgbfix (checksum/header fixer)
304 @item rgbgfx (PNG-to-Game Boy graphics converter)
305 @end itemize")
306 (license license:expat)))
307
308 (define-public wla-dx
309 (package
310 (name "wla-dx")
311 (version "9.11")
312 (source (origin
313 (method git-fetch)
314 (uri (git-reference
315 (url "https://github.com/vhelin/wla-dx")
316 (commit (string-append "v" version))))
317 (file-name (git-file-name name version))
318 (sha256
319 (base32
320 "0i8pxvyaih79pqnyvqyqd9rwdid91pna76cap0k1n5zhg8xswf2f"))))
321 (build-system cmake-build-system)
322 (native-inputs
323 `(("sphinx" ,python-sphinx))) ; to generate man pages
324 (arguments
325 `(#:tests? #f)) ; no tests
326 (home-page "https://github.com/vhelin/wla-dx")
327 (synopsis "Assemblers for various processors")
328 (description "WLA DX is a set of tools to assemble assembly files to
329 object or library files (@code{wla-ARCH}) and link them together (@code{wlalink}).
330 Supported architectures are:
331
332 @itemize @bullet
333 @item z80
334 @item gb (z80-gb)
335 @item 6502
336 @item 65c02
337 @item 6510
338 @item 65816
339 @item 6800
340 @item 6801
341 @item 6809
342 @item 8008
343 @item 8080
344 @item huc6280
345 @item spc700
346 @end itemize")
347 (license license:gpl2)))
348
349 (define-public xa
350 (package
351 (name "xa")
352 (version "2.3.11")
353 (source (origin
354 (method url-fetch)
355 (uri (string-append "https://www.floodgap.com/retrotech/xa"
356 "/dists/xa-" version ".tar.gz"))
357 (sha256
358 (base32
359 "0b81r7mvzqxgnbbmhixcnrf9nc72v1nqaw19k67221g3k561dwij"))))
360 (build-system gnu-build-system)
361 (arguments
362 `(#:tests? #f ; TODO: custom test harness, not sure how it works
363 #:phases
364 (modify-phases %standard-phases
365 (delete 'configure)) ; no "configure" script
366 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))))
367 (native-inputs `(("perl" ,perl)))
368 (home-page "https://www.floodgap.com/retrotech/xa/")
369 (synopsis "Two-pass portable cross-assembler")
370 (description
371 "xa is a high-speed, two-pass portable cross-assembler.
372 It understands mnemonics and generates code for NMOS 6502s (such
373 as 6502A, 6504, 6507, 6510, 7501, 8500, 8501, 8502 ...),
374 CMOS 6502s (65C02 and Rockwell R65C02) and the 65816.")
375 (license license:gpl2)))
376
377 (define-public armips
378 (package
379 (name "armips")
380 (version "0.11.0")
381 (source
382 (origin
383 (method git-fetch)
384 (uri (git-reference
385 (url "https://github.com/Kingcom/armips")
386 (commit (string-append "v" version))))
387 (file-name (git-file-name name version))
388 (sha256
389 (base32 "1c4dhjkvynqn9xm2vcvwzymk7yg8h25alnawkz4z1dnn1z1k3r9g"))))
390 (build-system cmake-build-system)
391 (arguments
392 `(#:phases
393 (modify-phases %standard-phases
394 (replace 'check
395 (lambda* (#:key inputs #:allow-other-keys)
396 (invoke "./armipstests" "../source/Tests")))
397 (replace 'install
398 (lambda* (#:key outputs #:allow-other-keys)
399 (install-file "armips" (string-append (assoc-ref outputs "out")
400 "/bin"))
401 #t)))))
402 (home-page "https://github.com/Kingcom/armips")
403 (synopsis "Assembler for various ARM and MIPS platforms")
404 (description
405 "armips is an assembler with full support for the MIPS R3000, MIPS R4000,
406 Allegrex and RSP instruction sets, partial support for the EmotionEngine
407 instruction set, as well as complete support for the ARM7 and ARM9 instruction
408 sets, both THUMB and ARM mode.")
409 (license license:expat)))
410
411 (define-public intel-xed
412 (package
413 (name "intel-xed")
414 (version "11.2.0")
415 (source
416 (origin
417 (method git-fetch)
418 (uri (git-reference
419 (url "https://github.com/intelxed/xed")
420 (commit version)))
421 (sha256 (base32 "1jffayski2gpd54vaska7fmiwnnia8v3cka4nfyzjgl8xsky9v2s"))
422 (file-name (git-file-name name version))
423 (patches (search-patches "intel-xed-fix-nondeterminism.patch"))))
424 (build-system gnu-build-system)
425 (native-inputs
426 `(("python-wrapper" ,python-wrapper)
427 ("tcsh" ,tcsh)
428 ;; As of the time of writing this comment, mbuild does not exist in the
429 ;; Python Package Index and seems to only be used by intel-xed, so we
430 ;; opt to include it here instead of packaging separately. Note also
431 ;; that the git repository contains no version tags, so we directly
432 ;; reference the "version" variable from setup.py instead.
433 ("mbuild"
434 ,(let ((name "mbuild")
435 (version "0.2496"))
436 (origin
437 (method git-fetch)
438 (uri (git-reference
439 (url "https://github.com/intelxed/mbuild.git")
440 (commit "5304b94361fccd830c0e2417535a866b79c1c297")))
441 (sha256
442 (base32
443 "0r3avc3035aklqxcnc14rlmmwpj3jp09vbcbwynhvvmcp8srl7dl"))
444 (file-name (git-file-name name version)))))))
445 (outputs '("out" "lib"))
446 (arguments
447 `(#:phases
448 ;; Upstream uses the custom Python build tool `mbuild', so we munge
449 ;; gnu-build-system to fit. The build process for this package is
450 ;; documented at https://intelxed.github.io/build-manual/.
451 (let* ((build-dir "build")
452 (kit-dir "kit"))
453 (modify-phases %standard-phases
454 (delete 'configure)
455 (replace 'build
456 (lambda* (#:key inputs #:allow-other-keys)
457 (let ((mbuild (assoc-ref inputs "mbuild")))
458 (setenv "PYTHONPATH" (string-append
459 (getenv "PYTHONPATH") ":" mbuild))
460 (invoke "./mfile.py"
461 (string-append "--build-dir=" build-dir)
462 (string-append "--install-dir=" kit-dir)
463 "examples"
464 "doc"
465 "install"))))
466 (replace 'check
467 (lambda _
468 ;; Skip broken test group `tests/tests-avx512pf'.
469 (invoke "tests/run-cmd.py"
470 (string-append "--build-dir=" kit-dir "/bin")
471 "--tests" "tests/tests-base"
472 "--tests" "tests/tests-avx512"
473 "--tests" "tests/tests-cet"
474 "--tests" "tests/tests-via"
475 "--tests" "tests/tests-syntax"
476 "--tests" "tests/tests-xop")))
477 (replace 'install
478 (lambda* (#:key outputs #:allow-other-keys)
479 (let* ((out (assoc-ref outputs "out"))
480 (lib (assoc-ref outputs "lib")))
481 (copy-recursively (string-append kit-dir "/bin")
482 (string-append out "/bin"))
483 (copy-recursively (string-append kit-dir "/include")
484 (string-append lib "/include"))
485 (copy-recursively (string-append kit-dir "/lib")
486 (string-append lib "/lib"))
487 #t)))))))
488 (home-page "https://intelxed.github.io/")
489 (synopsis "Encoder and decoder for x86 (IA32 and Intel64) instructions")
490 (description "The Intel X86 Encoder Decoder (XED) is a software library and
491 for encoding and decoding X86 (IA32 and Intel64) instructions. The decoder
492 takes sequences of 1-15 bytes along with machine mode information and produces
493 a data structure describing the opcode, operands, and flags. The encoder takes
494 a similar data structure and produces a sequence of 1 to 15 bytes. Disassembly
495 is essentially a printing pass on the data structure.
496
497 The library and development files are under the @code{lib} output, with a
498 family of command line utility wrappers in the default output. Each of the cli
499 tools is named like @code{xed*}. Documentation for the cli tools is sparse, so
500 this is a case where ``the code is the documentation.''")
501 (license license:asl2.0)))