1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 python3,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "flatbuffers";
11 version = "25.2.10";
12
13 src = fetchFromGitHub {
14 owner = "google";
15 repo = "flatbuffers";
16 rev = "v${version}";
17 hash = "sha256-u5AVjbep3iWwGNXLrkPJUnF8SbmIXlHOYoy3NIlUl/E=";
18 };
19
20 nativeBuildInputs = [
21 cmake
22 python3
23 ];
24
25 cmakeFlags = [
26 "-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
27 "-DFLATBUFFERS_OSX_BUILD_UNIVERSAL=OFF"
28 ];
29
30 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
31 checkTarget = "test";
32
33 meta = with lib; {
34 description = "Memory Efficient Serialization Library";
35 longDescription = ''
36 FlatBuffers is an efficient cross platform serialization library for
37 games and other memory constrained apps. It allows you to directly
38 access serialized data without unpacking/parsing it first, while still
39 having great forwards/backwards compatibility.
40 '';
41 homepage = "https://google.github.io/flatbuffers/";
42 license = licenses.asl20;
43 maintainers = [ maintainers.teh ];
44 mainProgram = "flatc";
45 platforms = platforms.unix;
46 };
47}