nixpkgs/pkgs/development/tools/ocaml/camlp5/default.nix
Matthias J. Kannwischer 74a82ccd8e camlp5: propagate findlib deps pcre2 and fmt
camlp5's META requires pcre2 and fmt, but they were only buildInputs, so
findlib consumers of camlp5 could not resolve them. Move them to
propagatedBuildInputs.
2026-05-30 22:17:28 +08:00

99 lines
2.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
ocaml,
findlib,
perl,
makeWrapper,
rresult,
bos,
fmt,
pcre2,
re,
camlp-streams,
legacy ? false,
}:
stdenv.mkDerivation (
finalAttrs:
let
recent = lib.versionAtLeast (lib.versions.major finalAttrs.version) "8";
in
{
version = if lib.versionAtLeast ocaml.version "4.12" && !legacy then "8.05.01" else "7.14";
pname = "ocaml${ocaml.version}-camlp5";
src = fetchFromGitHub {
owner = "camlp5";
repo = "camlp5";
tag =
if recent then
finalAttrs.version
else
"rel${builtins.replaceStrings [ "." ] [ "" ] finalAttrs.version}";
hash =
{
"8.05.01" = "sha256-ym1cZIoAIwMnkGiygZf+TZxjhyO6WHYItWRXobdcKm0=";
"8.03.2" = "sha256-nz+VfGR/6FdBvMzPPpVpviAXXBWNqM3Ora96Yzx964o=";
"7.14" = "sha256-/ORtS0uc/GN+g3y6N5ftjL4OBSqV6iswLRbfpeNCprU=";
}
."${finalAttrs.version}";
};
nativeBuildInputs = [
ocaml
perl
]
++ lib.optionals recent [
makeWrapper
findlib
];
buildInputs = lib.optionals recent [
bos
re
rresult
];
propagatedBuildInputs = lib.optionals recent [
camlp-streams
pcre2
fmt
];
strictDeps = true;
prefixKey = "-prefix ";
preConfigure = ''
configureFlagsArray=(--strict --libdir $out/lib/ocaml/${ocaml.version}/site-lib)
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 = {
broken = lib.versionAtLeast ocaml.version "5.4" && !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 = lib.licenses.bsd3;
platforms = ocaml.meta.platforms or [ ];
maintainers = [ lib.maintainers.vbgl ];
};
}
)