ocaml: adds an argument to enable flambda

This commit is contained in:
Vincent Laporte 2017-12-20 22:43:24 +00:00 committed by Vincent Laporte
parent 76c146c990
commit efcb39233d

View file

@ -10,14 +10,18 @@ let
safeX11 = stdenv: !(stdenv.isArm || stdenv.isMips);
in
{ stdenv, fetchurl, ncurses, buildEnv, libX11, xproto, useX11 ? safeX11 stdenv }:
{ stdenv, fetchurl, ncurses, buildEnv
, libX11, xproto, useX11 ? safeX11 stdenv
, flambdaSupport ? false
}:
assert useX11 -> !stdenv.isArm && !stdenv.isMips;
assert flambdaSupport -> stdenv.lib.versionAtLeast version "4.03";
let
useNativeCompilers = !stdenv.isMips;
inherit (stdenv.lib) optionals optionalString;
name = "ocaml-${version}";
inherit (stdenv.lib) optional optionals optionalString;
name = "ocaml${optionalString flambdaSupport "+flambda"}-${version}";
in
stdenv.mkDerivation (args // rec {
@ -36,7 +40,9 @@ stdenv.mkDerivation (args // rec {
prefixKey = "-prefix ";
configureFlags = optionals useX11 [ "-x11lib" x11lib
"-x11include" x11inc ];
"-x11include" x11inc ]
++ optional flambdaSupport "-flambda"
;
buildFlags = "world" + optionalString useNativeCompilers " bootstrap world.opt";
buildInputs = [ncurses] ++ optionals useX11 [ libX11 xproto ];