gnu: Add external-program.
[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 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages assembly)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages admin)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages image)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages man)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages texinfo)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages xml)
48 #:use-module ((guix utils)
49 #:select (%current-system)))
50
51 (define-public nasm
52 (package
53 (name "nasm")
54 (version "2.14.02")
55 (source (origin
56 (method url-fetch)
57 (uri (string-append "http://www.nasm.us/pub/nasm/releasebuilds/"
58 version "/nasm-" version ".tar.xz"))
59 (sha256
60 (base32
61 "1xg8dfr49py15vbwk1rzcjc3zpqydmr49ahlijm56wlgj8zdwjp2"))))
62 (build-system gnu-build-system)
63 (native-inputs `(("perl" ,perl) ;for doc and test target
64 ("texinfo" ,texinfo)))
65 (arguments
66 `(#:test-target "test"
67 #:phases
68 (modify-phases %standard-phases
69 (add-after 'unpack 'dont-build-ps-pdf-outputs
70 (lambda _
71 (substitute* "doc/Makefile.in"
72 (("html nasmdoc.txt nasmdoc.pdf")
73 "html nasmdoc.txt")
74 (("\\$\\(INSTALL_DATA\\) nasmdoc.pdf")
75 "$(INSTALL_DATA)"))
76 #t))
77 (add-after 'install 'install-info
78 (lambda _
79 (invoke "make" "install_doc"))))))
80 (home-page "https://www.nasm.us/")
81 (synopsis "80x86 and x86-64 assembler")
82 (description
83 "NASM, the Netwide Assembler, is an 80x86 and x86-64 assembler designed
84 for portability and modularity. It supports a range of object file formats,
85 including Linux and *BSD a.out, ELF, COFF, Mach-O, Microsoft 16-bit OBJ,
86 Windows32 and Windows64. It will also output plain binary files. Its syntax
87 is designed to be simple and easy to understand, similar to Intel's but less
88 complex. It supports all currently known x86 architectural extensions, and
89 has strong support for macros.")
90 (license license:bsd-2)))
91
92 (define-public yasm
93 (package
94 (name "yasm")
95 (version "1.3.0")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append
99 "http://www.tortall.net/projects/yasm/releases/yasm-"
100 version ".tar.gz"))
101 (sha256
102 (base32
103 "0gv0slmm0qpq91za3v2v9glff3il594x5xsrbgab7xcmnh0ndkix"))))
104 (build-system gnu-build-system)
105 (arguments
106 '(#:parallel-tests? #f)) ; Some tests fail
107 ; non-deterministically when run in
108 ; parallel
109 (inputs
110 `(("python" ,python-wrapper)
111 ("xmlto" ,xmlto)))
112 (home-page "http://yasm.tortall.net/")
113 (synopsis "Rewrite of the NASM assembler")
114 (description
115 "Yasm is a complete rewrite of the NASM assembler.
116
117 Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM
118 and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit
119 Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source
120 debugging information in STABS, DWARF 2, and CodeView 8 formats.")
121 (license (license:non-copyleft "file://COPYING"
122 "See COPYING in the distribution."))))
123
124 (define-public lightning
125 (package
126 (name "lightning")
127 (version "2.1.3")
128 (source (origin
129 (method url-fetch)
130 (uri (string-append "mirror://gnu/lightning/lightning-"
131 version ".tar.gz"))
132 (sha256
133 (base32
134 "1jgxbq2cm51dzi3zhz38mmgwdcgs328mfl8iviw8dxn6dn36p1gd"))))
135 (build-system gnu-build-system)
136 (native-inputs `(("zlib" ,zlib)))
137 (synopsis "Library for generating assembly code at runtime")
138 (description
139 "GNU Lightning is a library that generates assembly language code at
140 run-time. Thus, it is useful in creating Just-In-Time compilers. It
141 abstracts over the target CPU by exposing a standardized RISC instruction set
142 to the clients.")
143 (home-page "https://www.gnu.org/software/lightning/")
144 (license license:gpl3+)))
145
146 (define-public fasm
147 (package
148 (name "fasm")
149 (version "1.73.21")
150 (source
151 (origin
152 (method url-fetch)
153 (uri (string-append "https://flatassembler.net/fasm-"
154 version ".tgz"))
155 (sha256
156 (base32 "143zh7x3q0r2kclshh8n5w4i5pw4lh60si7rspvc725xxjpjkvcv"))))
157 (build-system gnu-build-system)
158 (arguments
159 `(#:tests? #f ; no tests exist
160 #:strip-binaries? #f ; fasm has no sections
161 #:phases
162 (modify-phases %standard-phases
163 (delete 'configure) ; no "configure" script
164 (replace 'build
165 (lambda _
166 (chdir "source/Linux/")
167 (if (string=? ,(%current-system) "x86_64-linux")
168 ;; Use pre-compiled binaries in top-level directory to build
169 ;; fasm.
170 (invoke "../../fasm.x64" "fasm.asm")
171 (invoke "../../fasm" "fasm.asm"))))
172 (replace 'install
173 (lambda _
174 (let ((out (assoc-ref %outputs "out")))
175 (install-file "fasm" (string-append out "/bin")))
176 #t)))))
177 (supported-systems '("x86_64-linux" "i686-linux"))
178 (synopsis "Assembler for x86 processors")
179 (description
180 "@acronym{FASM, the Flat ASseMbler} is an assembler that supports x86 and
181 IA-64 Intel architectures. It does multiple passes to optimize machine code.
182 It has macro abilities and focuses on operating system portability.")
183 (home-page "https://flatassembler.net/")
184 (license license:bsd-2)))
185
186 (define-public dev86
187 (package
188 (name "dev86")
189 (version "0.16.21")
190 (source (origin
191 (method url-fetch)
192 (uri (string-append "http://v3.sk/~lkundrak/dev86/Dev86src-"
193 version ".tar.gz"))
194 (sha256
195 (base32
196 "154dyr2ph4n0kwi8yx0n78j128kw29rk9r9f7s2gddzrdl712jr3"))))
197 (build-system gnu-build-system)
198 (arguments
199 `(#:parallel-build? #f ; They use submakes wrong
200 #:make-flags (list "CC=gcc"
201 (string-append "PREFIX="
202 (assoc-ref %outputs "out")))
203 #:system "i686-linux" ; Standalone ld86 had problems otherwise
204 #:tests? #f ; No tests exist
205 #:phases
206 (modify-phases %standard-phases
207 (delete 'configure)
208 (add-before 'install 'mkdir
209 (lambda* (#:key outputs #:allow-other-keys)
210 (let ((out (assoc-ref outputs "out")))
211 (mkdir-p (string-append out "/bin"))
212 (mkdir-p (string-append out "/man/man1"))
213 #t))))))
214 (synopsis "Intel 8086 (primarily 16-bit) assembler, C compiler and
215 linker")
216 (description "This package provides a Intel 8086 (primarily 16-bit)
217 assembler, a C compiler and a linker. The assembler uses Intel syntax
218 (also Intel order of operands).")
219 (home-page "https://github.com/jbruchon/dev86")
220 (supported-systems '("i686-linux" "x86_64-linux"))
221 (license license:gpl2+)))
222
223 (define-public libjit
224 (let ((commit "554c9f5c750daa6e13a6a5cd416873c81c7b8226"))
225 (package
226 (name "libjit")
227 (version "0.1.4")
228 (source (origin
229 (method git-fetch)
230 (uri (git-reference
231 (url "https://git.savannah.gnu.org/r/libjit.git")
232 (commit commit)))
233 (file-name (string-append name "-" version "-checkout"))
234 (sha256
235 (base32
236 "0p6wklslkkp3s4aisj3w5a53bagqn5fy4m6088ppd4fcfxgqkrcd"))))
237 (build-system gnu-build-system)
238 (native-inputs
239 `(("autoconf" ,autoconf)
240 ("automake" ,automake)
241 ("bison" ,bison)
242 ("flex" ,flex)
243 ("help2man" ,help2man)
244 ("gettext" ,gettext-minimal)
245 ("libtool" ,libtool)
246 ("makeinfo" ,texinfo)
247 ("pkg-config" ,pkg-config)))
248 (home-page "https://www.gnu.org/software/libjit/")
249 (synopsis "Just-In-Time compilation library")
250 (description
251 "GNU libjit is a library that provides generic Just-In-Time compiler
252 functionality independent of any particular bytecode, language, or
253 runtime")
254 (license license:lgpl2.1+))))
255
256 (define-public rgbds
257 (package
258 (name "rgbds")
259 (version "0.3.9")
260 (source (origin
261 (method git-fetch)
262 (uri (git-reference
263 (url "https://github.com/rednex/rgbds.git")
264 (commit (string-append "v" version))))
265 (file-name (git-file-name name version))
266 (sha256
267 (base32
268 "0pzd9ig3ahpgq7jbj82grllxx1v01d620insr2m8h0c6jj25n5hv"))))
269 (build-system gnu-build-system)
270 (arguments
271 `(#:phases
272 (modify-phases %standard-phases
273 (delete 'configure)
274 (replace 'check
275 (lambda _
276 (with-directory-excursion "test/asm"
277 (invoke "./test.sh"))
278 (with-directory-excursion "test/link"
279 (invoke "./test.sh")))))
280 #:make-flags `("CC=gcc"
281 ,(string-append "PREFIX="
282 (assoc-ref %outputs "out")))))
283 (native-inputs
284 `(("bison" ,bison)
285 ("flex" ,flex)
286 ("pkg-config" ,pkg-config)
287 ("util-linux" ,util-linux)))
288 (inputs
289 `(("libpng" ,libpng)))
290 (home-page "https://github.com/rednex/rgbds")
291 (synopsis "Rednex Game Boy Development System")
292 (description
293 "RGBDS (Rednex Game Boy Development System) is an assembler/linker
294 package for the Game Boy and Game Boy Color. It consists of:
295 @itemize @bullet
296 @item rgbasm (assembler)
297 @item rgblink (linker)
298 @item rgbfix (checksum/header fixer)
299 @item rgbgfx (PNG-to-Game Boy graphics converter)
300 @end itemize")
301 (license license:expat)))