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, 2020 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>
13 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 cc-for-target)))
62 (uri (string-append "http://www.nasm.us/pub/nasm/releasebuilds/"
63 version "/nasm-" version ".tar.xz"))
66 "1xg8dfr49py15vbwk1rzcjc3zpqydmr49ahlijm56wlgj8zdwjp2"))))
67 (build-system gnu-build-system)
68 (native-inputs `(("perl" ,perl) ;for doc and test target
69 ("texinfo" ,texinfo)))
71 `(#:test-target "test"
73 (modify-phases %standard-phases
74 (add-after 'unpack 'dont-build-ps-pdf-outputs
76 (substitute* "doc/Makefile.in"
77 (("html nasmdoc.txt nasmdoc.pdf")
79 (("\\$\\(INSTALL_DATA\\) nasmdoc.pdf")
82 (add-after 'install 'install-info
84 (invoke "make" "install_doc"))))))
85 (home-page "https://www.nasm.us/")
86 (synopsis "80x86 and x86-64 assembler")
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)))
104 "http://www.tortall.net/projects/yasm/releases/yasm-"
108 "0gv0slmm0qpq91za3v2v9glff3il594x5xsrbgab7xcmnh0ndkix"))))
109 (build-system gnu-build-system)
111 '(#:parallel-tests? #f)) ; Some tests fail
112 ; non-deterministically when run in
115 `(("python" ,python-wrapper)
117 (home-page "https://yasm.tortall.net/")
118 (synopsis "Rewrite of the NASM assembler")
120 "Yasm is a complete rewrite of the NASM assembler.
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."))))
129 (define-public lightning
135 (uri (string-append "mirror://gnu/lightning/lightning-"
139 "1jgxbq2cm51dzi3zhz38mmgwdcgs328mfl8iviw8dxn6dn36p1gd"))))
140 (build-system gnu-build-system)
141 (native-inputs `(("zlib" ,zlib)))
142 (synopsis "Library for generating assembly code at runtime")
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
148 (home-page "https://www.gnu.org/software/lightning/")
149 (license license:gpl3+)))
158 (uri (string-append "https://flatassembler.net/fasm-"
161 (base32 "0k3h61mfwslyb34kf4dnapfwl8jxlmrp4dv666wc057hkj047knn"))))
162 (build-system gnu-build-system)
164 `(#:tests? #f ; no tests exist
165 #:strip-binaries? #f ; fasm has no sections
167 (modify-phases %standard-phases
168 (delete 'configure) ; no "configure" script
171 (chdir "source/Linux/")
172 (if (string=? ,(%current-system) "x86_64-linux")
173 ;; Use pre-compiled binaries in top-level directory to build
175 (invoke "../../fasm.x64" "fasm.asm")
176 (invoke "../../fasm" "fasm.asm"))))
179 (let ((out (assoc-ref %outputs "out")))
180 (install-file "fasm" (string-append out "/bin")))
182 (supported-systems '("x86_64-linux" "i686-linux"))
183 (synopsis "Assembler for x86 processors")
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)))
197 (uri (string-append "http://v3.sk/~lkundrak/dev86/Dev86src-"
201 "154dyr2ph4n0kwi8yx0n78j128kw29rk9r9f7s2gddzrdl712jr3"))))
202 (build-system gnu-build-system)
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
211 (modify-phases %standard-phases
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"))
219 (synopsis "Intel 8086 (primarily 16-bit) assembler, C compiler and
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+)))
228 (define-public libjit
229 (let ((commit "554c9f5c750daa6e13a6a5cd416873c81c7b8226"))
236 (url "https://git.savannah.gnu.org/r/libjit.git")
238 (file-name (git-file-name name version))
241 "0p6wklslkkp3s4aisj3w5a53bagqn5fy4m6088ppd4fcfxgqkrcd"))))
242 (build-system gnu-build-system)
244 `(("autoconf" ,autoconf)
245 ("automake" ,automake)
248 ("help2man" ,help2man)
249 ("gettext" ,gettext-minimal)
251 ("makeinfo" ,texinfo)
252 ("pkg-config" ,pkg-config)))
253 (home-page "https://www.gnu.org/software/libjit/")
254 (synopsis "Just-In-Time compilation library")
256 "GNU libjit is a library that provides generic Just-In-Time compiler
257 functionality independent of any particular bytecode, language, or
259 (license license:lgpl2.1+))))
268 (url "https://github.com/gbdev/rgbds")
269 (commit (string-append "v" version))))
270 (file-name (git-file-name name version))
273 "05djzl3h18zg2z5p2a881wjbmgikzkhf67cgk00frhw4v05sq0lf"))))
274 (build-system gnu-build-system)
277 (modify-phases %standard-phases
279 (add-after 'unpack 'patch-pkg-config
281 (substitute* "Makefile"
283 (or (which "pkg-config")
284 (string-append ,(%current-target-system)
289 (with-directory-excursion "test/asm"
290 (invoke "./test.sh"))
291 (with-directory-excursion "test/link"
292 (invoke "./test.sh")))))
293 #:make-flags `(,(string-append "CC=" ,(cc-for-target))
294 ,(string-append "PREFIX="
295 (assoc-ref %outputs "out")))))
299 ("pkg-config" ,pkg-config)
300 ("util-linux" ,util-linux)))
302 `(("libpng" ,libpng)))
303 (home-page "https://github.com/gbdev/rgbds")
304 (synopsis "Rednex Game Boy Development System")
306 "RGBDS (Rednex Game Boy Development System) is an assembler/linker
307 package for the Game Boy and Game Boy Color. It consists of:
309 @item rgbasm (assembler)
310 @item rgblink (linker)
311 @item rgbfix (checksum/header fixer)
312 @item rgbgfx (PNG-to-Game Boy graphics converter)
314 (license license:expat)))
316 (define-public wla-dx
323 (url "https://github.com/vhelin/wla-dx")
324 (commit (string-append "v" version))))
325 (file-name (git-file-name name version))
328 "0i8pxvyaih79pqnyvqyqd9rwdid91pna76cap0k1n5zhg8xswf2f"))))
329 (build-system cmake-build-system)
331 `(("sphinx" ,python-sphinx))) ; to generate man pages
333 `(#:tests? #f)) ; no tests
334 (home-page "https://github.com/vhelin/wla-dx")
335 (synopsis "Assemblers for various processors")
336 (description "WLA DX is a set of tools to assemble assembly files to
337 object or library files (@code{wla-ARCH}) and link them together (@code{wlalink}).
338 Supported architectures are:
355 (license license:gpl2)))
363 (uri (string-append "https://www.floodgap.com/retrotech/xa"
364 "/dists/xa-" version ".tar.gz"))
367 "0b81r7mvzqxgnbbmhixcnrf9nc72v1nqaw19k67221g3k561dwij"))))
368 (build-system gnu-build-system)
370 `(#:tests? #f ; TODO: custom test harness, not sure how it works
372 (modify-phases %standard-phases
373 (delete 'configure)) ; no "configure" script
374 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))))
375 (native-inputs `(("perl" ,perl)))
376 (home-page "https://www.floodgap.com/retrotech/xa/")
377 (synopsis "Two-pass portable cross-assembler")
379 "xa is a high-speed, two-pass portable cross-assembler.
380 It understands mnemonics and generates code for NMOS 6502s (such
381 as 6502A, 6504, 6507, 6510, 7501, 8500, 8501, 8502 ...),
382 CMOS 6502s (65C02 and Rockwell R65C02) and the 65816.")
383 (license license:gpl2)))
385 (define-public armips
393 (url "https://github.com/Kingcom/armips")
394 (commit (string-append "v" version))))
395 (file-name (git-file-name name version))
397 (base32 "1c4dhjkvynqn9xm2vcvwzymk7yg8h25alnawkz4z1dnn1z1k3r9g"))))
398 (build-system cmake-build-system)
401 (modify-phases %standard-phases
403 (lambda* (#:key inputs #:allow-other-keys)
404 (invoke "./armipstests" "../source/Tests")))
406 (lambda* (#:key outputs #:allow-other-keys)
407 (install-file "armips" (string-append (assoc-ref outputs "out")
410 (home-page "https://github.com/Kingcom/armips")
411 (synopsis "Assembler for various ARM and MIPS platforms")
413 "armips is an assembler with full support for the MIPS R3000, MIPS R4000,
414 Allegrex and RSP instruction sets, partial support for the EmotionEngine
415 instruction set, as well as complete support for the ARM7 and ARM9 instruction
416 sets, both THUMB and ARM mode.")
417 (license license:expat)))
419 (define-public intel-xed
427 (url "https://github.com/intelxed/xed")
429 (sha256 (base32 "1jffayski2gpd54vaska7fmiwnnia8v3cka4nfyzjgl8xsky9v2s"))
430 (file-name (git-file-name name version))
431 (patches (search-patches "intel-xed-fix-nondeterminism.patch"))))
432 (build-system gnu-build-system)
434 `(("python-wrapper" ,python-wrapper)
436 ;; As of the time of writing this comment, mbuild does not exist in the
437 ;; Python Package Index and seems to only be used by intel-xed, so we
438 ;; opt to include it here instead of packaging separately. Note also
439 ;; that the git repository contains no version tags, so we directly
440 ;; reference the "version" variable from setup.py instead.
442 ,(let ((name "mbuild")
447 (url "https://github.com/intelxed/mbuild")
448 (commit "5304b94361fccd830c0e2417535a866b79c1c297")))
451 "0r3avc3035aklqxcnc14rlmmwpj3jp09vbcbwynhvvmcp8srl7dl"))
452 (file-name (git-file-name name version)))))))
453 (outputs '("out" "lib"))
456 ;; Upstream uses the custom Python build tool `mbuild', so we munge
457 ;; gnu-build-system to fit. The build process for this package is
458 ;; documented at https://intelxed.github.io/build-manual/.
459 (let* ((build-dir "build")
461 (modify-phases %standard-phases
464 (lambda* (#:key inputs #:allow-other-keys)
465 (let ((mbuild (assoc-ref inputs "mbuild")))
466 (setenv "PYTHONPATH" (string-append
467 (getenv "PYTHONPATH") ":" mbuild))
469 (string-append "--build-dir=" build-dir)
470 (string-append "--install-dir=" kit-dir)
476 ;; Skip broken test group `tests/tests-avx512pf'.
477 (invoke "tests/run-cmd.py"
478 (string-append "--build-dir=" kit-dir "/bin")
479 "--tests" "tests/tests-base"
480 "--tests" "tests/tests-avx512"
481 "--tests" "tests/tests-cet"
482 "--tests" "tests/tests-via"
483 "--tests" "tests/tests-syntax"
484 "--tests" "tests/tests-xop")))
486 (lambda* (#:key outputs #:allow-other-keys)
487 (let* ((out (assoc-ref outputs "out"))
488 (lib (assoc-ref outputs "lib")))
489 (copy-recursively (string-append kit-dir "/bin")
490 (string-append out "/bin"))
491 (copy-recursively (string-append kit-dir "/include")
492 (string-append lib "/include"))
493 (copy-recursively (string-append kit-dir "/lib")
494 (string-append lib "/lib"))
496 (home-page "https://intelxed.github.io/")
497 (synopsis "Encoder and decoder for x86 (IA32 and Intel64) instructions")
498 (description "The Intel X86 Encoder Decoder (XED) is a software library and
499 for encoding and decoding X86 (IA32 and Intel64) instructions. The decoder
500 takes sequences of 1-15 bytes along with machine mode information and produces
501 a data structure describing the opcode, operands, and flags. The encoder takes
502 a similar data structure and produces a sequence of 1 to 15 bytes. Disassembly
503 is essentially a printing pass on the data structure.
505 The library and development files are under the @code{lib} output, with a
506 family of command line utility wrappers in the default output. Each of the cli
507 tools is named like @code{xed*}. Documentation for the cli tools is sparse, so
508 this is a case where ``the code is the documentation.''")
509 (license license:asl2.0)))