about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/fasm
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/fasm')
-rw-r--r--nixpkgs/pkgs/development/compilers/fasm/bin.nix24
-rw-r--r--nixpkgs/pkgs/development/compilers/fasm/default.nix28
2 files changed, 52 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/fasm/bin.nix b/nixpkgs/pkgs/development/compilers/fasm/bin.nix
new file mode 100644
index 000000000000..7b23d4f6bcc1
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fasm/bin.nix
@@ -0,0 +1,24 @@
+{ stdenvNoCC, lib, fetchurl }:
+
+stdenvNoCC.mkDerivation rec {
+  name = "fasm-bin-${version}";
+
+  version = "1.73.11";
+
+  src = fetchurl {
+    url = "https://flatassembler.net/fasm-${version}.tgz";
+    sha256 = "1zhbs72qc8bw5158zh6mvzznfamcx5a1bsmbmq9ci0d7wb58sxmg";
+  };
+
+  installPhase = ''
+    install -D fasm${lib.optionalString stdenvNoCC.isx86_64 ".x64"} $out/bin/fasm
+  '';
+
+  meta = with lib; {
+    description = "x86(-64) macro assembler to binary, MZ, PE, COFF, and ELF";
+    homepage = https://flatassembler.net/download.php;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ orivej ];
+    platforms = [ "i686-linux" "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/fasm/default.nix b/nixpkgs/pkgs/development/compilers/fasm/default.nix
new file mode 100644
index 000000000000..47b90469234f
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fasm/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fasm-bin, isx86_64 }:
+
+stdenv.mkDerivation rec {
+  inherit (fasm-bin) version src meta;
+
+  name = "fasm-${version}";
+
+  nativeBuildInputs = [ fasm-bin ];
+
+  buildPhase = ''
+    fasm source/Linux${lib.optionalString isx86_64 "/x64"}/fasm.asm fasm
+    for tool in listing prepsrc symbols; do
+      fasm tools/libc/$tool.asm
+      cc -o tools/libc/fasm-$tool tools/libc/$tool.o
+    done
+  '';
+
+  outputs = [ "out" "doc" ];
+
+  installPhase = ''
+    install -Dt $out/bin fasm tools/libc/fasm-*
+
+    docs=$doc/share/doc/fasm
+    mkdir -p $docs
+    cp -r examples/ *.txt tools/fas.txt $docs
+    cp tools/readme.txt $docs/tools.txt
+  '';
+}