llvm-packages: fix manpages with python-boot and cleanup

On darwin llvmPackages is built using python-boot to avoid dependencies
in the stdenv, but we can't and shouldn't use that when building the
manpages since it depends on python packages.
This commit is contained in:
Daiderd Jordan 2018-07-27 21:52:50 +02:00
parent cacf0925a5
commit 3ec81ae27e
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
5 changed files with 52 additions and 52 deletions

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@ -16,25 +16,28 @@ let
compiler-rt_src = fetch "compiler-rt" "0h5lpv1z554szi4r4blbskhwrkd78ir50v3ng8xvk1s86fa7gj53";
clang-tools-extra_src = fetch "clang-tools-extra" "1dhmp7ccfpr42bmvk3kp37ngjpf3a9m5d4kkpsn7d00hzi7fdl9m";
# Add man output without introducing extra dependencies.
overrideManOutput = drv:
let drv-manpages = drv.override { enableManpages = true; }; in
drv // { man = drv-manpages.out; /*outputs = drv.outputs ++ ["man"];*/ };
tools = stdenv.lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
in {
llvm = overrideManOutput (callPackage ./llvm.nix {
llvm = callPackage ./llvm.nix {
inherit compiler-rt_src;
});
clang-unwrapped = overrideManOutput (callPackage ./clang {
};
clang-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
};
llvm-manpages = lowPrio (tools.llvm.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
clang-manpages = lowPrio (tools.clang-unwrapped.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
libclang = tools.clang-unwrapped.lib;
llvm-manpages = lowPrio tools.llvm.man;
clang-manpages = lowPrio tools.clang-unwrapped.man;
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
@ -54,7 +57,7 @@ let
});
libraries = stdenv.lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
in {
stdenv = overrideCC stdenv buildLlvmTools.clang;

View File

@ -13,7 +13,7 @@
, compiler-rt_src
, debugVersion ? false
, enableManpages ? false
, enableSharedLibraries ? true
, enableSharedLibraries ? !enableManpages
}:
let

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@ -15,13 +15,8 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "018b3fiwah8f8br5i26qmzh6sjvzchpn358sn8v079m49f2jldm3";
# Add man output without introducing extra dependencies.
overrideManOutput = drv:
let drv-manpages = drv.override { enableManpages = true; }; in
drv // { man = drv-manpages.out; /*outputs = drv.outputs ++ ["man"];*/ };
tools = stdenv.lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
mkExtraBuildCommands = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -33,15 +28,23 @@ let
'';
in {
llvm = overrideManOutput (callPackage ./llvm.nix { });
llvm = callPackage ./llvm.nix { };
clang-unwrapped = overrideManOutput (callPackage ./clang {
clang-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
};
llvm-manpages = lowPrio (tools.llvm.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
clang-manpages = lowPrio (tools.clang-unwrapped.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
libclang = tools.clang-unwrapped.lib;
llvm-manpages = lowPrio tools.llvm.man;
clang-manpages = lowPrio tools.clang-unwrapped.man;
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
@ -70,7 +73,7 @@ let
});
libraries = stdenv.lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
in {
compiler-rt = callPackage ./compiler-rt.nix {};

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@ -15,13 +15,8 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "1w8ml7fyn4vyxmy59n2qm4r1k1kgwgwkaldp6m45fdv4g0kkfbhd";
# Add man output without introducing extra dependencies.
overrideManOutput = drv:
let drv-manpages = drv.override { enableManpages = true; }; in
drv // { man = drv-manpages.out; /*outputs = drv.outputs ++ ["man"];*/ };
tools = stdenv.lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
mkExtraBuildCommands = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -33,15 +28,23 @@ let
'';
in {
llvm = overrideManOutput (callPackage ./llvm.nix { });
llvm = callPackage ./llvm.nix { };
clang-unwrapped = overrideManOutput (callPackage ./clang {
clang-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
};
llvm-manpages = lowPrio (tools.llvm.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
clang-manpages = lowPrio (tools.clang-unwrapped.override {
enableManpages = true;
python = pkgs.python; # don't use python-boot
});
libclang = tools.clang-unwrapped.lib;
llvm-manpages = lowPrio tools.llvm.man;
clang-manpages = lowPrio tools.clang-unwrapped.man;
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
@ -70,7 +73,7 @@ let
});
libraries = stdenv.lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
in {
compiler-rt = callPackage ./compiler-rt.nix {};

View File

@ -339,15 +339,7 @@ in rec {
llvmPackages_5 = super.llvmPackages_5 // (let
tools = super.llvmPackages_5.tools.extend (_: super: {
# Build man pages with final stdenv not before
llvm = lib.extendDerivation
true
{ inherit (super.llvm) man; }
llvmPackages_5.llvm;
clang-unwrapped = lib.extendDerivation
true
{ inherit (super.clang-unwrapped) man; }
llvmPackages_5.clang-unwrapped;
inherit (llvmPackages_5) llvm clang-unwrapped;
});
libraries = super.llvmPackages_5.libraries.extend (_: _: {
inherit (llvmPackages_5) compiler-rt libcxx libcxxabi;
@ -384,9 +376,8 @@ in rec {
initialPath = import ../common-path.nix { inherit pkgs; };
shell = "${pkgs.bash}/bin/bash";
# Hack to avoid man pages in stdenv, building bootstrap python
cc = pkgs.llvmPackages.libcxxClang.override {
cc = builtins.removeAttrs pkgs.llvmPackages.clang-unwrapped [ "man" ];
cc = pkgs.llvmPackages.clang-unwrapped;
};
extraNativeBuildInputs = [];