@@ -0,0 +1,28 @@
1+{ stdenv, lib, fasm-bin, isx86_64 }:
2+
3+stdenv.mkDerivation rec {
4+ inherit (fasm-bin) version src meta;
5+
6+ name = "fasm-${version}";
7+
8+ nativeBuildInputs = [ fasm-bin ];
9+
10+ buildPhase = ''
11+ fasm source/Linux${lib.optionalString isx86_64 "/x64"}/fasm.asm fasm
12+ for tool in listing prepsrc symbols; do
13+ fasm tools/libc/$tool.asm
14+ cc -o tools/libc/fasm-$tool tools/libc/$tool.o
15+ done
16+ '';
17+
18+ outputs = [ "out" "doc" ];
19+
20+ installPhase = ''
21+ install -Dt $out/bin fasm tools/libc/fasm-*
22+
23+ docs=$doc/share/doc/fasm
24+ mkdir -p $docs
25+ cp -r examples/ *.txt tools/fas.txt $docs
26+ cp tools/readme.txt $docs/tools.txt
27+ '';
28+}