1{ lib, stdenv
2, fetchzip
3}:
4
5stdenv.mkDerivation rec {
6 pname = "fasmg";
7 version = "j27m";
8
9 src = fetchzip {
10 url = "https://flatassembler.net/fasmg.${version}.zip";
11 sha256 = "0qmklb24n3r0my2risid8r61pi88gqrvm1c0xvyd0bp1ans6d7zd";
12 stripRoot = false;
13 };
14
15 buildPhase = let
16 inherit (stdenv.hostPlatform) system;
17
18 path = {
19 x86_64-linux = {
20 bin = "fasmg.x64";
21 asm = "source/linux/x64/fasmg.asm";
22 };
23 x86_64-darwin = {
24 bin = "source/macos/x64/fasmg";
25 asm = "source/macos/x64/fasmg.asm";
26 };
27 x86-linux = {
28 bin = "fasmg";
29 asm = "source/linux/fasmg.asm";
30 };
31 x86-darwin = {
32 bin = "source/macos/fasmg";
33 asm = "source/macos/fasmg.asm";
34 };
35 }.${system} or (throw "Unsupported system: ${system}");
36
37 in ''
38 chmod +x ${path.bin}
39 ./${path.bin} ${path.asm} fasmg
40 '';
41
42 outputs = [ "out" "doc" ];
43
44 installPhase = ''
45 install -Dm755 fasmg $out/bin/fasmg
46
47 mkdir -p $doc/share/doc/fasmg
48 cp docs/*.txt $doc/share/doc/fasmg
49 '';
50
51 meta = with lib; {
52 description = "x86(-64) macro assembler to binary, MZ, PE, COFF, and ELF";
53 mainProgram = "fasmg";
54 homepage = "https://flatassembler.net";
55 license = licenses.bsd3;
56 maintainers = with maintainers; [ orivej luc65r ];
57 platforms = with platforms; intersectLists (linux ++ darwin) x86;
58 };
59}