From d274ee3f80d0d32a227fbabbc2e2b92b115fd760 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Mon, 22 Sep 2014 23:24:28 +0100 Subject: [PATCH] Adds camlp4 Camlp4 is a software system for writing extensible parsers for programming languages. Camlp4 was part of the official OCaml distribution until its version 4.01.0. Homepage: https://github.com/ocaml/camlp4 --- .../ocaml-modules/camomile/0.8.2.nix | 4 +- .../ocaml-modules/camomile/default.nix | 4 +- .../ocaml-modules/extlib/default.nix | 4 +- .../ocaml-modules/javalib/default.nix | 4 +- .../ocaml-modules/lablgtk/default.nix | 4 +- .../ocaml-modules/ounit/default.nix | 4 +- .../ocaml-modules/sawja/default.nix | 4 +- .../ocaml-modules/typeconv/108.08.00.nix | 4 +- .../ocaml-modules/typeconv/default.nix | 4 +- .../tools/ocaml/camlp4/default.nix | 46 +++++++++++++++++++ .../tools/ocaml/ocamlify/default.nix | 4 +- .../tools/ocaml/ocamlmod/default.nix | 4 +- pkgs/top-level/all-packages.nix | 13 ++++-- 13 files changed, 78 insertions(+), 25 deletions(-) create mode 100644 pkgs/development/tools/ocaml/camlp4/default.nix diff --git a/pkgs/development/ocaml-modules/camomile/0.8.2.nix b/pkgs/development/ocaml-modules/camomile/0.8.2.nix index 674c6c0367b..adbdc936d1e 100644 --- a/pkgs/development/ocaml-modules/camomile/0.8.2.nix +++ b/pkgs/development/ocaml-modules/camomile/0.8.2.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib}: +{stdenv, fetchurl, ocaml, findlib, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -13,7 +13,7 @@ stdenv.mkDerivation { sha256 = "0x43pjxx70kgip86mmdn08s97k4qzdqc8i79xfyyx28smy1bsa00"; }; - buildInputs = [ocaml findlib]; + buildInputs = [ocaml findlib camlp4]; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/camomile/default.nix b/pkgs/development/ocaml-modules/camomile/default.nix index 332230615d1..ecdc5bef295 100644 --- a/pkgs/development/ocaml-modules/camomile/default.nix +++ b/pkgs/development/ocaml-modules/camomile/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib}: +{stdenv, fetchurl, ocaml, findlib, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -12,7 +12,7 @@ stdenv.mkDerivation { sha256 = "003ikpvpaliy5hblhckfmln34zqz0mk3y2m1fqvbjngh3h2np045"; }; - buildInputs = [ocaml findlib]; + buildInputs = [ocaml findlib camlp4]; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/extlib/default.nix b/pkgs/development/ocaml-modules/extlib/default.nix index 45a859c146f..9f5f8119fb6 100644 --- a/pkgs/development/ocaml-modules/extlib/default.nix +++ b/pkgs/development/ocaml-modules/extlib/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib, minimal ? true}: +{stdenv, fetchurl, ocaml, findlib, camlp4, minimal ? true}: assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "3.11"; @@ -10,7 +10,7 @@ stdenv.mkDerivation { sha256 = "1jmfj2w0f3ap0swz8k3qqmrl6x2y4gkmg88vv024xnmliiiv7m48"; }; - buildInputs = [ocaml findlib]; + buildInputs = [ocaml findlib camlp4]; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/javalib/default.nix b/pkgs/development/ocaml-modules/javalib/default.nix index fa55240caf2..7272e668aa2 100644 --- a/pkgs/development/ocaml-modules/javalib/default.nix +++ b/pkgs/development/ocaml-modules/javalib/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, which, ocaml, findlib, camlzip, extlib}: +{stdenv, fetchurl, which, ocaml, findlib, camlzip, extlib, camlp4}: let pname = "javalib"; version = "2.3"; @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { sha256 = "1i8djcanzm250mwilm3jfy37cz0k0x7jbnrz8a5vvdi91kyzh52j"; }; - buildInputs = [ which ocaml findlib camlzip extlib ]; + buildInputs = [ which ocaml findlib camlp4 ]; patches = [ ./configure.sh.patch ./Makefile.config.example.patch ]; diff --git a/pkgs/development/ocaml-modules/lablgtk/default.nix b/pkgs/development/ocaml-modules/lablgtk/default.nix index f303323b7c8..7499be9c5dd 100644 --- a/pkgs/development/ocaml-modules/lablgtk/default.nix +++ b/pkgs/development/ocaml-modules/lablgtk/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib, pkgconfig, gtk, libgnomecanvas, libglade, gtksourceview}: +{stdenv, fetchurl, ocaml, findlib, pkgconfig, gtk, libgnomecanvas, libglade, gtksourceview, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -15,7 +15,7 @@ stdenv.mkDerivation (rec { sha256 = "a0ea9752eb257dadcfc2914408fff339d4c34357802f02c63329dd41b777de2f"; }; - buildInputs = [ocaml findlib pkgconfig gtk libgnomecanvas libglade gtksourceview]; + buildInputs = [ocaml findlib pkgconfig gtk libgnomecanvas libglade gtksourceview camlp4]; configureFlags = "--with-libdir=$(out)/lib/ocaml/${ocaml_version}/site-lib"; buildFlags = "world"; diff --git a/pkgs/development/ocaml-modules/ounit/default.nix b/pkgs/development/ocaml-modules/ounit/default.nix index 43ec474cf5e..5807ceb256b 100644 --- a/pkgs/development/ocaml-modules/ounit/default.nix +++ b/pkgs/development/ocaml-modules/ounit/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib}: +{stdenv, fetchurl, ocaml, findlib, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -12,7 +12,7 @@ stdenv.mkDerivation { sha256 = "1qw8k2czy0bxhsf25kfpgywhpqmg7bi57rmyhlnmbddmvc61pg76"; }; - buildInputs = [ocaml findlib]; + buildInputs = [ocaml findlib camlp4]; dontAddPrefix = true; diff --git a/pkgs/development/ocaml-modules/sawja/default.nix b/pkgs/development/ocaml-modules/sawja/default.nix index a464f93f65c..534a7684cec 100644 --- a/pkgs/development/ocaml-modules/sawja/default.nix +++ b/pkgs/development/ocaml-modules/sawja/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, which, perl, ocaml, findlib, javalib }: +{stdenv, fetchurl, which, perl, ocaml, findlib, javalib, camlp4 }: assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "3.12"; @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { sha256 = "0i8qgqkw9vgj6k2g6npss268ivxdkzx5qj2a52jbd8ih59rn68cm"; }; - buildInputs = [ which perl ocaml findlib javalib ]; + buildInputs = [ which perl ocaml findlib camlp4 ]; patches = [ ./configure.sh.patch ./Makefile.config.example.patch ]; diff --git a/pkgs/development/ocaml-modules/typeconv/108.08.00.nix b/pkgs/development/ocaml-modules/typeconv/108.08.00.nix index 30ced37efe5..805a8926e18 100644 --- a/pkgs/development/ocaml-modules/typeconv/108.08.00.nix +++ b/pkgs/development/ocaml-modules/typeconv/108.08.00.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib}: +{stdenv, fetchurl, ocaml, findlib, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -14,7 +14,7 @@ stdenv.mkDerivation { sha256 = "08ysikwwp69zvc147lzzg79nwlrzrk738rj0ggcfadi8h5il42sl"; }; - buildInputs = [ocaml findlib]; + buildInputs = [ocaml findlib camlp4]; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/typeconv/default.nix b/pkgs/development/ocaml-modules/typeconv/default.nix index 3f9ce37bc89..359f906ce34 100644 --- a/pkgs/development/ocaml-modules/typeconv/default.nix +++ b/pkgs/development/ocaml-modules/typeconv/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib}: +{stdenv, fetchurl, ocaml, findlib, camlp4}: let ocaml_version = (builtins.parseDrvName ocaml.name).version; @@ -14,7 +14,7 @@ stdenv.mkDerivation { sha256 = "0lpxri68glgq1z2pp02rp45cb909xywbff8d4idljrf6fzzil2zx"; }; - buildInputs = [ocaml findlib ]; + buildInputs = [ocaml findlib camlp4]; createFindlibDestdir = true; diff --git a/pkgs/development/tools/ocaml/camlp4/default.nix b/pkgs/development/tools/ocaml/camlp4/default.nix new file mode 100644 index 00000000000..bd2466c8854 --- /dev/null +++ b/pkgs/development/tools/ocaml/camlp4/default.nix @@ -0,0 +1,46 @@ +{stdenv, fetchurl, which, ocaml}: +let + ocaml_version = (stdenv.lib.getVersion ocaml); +in + +assert stdenv.lib.versionAtLeast ocaml_version "4.02"; + +stdenv.mkDerivation { + name = "camlp4-4.02.0+1"; + src = fetchurl { + url = https://github.com/ocaml/camlp4/archive/4.02.0+1.tar.gz; + sha256 = "0055f4jiz82rgn581xhq3mr4qgq2qgdxqppmp8i2x1xnsim4h9pn"; + }; + + buildInputs = [ which ocaml ]; + + dontAddPrefix = true; + + preConfigure = '' + configureFlagsArray=( + --bindir=$out/bin + --libdir=$out/lib/ocaml/${ocaml_version}/site-lib + --pkgdir=$out/lib/ocaml/${ocaml_version}/site-lib + ) + ''; + + postConfigure = '' + substituteInPlace camlp4/META.in \ + --replace +camlp4 $out/lib/ocaml/${ocaml_version}/site-lib/camlp4 + substituteInPlace camlp4/config/Camlp4_config.ml \ + --replace \ + "Filename.concat ocaml_standard_library" \ + "Filename.concat \"$out/lib/ocaml/${ocaml_version}/site-lib\"" + ''; + + + makePhase = "make all"; + + installTargets = "install install-META"; + + 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; + }; +} diff --git a/pkgs/development/tools/ocaml/ocamlify/default.nix b/pkgs/development/tools/ocaml/ocamlify/default.nix index 88b7451e0f0..0a402d4ba46 100644 --- a/pkgs/development/tools/ocaml/ocamlify/default.nix +++ b/pkgs/development/tools/ocaml/ocamlify/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib, ounit}: +{stdenv, fetchurl, ocaml, findlib}: stdenv.mkDerivation { name = "ocamlify-0.0.2"; @@ -8,7 +8,7 @@ stdenv.mkDerivation { sha256 = "1f0fghvlbfryf5h3j4as7vcqrgfjb4c8abl5y0y5h069vs4kp5ii"; }; - buildInputs = [ocaml findlib ounit]; + buildInputs = [ocaml findlib]; configurePhase = "ocaml setup.ml -configure --prefix $out"; buildPhase = "ocaml setup.ml -build"; diff --git a/pkgs/development/tools/ocaml/ocamlmod/default.nix b/pkgs/development/tools/ocaml/ocamlmod/default.nix index d72df18f899..65359049a96 100644 --- a/pkgs/development/tools/ocaml/ocamlmod/default.nix +++ b/pkgs/development/tools/ocaml/ocamlmod/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib, ounit}: +{stdenv, fetchurl, ocaml, findlib}: stdenv.mkDerivation { name = "ocamlmod-0.0.7"; @@ -8,7 +8,7 @@ stdenv.mkDerivation { sha256 = "11kg7wh0gy492ma5c6bcjh6frv1a9lh9f26hiys2i0d1ky8s0ad3"; }; - buildInputs = [ocaml findlib ounit]; + buildInputs = [ocaml findlib]; configurePhase = "ocaml setup.ml -configure --prefix $out"; buildPhase = "ocaml setup.ml -build"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fce0b55a92d..9b85936661e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3351,6 +3351,11 @@ let camlidl = callPackage ../development/tools/ocaml/camlidl { }; + camlp4 = + if lib.versionOlder "4.02" ocaml_version + then callPackage ../development/tools/ocaml/camlp4 { } + else null; + camlp5_old_strict = if lib.versionOlder "4.00" ocaml_version then camlp5_6_strict @@ -3566,7 +3571,9 @@ let opa = let callPackage = newScope pkgs.ocamlPackages_4_00_1; in callPackage ../development/compilers/opa { }; opam_1_0_0 = callPackage ../development/tools/ocaml/opam/1.0.0.nix { }; - opam_1_1 = callPackage ../development/tools/ocaml/opam/1.1.nix { }; + opam_1_1 = callPackage ../development/tools/ocaml/opam/1.1.nix { + inherit (ocamlPackages_4_01_0) ocaml; + }; opam = opam_1_1; ocamlnat = let callPackage = newScope pkgs.ocamlPackages_3_12_1; in callPackage ../development/ocaml-modules/ocamlnat { }; @@ -11372,8 +11379,8 @@ let alt-ergo = callPackage ../applications/science/logic/alt-ergo {}; coq = callPackage ../applications/science/logic/coq { - inherit (ocamlPackages) findlib lablgtk; - camlp5 = ocamlPackages.camlp5_transitional; + inherit (ocamlPackages_4_01_0) ocaml findlib lablgtk; + camlp5 = ocamlPackages_4_01_0.camlp5_transitional; }; coq_HEAD = callPackage ../applications/science/logic/coq/HEAD.nix {