1{ lib
2, stdenv
3, fetchFromGitHub
4, meson
5, ninja
6}:
7
8stdenv.mkDerivation rec {
9 pname = "frozen";
10 # pin to a newer release if frozen releases again, see cesanta/frozen#72
11 version = "unstable-2021-02-23";
12
13 src = fetchFromGitHub {
14 owner = "cesanta";
15 repo = "frozen";
16 rev = "21f051e3abc2240d9a25b2add6629b38e963e102";
17 hash = "sha256-BpuYK9fbWSpeF8iPT8ImrV3CKKaA5RQ2W0ZQ03TciR0=";
18 };
19
20 nativeBuildInputs = [ meson ninja ];
21
22 # frozen has a simple Makefile and a GN BUILD file as building scripts.
23 # Since it has only two source files, the best course of action to support
24 # cross compilation is to create a small meson.build file.
25 # Relevant upstream issue: https://github.com/cesanta/frozen/pull/71
26 # We also remove the GN BUILD file to prevent conflicts on case-insesitive
27 # file systems.
28 preConfigure = ''
29 rm BUILD
30 cp ${./meson.build} meson.build
31 '';
32
33 meta = {
34 homepage = "https://github.com/cesanta/frozen";
35 description = "Minimal JSON parser for C, targeted for embedded systems";
36 license = lib.licenses.asl20;
37 maintainers = with lib.maintainers; [ thillux ];
38 platforms = lib.platforms.unix;
39 };
40}