Unverified Commit 825d0a38 authored by Bernardo Meurer's avatar Bernardo Meurer Committed by GitHub
Browse files

gnu-cobol: move to pkgs/by-name, rename to gnucobol, nixfmt, add NIST test suite (#341303)

parents 1b9ca99f 621a378c
Loading
Loading
Loading
Loading
+148 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchurl
, autoconf269
, automake
, libtool
, pkg-config
{
  lib,
  stdenv,
  fetchurl,
  autoconf269,
  automake,
  libtool,
  pkg-config,
  # libs
, cjson
, db
, gmp
, libxml2
, ncurses
  cjson,
  db,
  gmp,
  libxml2,
  ncurses,
  # docs
, help2man
, texinfo
, texliveBasic
  help2man,
  texinfo,
  texliveBasic,
  # test
  perl,
}:

stdenv.mkDerivation rec {
  pname = "gnu-cobol";
let
  nistTestSuite = fetchurl {
    # Used to check GnuCOBOL with the NIST test suite
    url = "mirror://sourceforge/gnucobol/newcob.val.tar.gz";
    hash = "sha256-5FE/JqmziRH3v4gv49MzmoC0XKvCyvheswVbD1zofuA=";
  };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "gnucobol";
  version = "3.2";

  src = fetchurl {
    url = "mirror://sourceforge/gnucobol/${lib.versions.majorMinor version}/gnucobol-${version}.tar.xz";
    url = "mirror://gnu/gnucobol/gnucobol-${finalAttrs.version}.tar.xz";
    hash = "sha256-O7SK9GztR3n6z0H9wu5g5My4bqqZ0BCzZoUxXfOcLuI=";
  };

@@ -31,8 +39,9 @@ stdenv.mkDerivation rec {
    pkg-config
    autoconf269
    automake
    libtool
    help2man
    libtool
    perl
    texinfo
    texliveBasic
  ];
@@ -45,7 +54,12 @@ stdenv.mkDerivation rec {
    ncurses
  ];

  outputs = [ "bin" "dev" "lib" "out" ];
  outputs = [
    "bin"
    "dev"
    "lib"
    "out"
  ];
  # XXX: Without this, we get a cycle between bin and dev
  propagatedBuildOutputs = [ ];

@@ -53,17 +67,19 @@ stdenv.mkDerivation rec {
  postPatch = ''
    sed -i '/^AT_CHECK.*crud\.cob/i AT_SKIP_IF([true])' tests/testsuite.src/listings.at
    # upstream reports the following tests as known failures
    # test 843:
    sed -i '14180i\AT_SKIP_IF([true])' tests/testsuite.src/run_misc.at
    # test 875:
    sed -i '2894s/^/AT_SKIP_IF([true])/' tests/testsuite.src/run_file.at
    # test 843 (runtime check: write to internal storage (1))
    sed -i "/^843;/d" tests/testsuite
    # test 875 (INDEXED sample)
    sed -i "/^875;/d" tests/testsuite
  '';

  preConfigure = ''
  preConfigure =
    ''
      autoconf
      aclocal
      automake
  '' + lib.optionalString stdenv.isDarwin ''
    ''
    + lib.optionalString stdenv.isDarwin ''
      # when building with nix on darwin, configure will use GNU strip,
      # which fails due to using --strip-unneeded, which is not supported
      substituteInPlace configure --replace-fail '"GNU strip"' 'FAKE GNU strip'
@@ -75,7 +91,11 @@ stdenv.mkDerivation rec {

  enableParallelBuilding = true;

  installFlags = [ "install-pdf" "install-html" "localedir=$out/share/locale" ];
  installFlags = [
    "install-pdf"
    "install-html"
    "localedir=$out/share/locale"
  ];

  # Tests must run after install.
  doCheck = false;
@@ -87,6 +107,10 @@ stdenv.mkDerivation rec {
    # Run tests
    TESTSUITEFLAGS="--jobs=$NIX_BUILD_CORES" make check

    # Run NIST tests
    cp -v ${nistTestSuite} ./tests/cobol85/newcob.val.tar.gz
    TESTSUITEFLAGS="--jobs=$NIX_BUILD_CORES" make test

    # Sanity check
    message="Hello, COBOL!"
    # XXX: Don't for a second think you can just get rid of these spaces, they
@@ -107,10 +131,18 @@ stdenv.mkDerivation rec {
  '';

  meta = with lib; {
    description = "Open-source COBOL compiler";
    homepage = "https://sourceforge.net/projects/gnucobol/";
    license = with licenses; [ gpl3Only lgpl3Only ];
    maintainers = with maintainers; [ ericsagnes lovesegfault techknowlogick ];
    description = "Free/libre COBOL compiler";
    homepage = "https://gnu.org/software/gnucobol/";
    license = with licenses; [
      gpl3Only
      lgpl3Only
    ];
    maintainers = with maintainers; [
      ericsagnes
      lovesegfault
      techknowlogick
      kiike
    ];
    platforms = platforms.all;
  };
}
})
+1 −0
Original line number Diff line number Diff line
@@ -532,6 +532,7 @@ mapAliases ({
  gmpc = throw "'gmpc' has been removed due to lack of maintenance upstream. Consider using 'plattenalbum' instead"; # Added 2024-09-14
  gmtk = throw "'gmtk' has been removed due to lack of maintenance upstream"; # Added 2024-09-14
  gmtp = throw "'gmtp' has been removed due to lack of maintenance upstream. Consider using 'gnome-music' instead"; # Added 2024-09-14
  gnu-cobol = gnucobol; # Added 2024-09-17
  go-dependency-manager = throw "'go-dependency-manager' is unmaintained and the go community now uses 'go.mod' mostly instead"; # Added 2023-10-04
  gotktrix = throw "'gotktrix' has been removed, as it was broken and unmaintained"; # Added 2023-12-06
  git-backup = throw "git-backup has been removed, as it has been abandoned upstream. Consider using git-backup-go instead.";
+0 −2
Original line number Diff line number Diff line
@@ -8040,8 +8040,6 @@ with pkgs;
  gnu-cim = callPackage ../development/compilers/gnu-cim { };
  gnu-cobol = callPackage ../development/compilers/gnu-cobol { };
  gnuclad = callPackage ../applications/graphics/gnuclad { };
  gnufdisk = callPackage ../tools/system/fdisk {