about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/flatbuffers
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/flatbuffers')
-rw-r--r--nixpkgs/pkgs/development/libraries/flatbuffers/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix b/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix
new file mode 100644
index 000000000000..825e052ad873
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/flatbuffers/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, fetchpatch, cmake }:
+
+stdenv.mkDerivation (rec {
+  pname = "flatbuffers";
+  version = "1.11.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "flatbuffers";
+    rev = "v${version}";
+    sha256 = "1gl8pnykzifh7pnnvl80f5prmj5ga60dp44inpv9az2k9zaqx3qr";
+  };
+
+  preConfigure = stdenv.lib.optional stdenv.buildPlatform.isDarwin ''
+    rm BUILD
+  '';
+
+  nativeBuildInputs = [ cmake ];
+  enableParallelBuilding = true;
+
+  cmakeFlags = [ "-DFLATBUFFERS_BUILD_TESTS=${if doCheck then "ON" else "OFF"}" ];
+
+  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+  checkTarget = "test";
+
+  meta = {
+    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 = [ stdenv.lib.maintainers.teh ];
+    license = stdenv.lib.licenses.asl20;
+    platforms = stdenv.lib.platforms.unix;
+    homepage = "https://google.github.io/flatbuffers/";
+  };
+} // stdenv.lib.optionalAttrs stdenv.hostPlatform.isMusl {
+  # Remove when updating to the next version.
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/google/flatbuffers/commit/2b52494047fb6e97af03e1801b42adc7ed3fd78a.diff";
+      sha256 = "01k07ws0f4w7nnl8nli795wgjm4p94lxd3kva4yf7nf3pg4p8arx";
+    })
+  ];
+})