2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, fetchzip, which, ocaml, ocamlbuild }:
|
2016-10-08 06:45:59 +00:00
|
|
|
|
2022-07-18 11:29:23 +00:00
|
|
|
if lib.versionAtLeast ocaml.version "4.15"
|
2019-10-18 06:20:17 +00:00
|
|
|
then throw "camlp4 is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
2016-10-08 06:45:59 +00:00
|
|
|
let param = {
|
2017-03-04 06:51:24 +00:00
|
|
|
"4.02" = {
|
2016-10-08 06:45:59 +00:00
|
|
|
version = "4.02+6";
|
|
|
|
sha256 = "06yl4q0qazl7g25b0axd1gdkfd4qpqzs1gr5fkvmkrcbz113h1hj"; };
|
2017-03-04 06:51:24 +00:00
|
|
|
"4.03" = {
|
2016-10-08 06:45:59 +00:00
|
|
|
version = "4.03+1";
|
|
|
|
sha256 = "1f2ndch6f1m4fgnxsjb94qbpwjnjgdlya6pard44y6n0dqxi1wsq"; };
|
2017-03-04 06:51:24 +00:00
|
|
|
"4.04" = {
|
2016-11-09 13:00:43 +00:00
|
|
|
version = "4.04+1";
|
|
|
|
sha256 = "1ad7rygqjxrc1im95gw9lp8q83nhdaf383f2808f1p63yl42xm7k"; };
|
2017-03-04 06:51:24 +00:00
|
|
|
"4.05" = {
|
|
|
|
version = "4.05+1";
|
|
|
|
sha256 = "0wm795hpwvwpib9c9z6p8kw2fh7p7b2hml6g15z8zry3y7w738sv"; };
|
2017-10-13 16:46:21 +00:00
|
|
|
"4.06" = {
|
|
|
|
version = "4.06+1";
|
|
|
|
sha256 = "0fazfw2l7wdmbwnqc22xby5n4ri1wz27lw9pfzhsbcdrighykysf"; };
|
2018-07-31 21:22:15 +00:00
|
|
|
"4.07" = {
|
|
|
|
version = "4.07+1";
|
|
|
|
sha256 = "0cxl4hkqcvspvkx4f2k83217rh6051fll9i2yz7cw6m3bq57mdvl"; };
|
2019-08-09 06:40:59 +00:00
|
|
|
"4.08" = {
|
|
|
|
version = "4.08+1";
|
|
|
|
sha256 = "0qplawvxwai25bi27niw2cgz2al01kcnkj8wxwhxslpi21z6pyx1"; };
|
2021-11-26 04:06:25 +00:00
|
|
|
"4.09" = {
|
|
|
|
version = "4.09+1";
|
|
|
|
sha256 = "1gr33x6xs1rs0bpyq4vzyfxd6vn47jfkg8imi81db2r0cbs0kxx1"; };
|
|
|
|
"4.10" = {
|
|
|
|
version = "4.10+1";
|
|
|
|
sha256 = "093bc1c28wid5li0jwglnd4p3csxw09fmbs9ffybq2z41a5mgay6"; };
|
|
|
|
"4.11" = {
|
|
|
|
version = "4.11+1";
|
|
|
|
sha256 = "0sn7f6im940qh0ixmx1k738xrwwdvy9g7r19bv5218jb6mh0g068"; };
|
|
|
|
"4.12" = {
|
|
|
|
version = "4.12+1";
|
|
|
|
sha256 = "1cfk5ppnd511vzsr9gc0grxbafmh0m3m897aij198rppzxps5kyz"; };
|
|
|
|
"4.13" = {
|
|
|
|
version = "4.13+1";
|
|
|
|
sha256 = "0fzxa1zdhk74mlxpin7p90flks6sp4gkc0mfclmj9zak15rii55n"; };
|
2022-07-18 11:29:23 +00:00
|
|
|
"4.14" = {
|
|
|
|
version = "4.14+1";
|
|
|
|
sha256 = "sha256-cPN3GioZT/Zt6uzbjGUPEGVJcPQdsAnCkU/AQoPfvuo="; };
|
2019-08-13 21:52:01 +00:00
|
|
|
}.${ocaml.meta.branch};
|
2016-10-08 06:45:59 +00:00
|
|
|
in
|
2014-09-22 22:24:28 +00:00
|
|
|
|
2016-10-05 07:32:30 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "camlp4";
|
2016-10-08 06:45:59 +00:00
|
|
|
inherit (param) version;
|
2016-10-05 07:32:30 +00:00
|
|
|
|
2015-07-28 15:30:40 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/ocaml/camlp4/archive/${version}.tar.gz";
|
2016-10-08 06:45:59 +00:00
|
|
|
inherit (param) sha256;
|
2014-09-22 22:24:28 +00:00
|
|
|
};
|
|
|
|
|
2022-03-01 15:42:22 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which ocaml ocamlbuild ];
|
2014-09-22 22:24:28 +00:00
|
|
|
|
2022-02-02 11:14:36 +00:00
|
|
|
# build fails otherwise
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2014-09-22 22:24:28 +00:00
|
|
|
dontAddPrefix = true;
|
|
|
|
|
|
|
|
preConfigure = ''
|
2020-07-17 14:01:33 +00:00
|
|
|
# increase stack space for spacetime variant of the compiler
|
|
|
|
# https://github.com/ocaml/ocaml/issues/7435
|
|
|
|
# but disallowed by darwin sandbox
|
|
|
|
ulimit -s unlimited || true
|
|
|
|
|
2014-09-22 22:24:28 +00:00
|
|
|
configureFlagsArray=(
|
|
|
|
--bindir=$out/bin
|
2016-10-05 07:32:30 +00:00
|
|
|
--libdir=$out/lib/ocaml/${ocaml.version}/site-lib
|
|
|
|
--pkgdir=$out/lib/ocaml/${ocaml.version}/site-lib
|
2014-09-22 22:24:28 +00:00
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
substituteInPlace camlp4/META.in \
|
2016-10-05 07:32:30 +00:00
|
|
|
--replace +camlp4 $out/lib/ocaml/${ocaml.version}/site-lib/camlp4
|
2014-09-22 22:24:28 +00:00
|
|
|
'';
|
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
makeFlags = [ "all" ];
|
2014-09-22 22:24:28 +00:00
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
installTargets = [ "install" "install-META" ];
|
2014-09-22 22:24:28 +00:00
|
|
|
|
2017-02-26 20:18:02 +00:00
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2014-09-22 22:24:28 +00:00
|
|
|
description = "A software system for writing extensible parsers for programming languages";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/ocaml/camlp4";
|
2015-12-24 17:49:07 +00:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2014-09-22 22:24:28 +00:00
|
|
|
};
|
|
|
|
}
|