diff --git a/pkgs/development/tools/ocaml/ocp-build/default.nix b/pkgs/development/tools/ocaml/ocp-build/default.nix new file mode 100644 index 000000000000..4970d641643f --- /dev/null +++ b/pkgs/development/tools/ocaml/ocp-build/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchurl, ocaml, findlib, ncurses }: + +stdenv.mkDerivation { + + name = "ocp-build-1.99.8-beta"; + + src = fetchurl { + url = "https://github.com/OCamlPro/ocp-build/archive/ocp-build.1.99.8-beta.tar.gz"; + sha256 = "06qh8v7k5m52xbivas08lblspsnvdl0vd7ghfj6wvpnfl8qvqabn"; + }; + + buildInputs = [ ocaml findlib ncurses ]; + + patches = [ ./fix-for-no-term.patch ]; + + # In the Nix sandbox, the TERM variable is unset and stty does not + # work. In such a case, ocp-build crashes due to a bug. The + # ./fix-for-no-term.patch fixes this bug in the source code and hence + # also in the final installed version of ocp-build. However, it does not + # fix the bug in the precompiled bootstrap version of ocp-build that is + # used during the compilation process. In order to bypass the bug until + # it's also fixed upstream, we simply set TERM to some valid entry in the + # terminfo database during the bootstrap. + TERM = "xterm"; + + meta = with stdenv.lib; { + homepage = "http://typerex.ocamlpro.com/ocp-build.html"; + description = "A build tool for OCaml"; + longDescription = '' + ocp-build is a build system for OCaml application, based on simple + descriptions of packages. ocp-build combines the descriptions of + packages, and optimize the parallel compilation of files depending on + the number of cores and the automatically-infered dependencies + between source files. + ''; + license = licenses.gpl3; + platforms = ocaml.meta.platforms; + maintainers = [ maintainers.jirkamarsik ]; + }; +} diff --git a/pkgs/development/tools/ocaml/ocp-build/fix-for-no-term.patch b/pkgs/development/tools/ocaml/ocp-build/fix-for-no-term.patch new file mode 100644 index 000000000000..8ce83d095fb3 --- /dev/null +++ b/pkgs/development/tools/ocaml/ocp-build/fix-for-no-term.patch @@ -0,0 +1,11 @@ +--- ocp-build-ocp-build.1.99.8-beta/src/ocp-build/buildTerm.ml 2014-10-27 13:54:37.532023502 +0100 ++++ ocp-build-ocp-build.1.99.8-beta/src/ocp-build/buildTerm.ml.new 2014-10-27 13:54:43.397099033 +0100 +@@ -49,7 +49,7 @@ + | _ -> failwith "stty" + end + | _ -> raise Not_found +- with Unix.Unix_error _ | End_of_file | Failure _ -> ++ with Unix.Unix_error _ | End_of_file | Failure _ | Not_found -> + try + (* shell envvar *) + int_of_string (Sys.getenv "COLUMNS") diff --git a/pkgs/development/tools/ocaml/ocp-indent/default.nix b/pkgs/development/tools/ocaml/ocp-indent/default.nix new file mode 100644 index 000000000000..d50e003f8474 --- /dev/null +++ b/pkgs/development/tools/ocaml/ocp-indent/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchurl, ocaml, findlib, ocpBuild, opam, cmdliner }: + +let inherit (stdenv.lib) getVersion versionAtLeast; in + +assert versionAtLeast (getVersion ocaml) "3.12.1"; +assert versionAtLeast (getVersion ocpBuild) "1.99.3-beta"; + +stdenv.mkDerivation { + + name = "ocp-indent-1.4.2b"; + + src = fetchurl { + url = "https://github.com/OCamlPro/ocp-indent/archive/1.4.2b.tar.gz"; + sha256 = "1p0n2zcl5kf543x2xlqrz1aa51f0dqal8l392sa41j6wx82j0gpb"; + }; + + buildInputs = [ ocaml findlib ocpBuild opam cmdliner ]; + + createFindlibDestdir = true; + + # The supplied installer uses opam-installer which breaks when run + # normally since it tries to `mkdir $HOME`. However, we can use + # `opam-installer --script` to get the shell script that performs only + # the installation and just run that. Furthermore, we do the same that is + # done by pkgs/development/ocaml-modules/react and rename the paths meant + # for opam-installer so that they are in line with the other OCaml + # libraries in Nixpkgs. + installPhase = '' + opam-installer --script --prefix=$out ocp-indent.install \ + | sed s!lib/ocp-indent!lib/ocaml/${getVersion ocaml}/site-lib/ocp-indent! \ + | sh + ''; + + meta = with stdenv.lib; { + homepage = "http://typerex.ocamlpro.com/ocp-indent.html"; + description = "A customizable tool to indent OCaml code"; + license = licenses.gpl3; + platforms = ocaml.meta.platforms; + maintainers = [ maintainers.jirkamarsik ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 090929eba23c..be2631831d10 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3641,6 +3641,10 @@ let ocaml_text = callPackage ../development/ocaml-modules/ocaml-text { }; + ocpBuild = callPackage ../development/tools/ocaml/ocp-build { }; + + ocpIndent = callPackage ../development/tools/ocaml/ocp-indent { }; + ocsigen_server = callPackage ../development/ocaml-modules/ocsigen-server { }; ounit = callPackage ../development/ocaml-modules/ounit { };