1{ lib, stdenv
2, fetchurl
3, symlinkJoin
4, makeWrapper
5, tcl
6, fontconfig
7, tk
8, ncurses
9, xorg
10, file
11}:
12
13let
14 # eli derives the location of the include folder from the location of the lib folder
15 tk_combined = symlinkJoin {
16 name = "tk_combined";
17 paths = [
18 tk
19 tk.dev
20 ];
21 };
22 curses_combined = symlinkJoin {
23 name = "curses_combined";
24 paths = [
25 ncurses
26 ncurses.dev
27 ];
28 };
29in
30stdenv.mkDerivation rec {
31 pname = "eli";
32 version = "4.8.1";
33
34 src = fetchurl {
35 url = "mirror://sourceforge/project/eli-project/Eli/Eli%20${version}/${pname}-${version}.tar.bz2";
36 sha256="1vran8583hbwrr5dciji4zkhz3f88w4mn8n9sdpr6zw0plpf1whj";
37 };
38
39 buildInputs = [
40 ncurses
41 fontconfig
42 ] ++ (with xorg; [
43 libX11.dev
44 libXt.dev
45 libXaw.dev
46 libXext.dev
47 ]);
48
49 nativeBuildInputs = [
50 file
51 makeWrapper
52 ];
53
54 # skip interactive browser check
55 buildFlags = [ "nobrowsers" ];
56
57 # Workaround build failure on -fno-common toolchains:
58 # ld: cexp.o:(.bss+0x40): multiple definition of `obstck'; cccp.o:(.bss+0x0): first defined here
59 env.NIX_CFLAGS_COMPILE = "-fcommon";
60
61 preConfigure=''
62 configureFlagsArray=(
63 --with-tcltk="${tcl} ${tk_combined}"
64 --with-curses="${curses_combined}"
65 )
66 export ODIN_LOCALIPC=1
67 '';
68
69 postInstall = ''
70 wrapProgram "$out/bin/eli" \
71 --set ODIN_LOCALIPC 1
72 '';
73
74 # Test if eli starts
75 doInstallCheck = true;
76 installCheckPhase = ''
77 export HOME="$TMP/home"
78 mkdir -p "$HOME"
79 $out/bin/eli "!ls"
80 '';
81
82 meta = {
83 description = "Translator Construction Made Easy";
84 longDescription = ''
85 Eli is a programming environment that supports all phases of translator
86 construction with extensive libraries implementing common tasks, yet handling
87 arbitrary special cases. Output is the C subset of C++.
88 '';
89 homepage = "https://eli-project.sourceforge.net/";
90 license = lib.licenses.gpl2;
91 maintainers = with lib.maintainers; [ timokau ];
92 platforms = lib.platforms.linux;
93 };
94}