about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix
blob: 374203556a6088c805e3c6597e9cee2e6d792b7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }:

stdenv.mkDerivation rec {
  pname = "flatbuffers";
  version = "1.12.0";

  src = fetchFromGitHub {
    owner = "google";
    repo = "flatbuffers";
    rev = "v${version}";
    sha256 = "0f7xd66vc1lzjbn7jzd5kyqrgxpsfxi4zc7iymhb5xrwyxipjl1g";
  };
  patches = [
    (fetchpatch {
      # Fixed a compilation error with GCC 10.0 to 11.0. June 1, 2020.
      # Should be included in the next release after 1.12.0
      url = "https://github.com/google/flatbuffers/commit/988164f6e1675bbea9c852e2d6001baf4d1fcf59.patch";
      sha256 = "0d8c2bywqmkhdi0a41cry85wy4j58pl0vd6h5xpfqm3fr8w0mi9s";
      excludes = [ "src/idl_gen_cpp.cpp" ];
    })
    (fetchpatch {
      # Fixed a compilation error with GCC 10.0 to 11.0. July 6, 2020.
      # Should be included in the next release after 1.12.0
      url = "https://github.com/google/flatbuffers/pull/6020/commits/44c7a4cf439b0a298720b5a448bcc243a882b0c9.patch";
      sha256 = "126xwkvnlc4ignjhxv9jygfd9j6kr1jx39hyk0ddpcmvzfqsccf4";
    })
  ];

  preConfigure = lib.optional stdenv.buildPlatform.isDarwin ''
    rm BUILD
  '';

  nativeBuildInputs = [ cmake ];

  cmakeFlags = [ "-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}" ];

  # tests fail to compile
  doCheck = false;
  # doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
  checkTarget = "test";

  meta = with lib; {
    description = "Memory Efficient Serialization Library";
    longDescription = ''
      FlatBuffers is an efficient cross platform serialization library for
      games and other memory constrained apps. It allows you to directly
      access serialized data without unpacking/parsing it first, while still
      having great forwards/backwards compatibility.
    '';
    maintainers = [ maintainers.teh ];
    license = licenses.asl20;
    platforms = platforms.unix;
    homepage = "https://google.github.io/flatbuffers/";
  };
}