nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, gcc, makeWrapper
2, db, gmp, ncurses }:
3
4stdenv.mkDerivation rec {
5 pname = "gnu-cobol";
6 version = "3.1.2";
7
8 src = fetchurl {
9 url = "mirror://sourceforge/gnucobol/${lib.versions.majorMinor version}/gnucobol-${version}.tar.xz";
10 sha256 = "0x15ybfm63g7c9340fc6712h9v59spnbyaz4rf85pmnp3zbhaw2r";
11 };
12
13 nativeBuildInputs = [ makeWrapper ];
14
15 buildInputs = [ db gmp ncurses ];
16
17 cflags = lib.concatMapStringsSep " " (p: "-L" + (lib.getLib p) + "/lib ") buildInputs;
18 ldflags = lib.concatMapStringsSep " " (p: "-I" + (lib.getDev p) + "/include ") buildInputs;
19
20 cobolCCFlags = "-I$out/include ${ldflags} -L$out/lib ${cflags}";
21
22 postInstall = with lib; ''
23 wrapProgram "$out/bin/cobc" \
24 --set COB_CC "${gcc}/bin/gcc" \
25 --prefix COB_LDFLAGS " " "${cobolCCFlags}" \
26 --prefix COB_CFLAGS " " "${cobolCCFlags}"
27 '';
28
29 meta = with lib; {
30 description = "An open-source COBOL compiler";
31 homepage = "https://sourceforge.net/projects/gnucobol/";
32 license = with licenses; [ gpl3Only lgpl3Only ];
33 maintainers = with maintainers; [ ericsagnes ];
34 platforms = platforms.all;
35 };
36}