nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 symlinkJoin,
6 makeWrapper,
7 tcl,
8 fontconfig,
9 tk,
10 ncurses,
11 libxt,
12 libxext,
13 libxaw,
14 libx11,
15 file,
16}:
17
18let
19 # eli derives the location of the include folder from the location of the lib folder
20 tk_combined = symlinkJoin {
21 name = "tk_combined";
22 paths = [
23 tk
24 tk.dev
25 ];
26 };
27 curses_combined = symlinkJoin {
28 name = "curses_combined";
29 paths = [
30 ncurses
31 ncurses.dev
32 ];
33 };
34in
35stdenv.mkDerivation rec {
36 pname = "eli";
37 version = "4.8.1";
38
39 src = fetchurl {
40 url = "mirror://sourceforge/project/eli-project/Eli/Eli%20${version}/${pname}-${version}.tar.bz2";
41 sha256 = "1vran8583hbwrr5dciji4zkhz3f88w4mn8n9sdpr6zw0plpf1whj";
42 };
43
44 patches = [
45 # Newer GCC will reject function parameters with an implicit type of `int` and undefined
46 # references to undeclared functions.
47 ./function-declarations.patch
48 ];
49
50 buildInputs = [
51 ncurses
52 fontconfig
53 libx11.dev
54 libxt.dev
55 libxaw.dev
56 libxext.dev
57 ];
58
59 nativeBuildInputs = [
60 file
61 makeWrapper
62 ];
63
64 # skip interactive browser check
65 buildFlags = [ "nobrowsers" ];
66
67 # Workaround build failure on -fno-common toolchains:
68 # ld: cexp.o:(.bss+0x40): multiple definition of `obstck'; cccp.o:(.bss+0x0): first defined here
69 # Workaround build failure on "function definitions with identifier lists":
70 # C23 throws errors on "function definitions with identifier lists". As it is pervasively used
71 # in the upstream codebase, it's impossible to fix that legacy syntax without a full treewide
72 # refactor. So the currently fix is to pin the standard to C17.
73 env.NIX_CFLAGS_COMPILE = "-fcommon --std=gnu17";
74
75 preConfigure = ''
76 configureFlagsArray=(
77 --with-tcltk="${tcl} ${tk_combined}"
78 --with-curses="${curses_combined}"
79 )
80 export ODIN_LOCALIPC=1
81 '';
82
83 postInstall = ''
84 wrapProgram "$out/bin/eli" \
85 --set ODIN_LOCALIPC 1
86 '';
87
88 # Test if eli starts
89 doInstallCheck = true;
90 installCheckPhase = ''
91 export HOME="$TMP/home"
92 mkdir -p "$HOME"
93 $out/bin/eli "!ls"
94 '';
95
96 meta = {
97 description = "Translator Construction Made Easy";
98 longDescription = ''
99 Eli is a programming environment that supports all phases of translator
100 construction with extensive libraries implementing common tasks, yet handling
101 arbitrary special cases. Output is the C subset of C++.
102 '';
103 homepage = "https://eli-project.sourceforge.net/";
104 license = lib.licenses.gpl2;
105 maintainers = with lib.maintainers; [ timokau ];
106 platforms = lib.platforms.linux;
107 };
108}