ocamlPackages.pprint: 20171003 → 20220103

This commit is contained in:
Vincent Laporte 2022-02-08 09:53:11 +01:00 committed by Vincent Laporte
parent e61b18babd
commit 7c09dc2d8a
4 changed files with 43 additions and 30 deletions

View File

@ -28,6 +28,10 @@ stdenv.mkDerivation {
prePatch = lib.optionalString (check-ocaml-version "4.02") ''
substituteInPlace myocamlbuild.pre.ml \
--replace '@1..3' '@1..2+3'
''
# Compatibility with PPrint ≥ 20220103
+ ''
substituteInPlace typing/Fact.ml --replace PPrintOCaml PPrint.OCaml
'';
createFindlibDestdir = true;

View File

@ -14,7 +14,10 @@ buildDunePackage rec {
sha256 = "0wjfc9irvirfkic32ivvj6qb7r838w08b0d3vmngigbjpjyc9b14";
};
minimumOCamlVersion = "4.08";
minimalOCamlVersion = "4.08";
# Fix tests with pprint ≥ 20220103
patches = [ ./pprint.patch ];
# disable xmldiff tests, so we don't need to package unmaintained and legacy pkgs
postPatch = "rm -rf examples/xmldiff";

View File

@ -0,0 +1,22 @@
commit 77b5e54d33a66445f45ddc48577d835207be8cef
Author: Stephen Dolan <stephen.dolan@cl.cam.ac.uk>
Date: Fri Jun 12 19:34:51 2020 +0100
Unbreak small example logic
diff --git a/examples/pprint/test_pprint.ml b/examples/pprint/test_pprint.ml
index 77789ef..44124e7 100644
--- a/examples/pprint/test_pprint.ml
+++ b/examples/pprint/test_pprint.ml
@@ -1,9 +1,9 @@
-open Crowbar
open PPrint
+open Crowbar
type t = (string * PPrint.document)
let doc = fix (fun doc -> choose [
const ("", empty);
- const ("a", char 'a');
+ const ("a", PPrint.char 'a');
const ("123", string "123");
const ("Hello", string "Hello");
const ("awordwhichisalittlebittoolong",

View File

@ -1,38 +1,22 @@
{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild }:
{ lib, fetchFromGitHub, buildDunePackage }:
assert lib.versionAtLeast (lib.getVersion ocaml) "3.12";
buildDunePackage rec {
pname = "pprint";
version = "20220103";
let param =
if lib.versionAtLeast ocaml.version "4.02"
then {
version = "20171003";
sha256 = "06zwsskri8kaqjdszj9360nf36zvwh886xwf033aija8c9k4w6cx";
} else {
version = "20140424";
sha256 = "0sc9q89dnyarcg24czyhr6ams0ylqvia3745s6rfwd2nldpygsdk";
}; in
useDune2 = true;
stdenv.mkDerivation {
name = "ocaml${ocaml.version}-pprint-${param.version}";
src = fetchurl {
url = "http://gallium.inria.fr/~fpottier/pprint/pprint-${param.version}.tar.gz";
inherit (param) sha256;
src = fetchFromGitHub {
owner = "fpottier";
repo = pname;
rev = version;
sha256 = "sha256:09y6nwnjldifm47406q1r9987njlk77g4ifqg6qs54dckhr64vax";
};
buildInputs = [ ocaml findlib ocamlbuild ];
createFindlibDestdir = true;
dontBuild = true;
installFlags = [ "-C" "src" ];
meta = with lib; {
homepage = "http://gallium.inria.fr/~fpottier/pprint/";
description = "An OCaml adaptation of Wadlers and Leijens prettier printer";
license = licenses.cecill-c;
inherit (src.meta) homepage;
description = "An OCaml library for pretty-printing textual documents";
license = licenses.lgpl2Only;
maintainers = [ maintainers.vbgl ];
platforms = ocaml.meta.platforms or [];
};
}