1{ lib, stdenv, fetchzip, unzip, fetchpatch, bison, flex, gperf, zlib }:
2
3stdenv.mkDerivation rec {
4 pname = "flasm";
5 version = "1.64";
6
7 src = fetchzip {
8 url = "https://www.nowrap.de/download/flasm16src.zip";
9 sha256 = "03hvxm66rb6rjwbr07hc3k7ia5rim2xlhxbd9qmcai9xwmyiqafg";
10 stripRoot = false;
11 };
12
13 patches = [
14 # Pull patch pending upstream inclusion for -fno-common toolchains:
15 # https://sourceforge.net/p/flasm/patches/2/
16 (fetchpatch {
17 name = "fno-common.patch";
18 url = "https://sourceforge.net/p/flasm/patches/2/attachment/0001-flasm-fix-build-on-gcc-10-fno-common.patch";
19 sha256 = "0ic7k1mmyvhpnxam89dbg8i9bfzk70zslfdxgpmkszx097bj1hv6";
20 })
21 ];
22
23 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
24
25 nativeBuildInputs = [ unzip bison flex gperf ];
26
27 buildInputs = [ zlib ];
28
29 installPhase = ''
30 install -Dm755 flasm -t $out/bin
31 '';
32
33 meta = with lib; {
34 description = "Assembler and disassembler for Flash (SWF) bytecode";
35 homepage = "https://flasm.sourceforge.net/";
36 license = licenses.bsd2;
37 maintainers = with maintainers; [ siraben ];
38 platforms = platforms.all;
39 };
40}