2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "flatbuffers";
|
2020-08-20 17:08:02 +00:00
|
|
|
version = "1.12.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "flatbuffers";
|
|
|
|
rev = "v${version}";
|
2020-08-20 17:08:02 +00:00
|
|
|
sha256 = "0f7xd66vc1lzjbn7jzd5kyqrgxpsfxi4zc7iymhb5xrwyxipjl1g";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-01-09 10:05:03 +00:00
|
|
|
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";
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preConfigure = lib.optional stdenv.buildPlatform.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
rm BUILD
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}" ];
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
# tests fail to compile
|
|
|
|
doCheck = false;
|
|
|
|
# doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
2020-04-24 23:36:52 +00:00
|
|
|
checkTarget = "test";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Memory Efficient Serialization Library";
|
2020-04-24 23:36:52 +00:00
|
|
|
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.
|
|
|
|
'';
|
2021-01-09 10:05:03 +00:00
|
|
|
maintainers = [ maintainers.teh ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://google.github.io/flatbuffers/";
|
|
|
|
};
|
2020-08-20 17:08:02 +00:00
|
|
|
}
|