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>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages assembly)
28 #:use-module (guix build-system cmake)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages admin)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages man)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages texinfo)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages sphinx)
50 #:use-module (gnu packages xml)
51 #:use-module ((guix utils)
52 #:select (%current-system)))
60 (uri (string-append "http://www.nasm.us/pub/nasm/releasebuilds/"
61 version "/nasm-" version ".tar.xz"))
64 "1xg8dfr49py15vbwk1rzcjc3zpqydmr49ahlijm56wlgj8zdwjp2"))))
65 (build-system gnu-build-system)
66 (native-inputs `(("perl" ,perl) ;for doc and test target
67 ("texinfo" ,texinfo)))
69 `(#:test-target "test"
71 (modify-phases %standard-phases
72 (add-after 'unpack 'dont-build-ps-pdf-outputs
74 (substitute* "doc/Makefile.in"
75 (("html nasmdoc.txt nasmdoc.pdf")
77 (("\\$\\(INSTALL_DATA\\) nasmdoc.pdf")
80 (add-after 'install 'install-info
82 (invoke "make" "install_doc"))))))
83 (home-page "https://www.nasm.us/")
84 (synopsis "80x86 and x86-64 assembler")
86 "NASM, the Netwide Assembler, is an 80x86 and x86-64 assembler designed
87 for portability and modularity. It supports a range of object file formats,
88 including Linux and *BSD a.out, ELF, COFF, Mach-O, Microsoft 16-bit OBJ,
89 Windows32 and Windows64. It will also output plain binary files. Its syntax
90 is designed to be simple and easy to understand, similar to Intel's but less
91 complex. It supports all currently known x86 architectural extensions, and
92 has strong support for macros.")
93 (license license:bsd-2)))
102 "http://www.tortall.net/projects/yasm/releases/yasm-"
106 "0gv0slmm0qpq91za3v2v9glff3il594x5xsrbgab7xcmnh0ndkix"))))
107 (build-system gnu-build-system)
109 '(#:parallel-tests? #f)) ; Some tests fail
110 ; non-deterministically when run in
113 `(("python" ,python-wrapper)
115 (home-page "https://yasm.tortall.net/")
116 (synopsis "Rewrite of the NASM assembler")
118 "Yasm is a complete rewrite of the NASM assembler.
120 Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM
121 and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit
122 Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source
123 debugging information in STABS, DWARF 2, and CodeView 8 formats.")
124 (license (license:non-copyleft "file://COPYING"
125 "See COPYING in the distribution."))))
127 (define-public lightning
133 (uri (string-append "mirror://gnu/lightning/lightning-"
137 "1jgxbq2cm51dzi3zhz38mmgwdcgs328mfl8iviw8dxn6dn36p1gd"))))
138 (build-system gnu-build-system)
139 (native-inputs `(("zlib" ,zlib)))
140 (synopsis "Library for generating assembly code at runtime")
142 "GNU Lightning is a library that generates assembly language code at
143 run-time. Thus, it is useful in creating Just-In-Time compilers. It
144 abstracts over the target CPU by exposing a standardized RISC instruction set
146 (home-page "https://www.gnu.org/software/lightning/")
147 (license license:gpl3+)))
156 (uri (string-append "https://flatassembler.net/fasm-"
159 (base32 "142vxhs8mh8isvlzq7ir0asmqda410phzxmk9gk9b43dldskkj7k"))))
160 (build-system gnu-build-system)
162 `(#:tests? #f ; no tests exist
163 #:strip-binaries? #f ; fasm has no sections
165 (modify-phases %standard-phases
166 (delete 'configure) ; no "configure" script
169 (chdir "source/Linux/")
170 (if (string=? ,(%current-system) "x86_64-linux")
171 ;; Use pre-compiled binaries in top-level directory to build
173 (invoke "../../fasm.x64" "fasm.asm")
174 (invoke "../../fasm" "fasm.asm"))))
177 (let ((out (assoc-ref %outputs "out")))
178 (install-file "fasm" (string-append out "/bin")))
180 (supported-systems '("x86_64-linux" "i686-linux"))
181 (synopsis "Assembler for x86 processors")
183 "@acronym{FASM, the Flat ASseMbler} is an assembler that supports x86 and
184 IA-64 Intel architectures. It does multiple passes to optimize machine code.
185 It has macro abilities and focuses on operating system portability.")
186 (home-page "https://flatassembler.net/")
187 (license license:bsd-2)))
195 (uri (string-append "http://v3.sk/~lkundrak/dev86/Dev86src-"
199 "154dyr2ph4n0kwi8yx0n78j128kw29rk9r9f7s2gddzrdl712jr3"))))
200 (build-system gnu-build-system)
202 `(#:parallel-build? #f ; They use submakes wrong
203 #:make-flags (list "CC=gcc"
204 (string-append "PREFIX="
205 (assoc-ref %outputs "out")))
206 #:system "i686-linux" ; Standalone ld86 had problems otherwise
207 #:tests? #f ; No tests exist
209 (modify-phases %standard-phases
211 (add-before 'install 'mkdir
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let ((out (assoc-ref outputs "out")))
214 (mkdir-p (string-append out "/bin"))
215 (mkdir-p (string-append out "/man/man1"))
217 (synopsis "Intel 8086 (primarily 16-bit) assembler, C compiler and
219 (description "This package provides a Intel 8086 (primarily 16-bit)
220 assembler, a C compiler and a linker. The assembler uses Intel syntax
221 (also Intel order of operands).")
222 (home-page "https://github.com/jbruchon/dev86")
223 (supported-systems '("i686-linux" "x86_64-linux"))
224 (license license:gpl2+)))
226 (define-public libjit
227 (let ((commit "554c9f5c750daa6e13a6a5cd416873c81c7b8226"))
234 (url "https://git.savannah.gnu.org/r/libjit.git")
236 (file-name (git-file-name name version))
239 "0p6wklslkkp3s4aisj3w5a53bagqn5fy4m6088ppd4fcfxgqkrcd"))))
240 (build-system gnu-build-system)
242 `(("autoconf" ,autoconf)
243 ("automake" ,automake)
246 ("help2man" ,help2man)
247 ("gettext" ,gettext-minimal)
249 ("makeinfo" ,texinfo)
250 ("pkg-config" ,pkg-config)))
251 (home-page "https://www.gnu.org/software/libjit/")
252 (synopsis "Just-In-Time compilation library")
254 "GNU libjit is a library that provides generic Just-In-Time compiler
255 functionality independent of any particular bytecode, language, or
257 (license license:lgpl2.1+))))
266 (url "https://github.com/rednex/rgbds.git")
267 (commit (string-append "v" version))))
268 (file-name (git-file-name name version))
271 "15680964nlsa83nqgxk7knxajn98lddz2hg6jnn8ffmnms5wdam7"))))
272 (build-system gnu-build-system)
275 (modify-phases %standard-phases
279 (with-directory-excursion "test/asm"
280 (invoke "./test.sh"))
281 (with-directory-excursion "test/link"
282 (invoke "./test.sh")))))
283 #:make-flags `("CC=gcc"
284 ,(string-append "PREFIX="
285 (assoc-ref %outputs "out")))))
289 ("pkg-config" ,pkg-config)
290 ("util-linux" ,util-linux)))
292 `(("libpng" ,libpng)))
293 (home-page "https://github.com/rednex/rgbds")
294 (synopsis "Rednex Game Boy Development System")
296 "RGBDS (Rednex Game Boy Development System) is an assembler/linker
297 package for the Game Boy and Game Boy Color. It consists of:
299 @item rgbasm (assembler)
300 @item rgblink (linker)
301 @item rgbfix (checksum/header fixer)
302 @item rgbgfx (PNG-to-Game Boy graphics converter)
304 (license license:expat)))
306 (define-public wla-dx
313 (url "https://github.com/vhelin/wla-dx.git")
314 (commit (string-append "v" version))))
315 (file-name (git-file-name name version))
318 "022isf7s9q5i0j4xj69zpp0lgw8p9n37sn7ii25v68r15zaahk2w"))))
319 (build-system cmake-build-system)
321 `(("sphinx" ,python-sphinx))) ; to generate man pages
323 `(#:tests? #f)) ; no tests
324 (home-page "https://github.com/vhelin/wla-dx")
325 (synopsis "Assemblers for various processors")
326 (description "WLA DX is a set of tools to assemble assembly files to
327 object or library files (@code{wla-ARCH}) and link them together (@code{wlalink}).
328 Supported architectures are:
345 (license license:gpl2)))
353 (uri (string-append "https://www.floodgap.com/retrotech/xa"
354 "/dists/xa-" version ".tar.gz"))
357 "0b81r7mvzqxgnbbmhixcnrf9nc72v1nqaw19k67221g3k561dwij"))))
358 (build-system gnu-build-system)
360 `(#:tests? #f ; TODO: custom test harness, not sure how it works
362 (modify-phases %standard-phases
363 (delete 'configure)) ; no "configure" script
364 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))))
365 (native-inputs `(("perl" ,perl)))
366 (home-page "https://www.floodgap.com/retrotech/xa/")
367 (synopsis "Two-pass portable cross-assembler")
369 "xa is a high-speed, two-pass portable cross-assembler.
370 It understands mnemonics and generates code for NMOS 6502s (such
371 as 6502A, 6504, 6507, 6510, 7501, 8500, 8501, 8502 ...),
372 CMOS 6502s (65C02 and Rockwell R65C02) and the 65816.")
373 (license license:gpl2)))