Merge pull request #222143 from vbgl/ocaml-csv-cleanup

ocamlPackages.csv: fix for OCaml ≥ 5.0
This commit is contained in:
superherointj 2023-03-20 10:16:35 -03:00 committed by GitHub
commit 8c9e49ab50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 52 deletions

View file

@ -1,38 +0,0 @@
{ lib, stdenv, fetchzip, ocaml, findlib, ocamlbuild }:
stdenv.mkDerivation rec {
pname = "ocaml${ocaml.version}-csv";
version = "1.5";
src = fetchzip {
url = "https://github.com/Chris00/ocaml-csv/releases/download/${version}/csv-${version}.tar.gz";
sha256 = "1ca7jgg58j24pccs5fshis726s06fdcjshnwza5kwxpjgdbvc63g";
};
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
strictDeps = true;
createFindlibDestdir = true;
configurePhase = "ocaml setup.ml -configure --prefix $out --enable-tests";
buildPhase = "ocaml setup.ml -build";
doCheck = true;
checkPhase = "ocaml setup.ml -test";
installPhase = ''
runHook preInstall
ocaml setup.ml -install
runHook postInstall
'';
meta = with lib; {
description = "A pure OCaml library to read and write CSV files";
homepage = "https://github.com/Chris00/ocaml-csv";
license = licenses.lgpl21;
maintainers = [ maintainers.vbgl ];
inherit (ocaml.meta) platforms;
};
}

View file

@ -4,7 +4,9 @@ let inherit (ocamlPackages) buildDunePackage csv uutf; in
buildDunePackage {
pname = "csvtool";
inherit (csv) src version useDune2;
inherit (csv) src version;
duneVersion = "3";
buildInputs = [ csv uutf ];

View file

@ -9,7 +9,11 @@ buildDunePackage rec {
sha256 = "13m9n8mdss6jfbiw7d5bybxn4n85vmg4zw7dc968qrgjfy0w9zhk";
};
useDune2 = true;
preConfigure = ''
substituteInPlace src/dune --replace '(libraries bytes)' ""
'';
duneVersion = "3";
meta = {
description = "A pure OCaml library to read and write CSV files";

View file

@ -1,14 +1,16 @@
{ lib, buildDunePackage, ocaml, csv, ocaml_lwt }:
if lib.versionOlder ocaml.version "4.02"
then throw "csv-lwt is not available for OCaml ${ocaml.version}"
else
{ lib, buildDunePackage, csv, lwt }:
buildDunePackage {
pname = "csv-lwt";
inherit (csv) src version useDune2 meta;
inherit (csv) src version meta;
propagatedBuildInputs = [ csv ocaml_lwt ];
preConfigure = ''
substituteInPlace lwt/dune --replace '(libraries bytes' '(libraries '
'';
doCheck = lib.versionAtLeast ocaml.version "4.03";
duneVersion = "3";
propagatedBuildInputs = [ csv lwt ];
doCheck = true;
}

View file

@ -263,10 +263,7 @@ let
cstruct-unix = callPackage ../development/ocaml-modules/cstruct/unix.nix {};
csv =
if lib.versionAtLeast ocaml.version "4.2"
then callPackage ../development/ocaml-modules/csv { }
else callPackage ../development/ocaml-modules/csv/1.5.nix { };
csv = callPackage ../development/ocaml-modules/csv { };
csv-lwt = callPackage ../development/ocaml-modules/csv/lwt.nix { };