Unverified Commit e9fc04cf authored by Vincent Laporte's avatar Vincent Laporte
Browse files

ocamlPackages.camlp5: 8.03.2 → 8.04.00

parent 4e6b4100
Loading
Loading
Loading
Loading
+67 −76
Original line number Diff line number Diff line
@@ -14,66 +14,50 @@
  legacy ? false,
}:

if lib.versionOlder ocaml.version "4.02" then
  throw "camlp5 is not available for OCaml ${ocaml.version}"
else

stdenv.mkDerivation (
  finalAttrs:
  let
    params =
      if lib.versionAtLeast ocaml.version "4.12" && !legacy then
        rec {
          version = "8.03.02";
    recent = lib.versionAtLeast (lib.versions.major finalAttrs.version) "8";
  in
  {

    version = if lib.versionAtLeast ocaml.version "4.12" && !legacy then "8.04.00" else "7.14";

    pname = "ocaml${ocaml.version}-camlp5";

    src = fetchFromGitHub {
      owner = "camlp5";
      repo = "camlp5";
            rev = version;
            hash = "sha256-nz+VfGR/6FdBvMzPPpVpviAXXBWNqM3Ora96Yzx964o=";
      tag =
        if recent then
          finalAttrs.version
        else
          "rel${builtins.replaceStrings [ "." ] [ "" ] finalAttrs.version}";
      hash =
        {
          "8.04.00" = "sha256-5IQVGm/tqEzXmZmSYGbGqX+KN9nQLQgw+sBP+F2keXo=";
          "8.03.2" = "sha256-nz+VfGR/6FdBvMzPPpVpviAXXBWNqM3Ora96Yzx964o=";
          "7.14" = "sha256-/ORtS0uc/GN+g3y6N5ftjL4OBSqV6iswLRbfpeNCprU=";
        }
        ."${finalAttrs.version}";
    };

    nativeBuildInputs = [
            makeWrapper
      ocaml
            findlib
      perl
    ]
    ++ lib.optionals recent [
      makeWrapper
      findlib
    ];
          buildInputs = [

    buildInputs = lib.optionals recent [
      bos
      pcre2
      re
      rresult
    ];
          propagatedBuildInputs = [ camlp-streams ];
          postInstall = ''
            for prog in camlp5 camlp5o camlp5r camlp5sch mkcamlp5 ocpp5
            do
              wrapProgram $out/bin/$prog \
                --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH"
            done
          '';

        }
      else
        rec {
          version = "7.14";
          src = fetchFromGitHub {
            owner = "camlp5";
            repo = "camlp5";
            rev = "rel${builtins.replaceStrings [ "." ] [ "" ] version}";
            sha256 = "1dd68bisbpqn5lq2pslm582hxglcxnbkgfkwhdz67z4w9d5nvr7w";
          };
          nativeBuildInputs = [
            ocaml
            perl
          ];
        };
  in

  stdenv.mkDerivation (
    params
    // {

      pname = "ocaml${ocaml.version}-camlp5";
    propagatedBuildInputs = lib.optional recent camlp-streams;

    strictDeps = true;

@@ -81,25 +65,32 @@ else

    preConfigure = ''
      configureFlagsArray=(--strict --libdir $out/lib/ocaml/${ocaml.version}/site-lib)
        patchShebangs ./config/find_stuffversion.pl etc/META.pl
      patchShebangs ./config/find_stuffversion.pl etc/META.pl tools/ ocaml_src/tools/
    '';

    buildFlags = [ "world.opt" ];

    postInstall = lib.optionalString recent ''
      for prog in camlp5 camlp5o camlp5r camlp5sch mkcamlp5 ocpp5
      do
        wrapProgram $out/bin/$prog \
          --prefix CAML_LD_LIBRARY_PATH : "$CAML_LD_LIBRARY_PATH"
      done
    '';
    dontStrip = true;

      meta = with lib; {
    meta = {
      broken =
        lib.versionAtLeast ocaml.version "5.04" && !lib.versionAtLeast finalAttrs.version "8.04.00";
      description = "Preprocessor-pretty-printer for OCaml";
      longDescription = ''
        Camlp5 is a preprocessor and pretty-printer for OCaml programs.
        It also provides parsing and printing tools.
      '';
      homepage = "https://camlp5.github.io/";
        license = licenses.bsd3;
      license = lib.licenses.bsd3;
      platforms = ocaml.meta.platforms or [ ];
        maintainers = with maintainers; [
          vbgl
        ];
      maintainers = [ lib.maintainers.vbgl ];
    };
  }
)
+10 −1
Original line number Diff line number Diff line
@@ -2245,7 +2245,16 @@ let

        google-drive-ocamlfuse = callPackage ../applications/networking/google-drive-ocamlfuse { };

        hol_light = callPackage ../applications/science/logic/hol_light { };
        hol_light = callPackage ../applications/science/logic/hol_light {
          camlp5 =
            if lib.versionAtLeast camlp5.version "8.04.00" then
              camlp5.overrideAttrs {
                version = "8.03.2";
                __intentionallyOverridingVersion = true;
              }
            else
              camlp5;
        };

        ### End ###