1{lib, stdenv, fetchurl, fetchFromGitLab
2, yodl, icmake, flexcpp, bobcat
3}:
4stdenv.mkDerivation rec {
5 pname = "bisonc++";
6 version = "6.04.00";
7
8 src = fetchFromGitLab {
9 domain = "gitlab.com";
10 owner = "fbb-git";
11 repo = "bisoncpp";
12 rev = "6.04.00";
13 hash = "sha256:0aa9bij4g08ilsk6cgrbgi03vyhqr9fn6j2164sjin93m63212wl";
14 };
15
16 buildInputs = [ bobcat ];
17
18 nativeBuildInputs = [ yodl icmake flexcpp ];
19
20 setSourceRoot = ''
21 sourceRoot="$(echo */bisonc++)"
22 '';
23
24 gpl = fetchurl {
25 url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt";
26 sha256 = "sha256:0hq6i0dm4420825fdm0lnnppbil6z67ls67n5kgjcd912dszjxw1";
27 };
28
29 postPatch = ''
30 substituteInPlace INSTALL.im --replace /usr $out
31 patchShebangs .
32 for file in $(find documentation -type f); do
33 substituteInPlace "$file" --replace /usr/share/common-licenses/GPL ${gpl}
34 substituteInPlace "$file" --replace /usr $out
35 done
36 '';
37
38 buildPhase = ''
39 ./build program
40 ./build man
41 ./build manual
42 '';
43
44 installPhase = ''
45 ./build install x
46 '';
47
48 meta = with lib; {
49 description = "Parser generator like bison, but it generates C++ code";
50 mainProgram = "bisonc++";
51 license = licenses.gpl2Plus;
52 maintainers = with maintainers; [ raskin ];
53 platforms = platforms.linux;
54 homepage = "https://fbb-git.gitlab.io/bisoncpp/";
55 };
56}