2021-01-22 11:25:31 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
2020-10-27 19:01:12 +00:00
|
|
|
fetchzip,
|
2024-10-18 23:47:04 +00:00
|
|
|
|
|
|
|
# update script
|
|
|
|
writeScript,
|
|
|
|
coreutils,
|
|
|
|
curl,
|
|
|
|
gnugrep,
|
|
|
|
htmlq,
|
|
|
|
nix-update,
|
2020-10-27 19:01:12 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fasmg";
|
2024-10-18 23:47:34 +00:00
|
|
|
version = "kl0e";
|
2020-10-27 19:01:12 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://flatassembler.net/fasmg.${version}.zip";
|
2024-10-18 23:47:34 +00:00
|
|
|
sha256 = "sha256-qUhsUMwxgUduGz+D8+Dm4EXyh7aiE9lJ1mhvTjHP6Tw=";
|
2020-10-27 19:01:12 +00:00
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildPhase =
|
|
|
|
let
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
|
|
|
|
path =
|
|
|
|
{
|
|
|
|
x86_64-linux = {
|
|
|
|
bin = "fasmg.x64";
|
|
|
|
asm = "source/linux/x64/fasmg.asm";
|
|
|
|
};
|
|
|
|
x86_64-darwin = {
|
|
|
|
bin = "source/macos/x64/fasmg";
|
|
|
|
asm = "source/macos/x64/fasmg.asm";
|
|
|
|
};
|
|
|
|
x86-linux = {
|
|
|
|
bin = "fasmg";
|
|
|
|
asm = "source/linux/fasmg.asm";
|
|
|
|
};
|
|
|
|
x86-darwin = {
|
|
|
|
bin = "source/macos/fasmg";
|
|
|
|
asm = "source/macos/fasmg.asm";
|
|
|
|
};
|
2023-06-19 02:46:39 +00:00
|
|
|
}
|
|
|
|
.${system} or (throw "Unsupported system: ${system}");
|
2020-10-27 19:01:12 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
''
|
|
|
|
chmod +x ${path.bin}
|
|
|
|
./${path.bin} ${path.asm} fasmg
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"doc"
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 fasmg $out/bin/fasmg
|
|
|
|
|
|
|
|
mkdir -p $doc/share/doc/fasmg
|
|
|
|
cp docs/*.txt $doc/share/doc/fasmg
|
|
|
|
'';
|
|
|
|
|
2024-10-18 23:47:04 +00:00
|
|
|
passthru.updateScript = writeScript "update-fasmg.sh" ''
|
|
|
|
export PATH="${
|
|
|
|
lib.makeBinPath [
|
|
|
|
coreutils
|
|
|
|
curl
|
|
|
|
gnugrep
|
|
|
|
htmlq
|
|
|
|
nix-update
|
|
|
|
]
|
|
|
|
}:$PATH"
|
|
|
|
version=$(
|
|
|
|
curl 'https://flatassembler.net/download.php' \
|
|
|
|
| htmlq .links a.boldlink -a href \
|
|
|
|
| grep -E '^fasmg\..*\.zip$' \
|
|
|
|
| head -n1 \
|
|
|
|
| cut -d. -f2
|
|
|
|
)
|
|
|
|
nix-update fasmg --version "$version"
|
|
|
|
'';
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-10-27 19:01:12 +00:00
|
|
|
description = "x86(-64) macro assembler to binary, MZ, PE, COFF, and ELF";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "fasmg";
|
2020-10-27 19:01:12 +00:00
|
|
|
homepage = "https://flatassembler.net";
|
|
|
|
license = licenses.bsd3;
|
2024-11-17 19:30:20 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
orivej
|
|
|
|
clevor
|
|
|
|
];
|
2020-10-27 19:01:12 +00:00
|
|
|
platforms = with platforms; intersectLists (linux ++ darwin) x86;
|
|
|
|
};
|
|
|
|
}
|