Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchurl 4, autoconf269 5, automake 6, libtool 7# libs 8, cjson 9, db 10, gmp 11, libxml2 12, ncurses 13# docs 14, help2man 15, texinfo 16, texlive 17# test 18, writeText 19}: 20 21stdenv.mkDerivation rec { 22 pname = "gnu-cobol"; 23 version = "3.1.2"; 24 25 src = fetchurl { 26 url = "mirror://sourceforge/gnucobol/${lib.versions.majorMinor version}/gnucobol-${version}.tar.xz"; 27 sha256 = "0x15ybfm63g7c9340fc6712h9v59spnbyaz4rf85pmnp3zbhaw2r"; 28 }; 29 30 nativeBuildInputs = [ 31 autoconf269 32 automake 33 libtool 34 help2man 35 texinfo 36 texlive.combined.scheme-basic 37 ]; 38 39 buildInputs = [ 40 cjson 41 db 42 gmp 43 libxml2 44 ncurses 45 ]; 46 47 outputs = [ "bin" "dev" "lib" "out" ]; 48 # XXX: Without this, we get a cycle between bin and dev 49 propagatedBuildOutputs = []; 50 51 # Skips a broken test 52 postPatch = '' 53 sed -i '/^AT_CHECK.*crud\.cob/i AT_SKIP_IF([true])' tests/testsuite.src/listings.at 54 ''; 55 56 preConfigure = '' 57 autoconf 58 aclocal 59 automake 60 ''; 61 62 enableParallelBuilding = true; 63 64 installFlags = [ "install-pdf" "install-html" "localedir=$out/share/locale" ]; 65 66 # Tests must run after install. 67 doCheck = false; 68 69 doInstallCheck = true; 70 installCheckPhase = '' 71 runHook preInstallCheck 72 73 # Run tests 74 make -j$NIX_BUILD_CORES check 75 76 # Sanity check 77 message="Hello, COBOL!" 78 # XXX: Don't for a second think you can just get rid of these spaces, they 79 # are load bearing. 80 tee hello.cbl <<EOF 81 IDENTIFICATION DIVISION. 82 PROGRAM-ID. HELLO. 83 84 PROCEDURE DIVISION. 85 DISPLAY "$message". 86 STOP RUN. 87 EOF 88 $bin/bin/cobc -x -o hello-cobol "hello.cbl" 89 hello="$(./hello-cobol | tee >(cat >&2))" 90 [[ "$hello" == "$message" ]] || exit 1 91 92 runHook postInstallCheck 93 ''; 94 95 meta = with lib; { 96 description = "An open-source COBOL compiler"; 97 homepage = "https://sourceforge.net/projects/gnucobol/"; 98 license = with licenses; [ gpl3Only lgpl3Only ]; 99 maintainers = with maintainers; [ ericsagnes lovesegfault ]; 100 platforms = platforms.all; 101 }; 102}