1{ stdenv, fetchurl, gcc, makeWrapper
2, db, gmp, ncurses }:
3
4let
5 version = "2.2";
6 lib = stdenv.lib;
7in
8stdenv.mkDerivation rec {
9 name = "gnu-cobol-${version}";
10 inherit version;
11
12 src = fetchurl {
13 url = "https://sourceforge.com/projects/open-cobol/files/gnu-cobol/${version}/gnucobol-${version}.tar.gz";
14 sha256 = "1jrjmdx0swssjh388pp08awhiisbrs2i7gx4lcm4p1k5rpg3hn4j";
15 };
16
17 nativeBuildInputs = [ makeWrapper ];
18
19 buildInputs = [ db gmp ncurses ];
20
21 cflags = stdenv.lib.concatMapStringsSep " " (p: "-L" + (lib.getLib p) + "/lib ") buildInputs;
22 ldflags = stdenv.lib.concatMapStringsSep " " (p: "-I" + (lib.getDev p) + "/include ") buildInputs;
23
24 cobolCCFlags = "-I$out/include ${ldflags} -L$out/lib ${cflags}";
25
26 postInstall = with stdenv.lib; ''
27 wrapProgram "$out/bin/cobc" \
28 --set COB_CC "${gcc}/bin/gcc" \
29 --prefix COB_LDFLAGS " " "${cobolCCFlags}" \
30 --prefix COB_CFLAGS " " "${cobolCCFlags}"
31 '';
32
33 meta = with stdenv.lib; {
34 description = "An open-source COBOL compiler";
35 homepage = https://sourceforge.net/projects/open-cobol/;
36 license = licenses.gpl3;
37 maintainers = with maintainers; [ ericsagnes the-kenny ];
38 platforms = platforms.linux;
39 };
40}