about summary refs log tree commit diff
path: root/pkgs/development/libraries/gsl-lite
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-10-15 13:40:43 +0300
committerehmry <ehmry@posteo.net>2022-10-16 11:09:43 -0500
commitc97fd6f3bd8cd02160fe4e10d2119e0bd112a6eb (patch)
tree7f036248bb7bc411f8002a9abdf65be245cd9e78 /pkgs/development/libraries/gsl-lite
parent1492aa5729307727902369a1229189d140845ee2 (diff)
gsl-lite: init at 0.40.0
Diffstat (limited to 'pkgs/development/libraries/gsl-lite')
-rw-r--r--pkgs/development/libraries/gsl-lite/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/libraries/gsl-lite/default.nix b/pkgs/development/libraries/gsl-lite/default.nix
new file mode 100644
index 0000000000000..34beee93ecd32
--- /dev/null
+++ b/pkgs/development/libraries/gsl-lite/default.nix
@@ -0,0 +1,51 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, ninja
+, installCompatHeader ? false
+, installLegacyHeaders ? false
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gsl-lite";
+  version = "0.40.0";
+
+  src = fetchFromGitHub {
+    owner = "gsl-lite";
+    repo = "gsl-lite";
+    rev = "v${version}";
+    hash = "sha256-80ksT8XFn2LLMr63gKGZD/0+FDLnAtFyMpuuSjtoBlk=";
+  };
+
+  nativeBuildInputs = [ cmake ninja ];
+
+  cmakeFlags = lib.mapAttrsToList
+    (name: value: ''-DGSL_LITE_OPT_${name}:BOOL=${if value then "ON" else "OFF"}'')
+    {
+      INSTALL_COMPAT_HEADER = installCompatHeader;
+      INSTALL_LEGACY_HEADERS = installLegacyHeaders;
+      BUILD_TESTS = doCheck;
+    };
+
+  # Building tests is broken on Darwin.
+  doCheck = !stdenv.isDarwin;
+
+  meta = with lib; {
+    description = ''
+      A single-file header-only version of ISO C++ Guidelines Support Library
+      (GSL) for C++98, C++11, and later
+    '';
+    longDescription = ''
+      gsl-lite is a single-file header-only implementation of the C++ Core
+      Guidelines Support Library originally based on Microsoft GSL and adapted
+      for C++98, C++03. It also works when compiled as C++11, C++14, C++17,
+      C++20.
+    '';
+    homepage = "https://github.com/gsl-lite/gsl-lite";
+    changelog = "https://github.com/gsl-lite/gsl-lite/blob/${src.rev}/CHANGES.txt";
+    license = licenses.mit;
+    maintainers = with maintainers; [ azahi ];
+    platforms = platforms.all;
+  };
+}