about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/fasm/default.nix
blob: 4b20c4051a82e14bb90d6bdb621573a3d2976d8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ stdenv, lib, fasm-bin, isx86_64 }:

stdenv.mkDerivation rec {
  inherit (fasm-bin) version src meta;

  pname = "fasm";

  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
  '';
}