summary refs log tree commit diff
diff options
context:
space:
mode:
authorStanisław Pitucha <git@viraptor.info>2022-08-25 16:00:54 +1000
committerGitHub <noreply@github.com>2022-08-25 16:00:54 +1000
commitb0f33ebf404d57269773998c301428ba241efd5a (patch)
tree7acf51851093bb091bf0c11693675ba2879607f0
parent963ee529069a4ca8020c6d2d4d15e8cb4cd11bce (diff)
parent44cf3379a246449adb150ab7143798d31f9cb925 (diff)
downloadnixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar.gz
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar.bz2
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar.lz
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar.xz
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.tar.zst
nixpkgs-b0f33ebf404d57269773998c301428ba241efd5a.zip
Merge pull request #188011 from unhammer/cg3
cg3: init at version 1.3.7
-rw-r--r--maintainers/maintainer-list.nix9
-rw-r--r--pkgs/development/interpreters/cg3/default.nix61
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 72 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index a4b2f646671..5bca2dca9f7 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -13506,6 +13506,15 @@
       fingerprint = "EE59 5E29 BB5B F2B3 5ED2  3F1C D276 FF74 6700 7335";
     }];
   };
+  unhammer = {
+    email = "unhammer@fsfe.org";
+    github = "unhammer";
+    githubId = 56868;
+    name = "Kevin Brubeck Unhammer";
+    keys = [{
+      fingerprint = "50D4 8796 0B86 3F05 4B6A  12F9 7426 06DE 766A C60C";
+    }];
+  };
   uniquepointer = {
     email = "uniquepointer@mailbox.org";
     matrix = "@uniquepointer:matrix.org";
diff --git a/pkgs/development/interpreters/cg3/default.nix b/pkgs/development/interpreters/cg3/default.nix
new file mode 100644
index 00000000000..27db9bebcd0
--- /dev/null
+++ b/pkgs/development/interpreters/cg3/default.nix
@@ -0,0 +1,61 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, runCommand
+, dieHook
+, cmake
+, icu
+, boost
+}:
+
+let cg3 = stdenv.mkDerivation rec {
+  pname = "cg3";
+  version = "1.3.7";
+
+  src = fetchFromGitHub {
+    owner = "GrammarSoft";
+    repo = "${pname}";
+    rev = "v${version}";
+    sha256 = "Ena3dGoZsXOIY6mbvnfI0H7QqRifoxWIBKQrK3yQSmY=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  buildInputs = [
+    icu
+    boost
+  ];
+
+  doCheck = true;
+
+  passthru.tests.minimal = runCommand "${pname}-test" {
+      buildInputs = [
+        cg3
+        dieHook
+      ];
+    } ''
+      echo 'DELIMITERS = "."; ADD (tag) (*);' >grammar.cg3
+      printf '"<a>"\n\t"a" tag\n\n' >want.txt
+      printf '"<a>"\n\t"a"\n\n' | vislcg3 -g grammar.cg3 >got.txt
+      diff -s want.txt got.txt || die "Grammar application did not produce expected parse"
+      touch $out
+    '';
+
+
+  # TODO, consider optionals:
+  # - Enable tcmalloc unless darwin?
+  # - Enable python bindings?
+
+  meta = with lib; {
+    homepage = "https://github.com/GrammarSoft/cg3";
+    description = "Constraint Grammar interpreter, compiler and applicator vislcg3";
+    maintainers = with maintainers; [ unhammer ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+  };
+};
+
+in
+  cg3
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f113b94f289..087d384479b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -14814,6 +14814,8 @@ with pkgs;
 
   ceptre = callPackage ../development/interpreters/ceptre { };
 
+  cg3 = callPackage ../development/interpreters/cg3 { };
+
   cling = callPackage ../development/interpreters/cling { };
 
   clips = callPackage ../development/interpreters/clips { };