2021-06-04 14:37:37 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-05-12 04:31:11 +01:00
|
|
|
, fetchpatch
|
2021-06-04 14:37:37 +01:00
|
|
|
, cmake
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "flatbuffers";
|
2022-05-12 04:31:11 +01:00
|
|
|
version = "2.0.0";
|
2021-06-04 14:37:37 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "flatbuffers";
|
|
|
|
rev = "v${version}";
|
2022-05-12 04:31:11 +01:00
|
|
|
sha256 = "1zbf6bdpps8369r1ql00irxrp58jnalycc8jcapb8iqg654vlfz8";
|
2021-06-04 14:37:37 +01:00
|
|
|
};
|
|
|
|
|
2022-05-12 04:31:11 +01:00
|
|
|
patches = [
|
|
|
|
# Pull patch pending upstream inclustion for gcc-12 support:
|
|
|
|
# https://github.com/google/flatbuffers/pull/6946
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc-12.patch";
|
|
|
|
url = "https://github.com/google/flatbuffers/commit/17d9f0c4cf47a9575b4f43a2ac33eb35ba7f9e3e.patch";
|
|
|
|
sha256 = "0sksk47hi7camja9ppnjr88jfdgj0nxqxy8976qs1nx73zkgbpf9";
|
|
|
|
})
|
|
|
|
];
|
2021-06-04 14:37:37 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
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.
|
|
|
|
'';
|
2022-05-05 01:52:27 +01:00
|
|
|
homepage = "https://google.github.io/flatbuffers/";
|
2021-06-04 14:37:37 +01:00
|
|
|
license = licenses.asl20;
|
2022-05-05 01:52:27 +01:00
|
|
|
maintainers = [ maintainers.teh ];
|
|
|
|
mainProgram = "flatc";
|
2021-06-04 14:37:37 +01:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|