1{ lib
2, stdenv
3, fetchurl
4, pkg-config
5, python3
6, flex
7, sqlite
8, libedit
9, runCommand
10, dieHook
11}:
12
13let
14
15link-grammar = stdenv.mkDerivation rec {
16 pname = "link-grammar";
17 version = "5.10.5";
18
19 outputs = [ "bin" "out" "dev" "man" ];
20
21 src = fetchurl {
22 url = "http://www.abisource.com/downloads/${pname}/${version}/${pname}-${version}.tar.gz";
23 sha256 = "sha256-MkcQzYEyl1/5zLU1CXMvdVhHOxwZ8XiSAAo97bhhiu0=";
24 };
25
26 nativeBuildInputs = [
27 pkg-config
28 python3
29 flex
30 ];
31
32 buildInputs = [
33 sqlite
34 libedit
35 ];
36
37 configureFlags = [
38 "--disable-java-bindings"
39 ];
40
41 doCheck = true;
42
43 passthru.tests = {
44 quick = runCommand "link-grammar-quick-test" {
45 buildInputs = [
46 link-grammar
47 dieHook
48 ];
49 } ''
50 echo "Furiously sleep ideas green colorless." | link-parser en | grep "No complete linkages found." || die "Grammaticaly invalid sentence was parsed."
51 echo "Colorless green ideas sleep furiously." | link-parser en | grep "Found .* linkages." || die "Grammaticaly valid sentence was not parsed."
52 touch $out
53 '';
54 };
55
56 meta = with lib; {
57 description = "A Grammar Checking library";
58 homepage = "https://www.abisource.com/projects/link-grammar/";
59 changelog = "https://github.com/opencog/link-grammar/blob/link-grammar-${version}/ChangeLog";
60 license = licenses.lgpl21Only;
61 maintainers = with maintainers; [ jtojnar ];
62 platforms = platforms.unix;
63 };
64};
65
66in
67 link-grammar