nixpkgs/pkgs/development/tools/ocaml/camlp4/default.nix

75 lines
2.0 KiB
Nix
Raw Normal View History

2016-10-08 07:45:59 +01:00
{ stdenv, fetchzip, which, ocaml, ocamlbuild }:
if stdenv.lib.versionAtLeast ocaml.version "4.09"
then throw "camlp4 is not available for OCaml ${ocaml.version}"
else
2016-10-08 07:45:59 +01:00
let param = {
2017-03-04 06:51:24 +00:00
"4.02" = {
2016-10-08 07:45:59 +01:00
version = "4.02+6";
sha256 = "06yl4q0qazl7g25b0axd1gdkfd4qpqzs1gr5fkvmkrcbz113h1hj"; };
2017-03-04 06:51:24 +00:00
"4.03" = {
2016-10-08 07:45:59 +01: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 17:46:21 +01:00
"4.06" = {
version = "4.06+1";
sha256 = "0fazfw2l7wdmbwnqc22xby5n4ri1wz27lw9pfzhsbcdrighykysf"; };
2018-07-31 22:22:15 +01:00
"4.07" = {
version = "4.07+1";
sha256 = "0cxl4hkqcvspvkx4f2k83217rh6051fll9i2yz7cw6m3bq57mdvl"; };
"4.08" = {
version = "4.08+1";
sha256 = "0qplawvxwai25bi27niw2cgz2al01kcnkj8wxwhxslpi21z6pyx1"; };
2019-08-13 22:52:01 +01:00
}.${ocaml.meta.branch};
2016-10-08 07:45:59 +01:00
in
2016-10-05 08:32:30 +01:00
stdenv.mkDerivation rec {
pname = "camlp4";
2016-10-08 07:45:59 +01:00
inherit (param) version;
2016-10-05 08:32:30 +01:00
src = fetchzip {
url = "https://github.com/ocaml/camlp4/archive/${version}.tar.gz";
2016-10-08 07:45:59 +01:00
inherit (param) sha256;
};
2016-10-08 07:45:59 +01:00
buildInputs = [ which ocaml ocamlbuild ];
dontAddPrefix = true;
preConfigure = ''
2020-07-17 15:01:33 +01: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
configureFlagsArray=(
--bindir=$out/bin
2016-10-05 08:32:30 +01:00
--libdir=$out/lib/ocaml/${ocaml.version}/site-lib
--pkgdir=$out/lib/ocaml/${ocaml.version}/site-lib
)
'';
postConfigure = ''
substituteInPlace camlp4/META.in \
2016-10-05 08:32:30 +01:00
--replace +camlp4 $out/lib/ocaml/${ocaml.version}/site-lib/camlp4
'';
makeFlags = [ "all" ];
installTargets = [ "install" "install-META" ];
dontStrip = true;
meta = with stdenv.lib; {
description = "A software system for writing extensible parsers for programming languages";
homepage = "https://github.com/ocaml/camlp4";
platforms = ocaml.meta.platforms or [];
};
}