about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix b/nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix
new file mode 100644
index 000000000000..1cdfb4b9c870
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatbuffers/generic.nix
@@ -0,0 +1,46 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, version
+, sha256
+, patches ? [ ]
+, preConfigure ? null
+}:
+
+stdenv.mkDerivation rec {
+  pname = "flatbuffers";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "flatbuffers";
+    rev = "v${version}";
+    inherit sha256;
+  };
+
+  inherit patches preConfigure;
+
+  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.
+    '';
+    maintainers = [ maintainers.teh ];
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    homepage = "https://google.github.io/flatbuffers/";
+  };
+}