ocaml: add framePointer option

Signed-off-by: Ali Caglayan <alizter@gmail.com>

<!-- ps-id: 10ea20a5-edc5-4358-a6d7-f2b5ec319258 -->
This commit is contained in:
Ali Caglayan 2023-03-12 21:17:07 +01:00 committed by Vincent Laporte
parent 7b287d6f6e
commit 8f16a97848

View file

@ -12,6 +12,7 @@ in
, flambdaSupport ? false
, spaceTimeSupport ? false
, unsafeStringSupport ? false
, framePointerSupport ? false
}:
assert useX11 -> safeX11 stdenv;
@ -19,6 +20,7 @@ assert aflSupport -> lib.versionAtLeast version "4.05";
assert flambdaSupport -> lib.versionAtLeast version "4.03";
assert spaceTimeSupport -> lib.versionAtLeast version "4.04" && lib.versionOlder version "4.12";
assert unsafeStringSupport -> lib.versionAtLeast version "4.06" && lib.versionOlder version "5.0";
assert framePointerSupport -> lib.versionAtLeast version "4.01";
let
src = args.src or (fetchurl {
@ -28,9 +30,14 @@ let
in
let
useNativeCompilers = !stdenv.isMips;
inherit (lib) optional optionals optionalString;
pname = "ocaml${optionalString aflSupport "+afl"}${optionalString spaceTimeSupport "+spacetime"}${optionalString flambdaSupport "+flambda"}";
useNativeCompilers = !stdenv.isMips;
inherit (lib) optional optionals optionalString strings concatStrings;
pname = concatStrings [ "ocaml"
(optionalString aflSupport "+afl")
(optionalString spaceTimeSupport "+spacetime")
(optionalString flambdaSupport "+flambda")
(optionalString framePointerSupport "+fp")
];
in
let
@ -61,6 +68,7 @@ stdenv.mkDerivation (args // {
++ optional aflSupport (flags "--with-afl" "-afl-instrument")
++ optional flambdaSupport (flags "--enable-flambda" "-flambda")
++ optional spaceTimeSupport (flags "--enable-spacetime" "-spacetime")
++ optional framePointerSupport (flags "--enable-frame-pointers" "-with-frame-pointers")
++ optionals unsafeStringSupport [
"--disable-force-safe-string"
"DEFAULT_STRING=unsafe"