diff options
Diffstat (limited to 'pkgs/development/compilers/ocaml/generic.nix')
-rw-r--r-- | pkgs/development/compilers/ocaml/generic.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/development/compilers/ocaml/generic.nix b/pkgs/development/compilers/ocaml/generic.nix index ec52e56c1faa2..51c45616d3958 100644 --- a/pkgs/development/compilers/ocaml/generic.nix +++ b/pkgs/development/compilers/ocaml/generic.nix @@ -1,4 +1,4 @@ -{ minor_version, major_version, patch_version +{ minor_version, major_version, patch_version, patches ? [] , ...}@args: let versionNoPatch = "${toString major_version}.${toString minor_version}"; @@ -6,7 +6,7 @@ let safeX11 = stdenv: !(stdenv.isAarch32 || stdenv.isMips || stdenv.hostPlatform.isStatic); in -{ lib, stdenv, fetchurl, ncurses, buildEnv, libunwind +{ lib, stdenv, fetchurl, ncurses, buildEnv, libunwind, fetchpatch , libX11, xorgproto, useX11 ? safeX11 stdenv && !lib.versionAtLeast version "4.09" , aflSupport ? false , flambdaSupport ? false @@ -35,6 +35,8 @@ let x11env = buildEnv { name = "x11env"; paths = [libX11 xorgproto]; }; x11lib = x11env + "/lib"; x11inc = x11env + "/include"; + + fetchpatch' = x: if builtins.isAttrs x then fetchpatch x else x; in stdenv.mkDerivation (args // { @@ -44,6 +46,8 @@ stdenv.mkDerivation (args // { inherit src; + patches = map fetchpatch' patches; + strictDeps = true; prefixKey = "-prefix "; @@ -74,7 +78,18 @@ stdenv.mkDerivation (args // { hardeningDisable = lib.optional (lib.versionAtLeast version "4.09" && stdenv.hostPlatform.isMusl) "pie" ++ lib.optionals (args ? hardeningDisable) args.hardeningDisable; - buildFlags = [ "world" ] ++ optionals useNativeCompilers [ "bootstrap" "world.opt" ]; + # Older versions have some race: + # cp: cannot stat 'boot/ocamlrun': No such file or directory + # make[2]: *** [Makefile:199: backup] Error 1 + enableParallelBuilding = lib.versionAtLeast version "4.08"; + + # Workaround lack of parallelism support among top-level targets: + # we place nixpkgs-specific targets to a separate file and set + # sequential order among them as a single rule. + makefile = ./Makefile.nixpkgs; + buildFlags = if useNativeCompilers + then ["nixpkgs_world_bootstrap_world_opt"] + else ["nixpkgs_world"]; buildInputs = optional (!lib.versionAtLeast version "4.07") ncurses ++ optionals useX11 [ libX11 xorgproto ]; propagatedBuildInputs = optional spaceTimeSupport libunwind; |