1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5}:
6
7stdenv.mkDerivation rec {
8 pname = "samurai";
9 version = "1.2";
10
11 src = fetchFromGitHub {
12 owner = "michaelforney";
13 repo = pname;
14 rev = version;
15 hash = "sha256-RPY3MFlnSDBZ5LOkdWnMiR/CZIBdqIFo9uLU+SAKPBI=";
16 };
17
18 makeFlags = [ "DESTDIR=" "PREFIX=${placeholder "out"}" ];
19
20 patches = [
21 # NULL pointer dereference in writefile() in util.c; remove this at the next
22 # release
23 (fetchpatch {
24 name = "CVE-2021-30218.patch";
25 url = "https://github.com/michaelforney/samurai/commit/e84b6d99c85043fa1ba54851ee500540ec206918.patch";
26 sha256 = "sha256-hyndwj6st4rwOJ35Iu0qL12dR5E6CBvsulvR27PYKMw=";
27 })
28 # NULL pointer dereference in printstatus() in build.c; remove this at the
29 # next release
30 (fetchpatch {
31 name = "CVE-2021-30219.patch";
32 url = "https://github.com/michaelforney/samurai/commit/d2af3bc375e2a77139c3a28d6128c60cd8d08655.patch";
33 sha256 = "sha256-rcdwKjHeq5Oaga9wezdHSg/7ljkynfbnkBc2ciMW5so=";
34 })
35 ];
36
37 meta = with lib; {
38 description = "ninja-compatible build tool written in C";
39 longDescription = ''
40 samurai is a ninja-compatible build tool with a focus on simplicity,
41 speed, and portability.
42
43 It is written in C99, requires various POSIX.1-2008 interfaces, and
44 nowadays implements ninja build language through version 1.9.0 except for
45 Microsoft (R) Visual C++ (TM) dependency handling (deps = msvc).
46
47 It is feature-complete (but not bug-compatible) and supports most of the
48 same options as ninja, using the same format for .ninja_log and
49 .ninja_deps as the original ninja tool, currently version 5 and 4
50 respectively.
51 '';
52 homepage = "https://github.com/michaelforney/samurai";
53 license = with licenses; [ mit asl20 ]; # see LICENSE
54 maintainers = with maintainers; [ dtzWill AndersonTorres ];
55 mainProgram = "samu";
56 platforms = platforms.all;
57 };
58}
59