2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-08-12 12:06:08 +00:00
|
|
|
, python3
|
2021-06-28 23:13:55 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "flatbuffers";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "2.0.7";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "flatbuffers";
|
|
|
|
rev = "v${version}";
|
2022-09-09 14:08:57 +00:00
|
|
|
sha256 = "sha256-tIM6CdIPq++xFbpA22zDm3D4dT9soNDe/9GRY/FyLrw=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Fix default value of "test_data_path" to make tests work
|
|
|
|
substituteInPlace tests/test.cpp --replace '"tests/";' '"../tests/";'
|
|
|
|
'';
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
|
2022-08-12 12:06:08 +00:00
|
|
|
"-DFLATBUFFERS_OSX_BUILD_UNIVERSAL=OFF"
|
2021-06-28 23:13:55 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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-18 14:49:53 +00:00
|
|
|
homepage = "https://google.github.io/flatbuffers/";
|
2021-06-28 23:13:55 +00:00
|
|
|
license = licenses.asl20;
|
2022-05-18 14:49:53 +00:00
|
|
|
maintainers = [ maintainers.teh ];
|
|
|
|
mainProgram = "flatc";
|
2021-06-28 23:13:55 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|