@@ -0,0 +1,45 @@
1+{ stdenv, swiProlog, makeWrapper,
2+ fetchFromGitHub,
3+ lexicon ? "lexicon/clex_lexicon.pl",
4+ pname ? "ape",
5+ description ? "Parser for Attempto Controlled English (ACE)",
6+ license ? with stdenv.lib; licenses.lgpl3
7+ }:
8+
9+stdenv.mkDerivation rec {
10+ name = "${pname}-${version}";
11+ version = "6.7-131003";
12+
13+ buildInputs = [ swiProlog makeWrapper ];
14+
15+ src = fetchFromGitHub {
16+ owner = "Attempto";
17+ repo = "APE";
18+ rev = version;
19+ sha256 = "0cw47qjg4896kw3vps6rfs02asvscsqvcfdiwgfmqb3hvykb1sdx";
20+ };
21+
22+ patchPhase = ''
23+ # We move the file first to avoid "same file" error in the default case
24+ cp ${lexicon} new_lexicon.pl
25+ rm lexicon/clex_lexicon.pl
26+ cp new_lexicon.pl lexicon/clex_lexicon.pl
27+ '';
28+
29+ buildPhase = ''
30+ make build
31+ '';
32+
33+ installPhase = ''
34+ mkdir -p $out/bin
35+ cp ape.exe $out
36+ makeWrapper $out/ape.exe $out/bin/ape --add-flags ace
37+ '';
38+
39+ meta = with stdenv.lib; {
40+ description = description;
41+ license = license;
42+ platforms = platforms.unix;
43+ maintainers = with maintainers; [ yrashk ];
44+ };
45+}