1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, testers
6, uasm
7}:
8
9stdenv.mkDerivation rec {
10 pname = "uasm";
11 version = "2.56.2";
12
13 src = fetchFromGitHub {
14 owner = "Terraspace";
15 repo = pname;
16 # Specifying only the tag results in the following error during download:
17 # the given path has multiple possibilities: #<Git::Ref:0x00007f618689c378>, #<Git::Ref:0x00007f618689c1e8>
18 # Probably because upstream has both a tag and a branch with the same name
19 rev = "refs/tags/v${version}";
20 hash = "sha256-QiRBscY6zefeLDDVhS/+j9yIJ+5QhgkDQh1CLl/CslM=";
21 };
22
23 patches = [
24 (fetchpatch {
25 name = "fix-v2_55-compilation-on-macos.patch";
26 url = "https://github.com/Terraspace/UASM/commit/b50c430cc3083c7f32e288a9f64fe1cafb03091d.patch";
27 sha256 = "sha256-FGFB282LSEKtGD1cIRH+Qi5bye5Gx4xb0Ty4J03xjCU";
28 })
29 ];
30
31 enableParallelBuilding = true;
32
33 makefile =
34 if stdenv.isDarwin then
35 "ClangOSX64.mak"
36 else
37 "gccLinux64.mak";
38
39 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
40
41 installPhase = ''
42 runHook preInstall
43
44 install -Dt "$out/bin" -m0755 GccUnixR/uasm
45 install -Dt "$out/share/doc/${pname}" -m0644 {Readme,History}.txt Doc/*
46
47 runHook postInstall
48 '';
49
50 passthru.tests.version = testers.testVersion {
51 package = uasm;
52 command = "uasm -h";
53 version = "v${version}";
54 };
55
56 meta = with lib; {
57 homepage = "http://www.terraspace.co.uk/uasm.html";
58 description = "A free MASM-compatible assembler based on JWasm";
59 platforms = platforms.unix;
60 maintainers = with maintainers; [ thiagokokada ];
61 license = licenses.watcom;
62 };
63}