Subject: [bug#33876] [PATCH]:gnu: Add flat assembler

From: Guy fleury <[email-masked]>
Date: Sat, 5 Jan 2019 20:45:30 +0100

Hi kei,

thanks for your suggestions.
attached update patch.

Le sam. 5 janv. 2019 à 01:11, Kei Kebreau <[email-masked]> a écrit :

> Also, don't forget to add a copyright line for yourself at the top of
> the file!
>
From b6e74c1f6fa24e438f8cff9be2b9e07cd6feb68c Mon Sep 17 00:00:00 2001
From: guy fleury iteriteka <[email-masked]>
Date: Sat, 5 Jan 2019 20:24:08 +0100
Subject: [PATCH] Add fasm

---
 gnu/packages/assembly.scm | 49 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/assembly.scm b/gnu/packages/assembly.scm
index 763d183cf..c5dbb1746 100644
--- a/gnu/packages/assembly.scm
+++ b/gnu/packages/assembly.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2013 Andreas Enge <[email-masked]>
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2019 Guy Fleury Iteriteka <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,7 +31,9 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages xml)
+  #:use-module ((guix utils)
+                #:select (%current-system)))
 
 (define-public nasm
   (package
@@ -122,3 +125,47 @@ abstracts over the target CPU by exposing a standardized RISC instruction set
 to the clients.")
     (home-page "https://www.gnu.org/software/lightning/")
     (license license:gpl3+)))
+
+(define-public fasm
+  (package
+    (name "fasm")
+    (version "1.73.06")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://flatassembler.net/fasm-"
+                           version ".tgz"))
+       (sha256
+        (base32
+         "02wqkqxpn3p0iwcagsm92qd9cdfcnbx8a09qg03b3pjppp30hmp6"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;;no tests
+       #:strip-binaries? #f ;; fasm has no sections
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure) ;;no configure script used
+         (replace 'build
+           (lambda _
+             ;;source code are in this directory
+             (chdir "source/Linux/")
+             (if (string=? ,(%current-system) "x86_64-linux")
+                 ;;use pre-compiled in top-level directory to build itself
+                 (invoke "../../fasm.x64" "fasm.asm")
+                 (invoke "../../fasm" "fasm.asm"))))
+
+         (replace 'install
+           (lambda _
+             (let ((out (assoc-ref %outputs "out")))
+               (install-file "fasm" (string-append out "/bin")))
+             #t)))))
+    ;;support only intel x86 family processors
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (synopsis "Assembler for x86 processors")
+    (description
+     "FASM is a assembler that supports x86, and IA-64 Intel architectures.
+It does multiple passes to optimize machine code.It have macro abilities and
+focus on operating system portability.")
+    (home-page "https://flatassembler.net/")
+    (license license:bsd-2)))
+
-- 
2.19.2