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