From 33c132e9b37aa4086537f474d4dffe70ea1e831e Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Wed, 3 Jan 2018 09:51:31 -0600 Subject: [PATCH 1/2] llvm-{4,5}: don't build entire project to get the manpages Much cheaper to build this way. Also this gives them a different name to avoid confusion and clutter when using `nix-env -qaP` or similar. --- .../compilers/llvm/4/clang/default.nix | 36 +++++++++++-------- pkgs/development/compilers/llvm/4/default.nix | 2 +- pkgs/development/compilers/llvm/4/llvm.nix | 30 +++++++++++----- .../compilers/llvm/5/clang/default.nix | 36 +++++++++++-------- pkgs/development/compilers/llvm/5/default.nix | 2 +- pkgs/development/compilers/llvm/5/llvm.nix | 30 +++++++++++----- 6 files changed, 88 insertions(+), 48 deletions(-) diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix index 8d40ee3c8aa2..81819f72c417 100644 --- a/pkgs/development/compilers/llvm/4/clang/default.nix +++ b/pkgs/development/compilers/llvm/4/clang/default.nix @@ -5,7 +5,7 @@ let gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; - self = stdenv.mkDerivation { + self = stdenv.mkDerivation ({ name = "clang-${version}"; unpackPhase = '' @@ -37,10 +37,6 @@ let patches = [ ./purity.patch ]; - postBuild = stdenv.lib.optionalString enableManpages '' - cmake --build . --target docs-clang-man - ''; - postPatch = '' sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp @@ -49,8 +45,7 @@ let sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt ''; - outputs = [ "out" "python" ] - ++ stdenv.lib.optional enableManpages "man"; + outputs = [ "out" "python" ]; # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix @@ -67,13 +62,6 @@ let mv $out/share/clang/*.py $python/share/clang rm $out/bin/c-index-test - '' - + stdenv.lib.optionalString enableManpages '' - # Manually install clang manpage - cp docs/man/*.1 $out/share/man/man1/ - - # Move it and other man pages to 'man' output - moveToOutput "share/man" "$man" ''; enableParallelBuilding = true; @@ -92,5 +80,23 @@ let license = stdenv.lib.licenses.ncsa; platforms = stdenv.lib.platforms.all; }; - }; + } // stdenv.lib.optionalAttrs enableManpages { + name = "clang-manpages-${version}"; + + buildPhase = '' + make docs-clang-man + ''; + + installPhase = '' + mkdir -p $out/share/man/man1 + # Manually install clang manpage + cp docs/man/*.1 $out/share/man/man1/ + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man page for Clang ${version}"; + }); in self diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix index 5a44cb868253..40b33a308da8 100644 --- a/pkgs/development/compilers/llvm/4/default.nix +++ b/pkgs/development/compilers/llvm/4/default.nix @@ -20,7 +20,7 @@ let # Add man output without introducing extra dependencies. overrideManOutput = drv: let drv-manpages = drv.override { enableManpages = true; }; in - drv // { man = drv-manpages.man; /*outputs = drv.outputs ++ ["man"];*/ }; + drv // { man = drv-manpages.out; /*outputs = drv.outputs ++ ["man"];*/ }; llvm = callPackage ./llvm.nix { inherit compiler-rt_src stdenv; diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index 33147b07599c..711024c7d3ca 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -27,7 +27,7 @@ let # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = with stdenv.lib; concatStringsSep "." (take 2 (splitString "." release_version)); -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (rec { name = "llvm-${version}"; unpackPhase = '' @@ -39,8 +39,7 @@ in stdenv.mkDerivation rec { ''; outputs = [ "out" ] - ++ stdenv.lib.optional enableSharedLibraries "lib" - ++ stdenv.lib.optional enableManpages "man"; + ++ stdenv.lib.optional enableSharedLibraries "lib"; nativeBuildInputs = [ perl groff cmake python ] ++ stdenv.lib.optional enableManpages python.pkgs.sphinx; @@ -129,10 +128,7 @@ in stdenv.mkDerivation rec { export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib ''; - postInstall = stdenv.lib.optionalString enableManpages '' - moveToOutput "share/man" "$man" - '' - + stdenv.lib.optionalString enableSharedLibraries '' + postInstall = stdenv.lib.optionalString enableSharedLibraries '' moveToOutput "lib/libLLVM-*" "$lib" moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ @@ -160,4 +156,22 @@ in stdenv.mkDerivation rec { maintainers = with stdenv.lib.maintainers; [ lovek323 raskin viric dtzWill ]; platforms = stdenv.lib.platforms.all; }; -} +} // stdenv.lib.optionalAttrs enableManpages { + name = "llvm-manpages-${version}"; + + buildPhase = '' + make docs-llvm-man + ''; + + propagatedBuildInputs = [ ]; + + installPhase = '' + make -C docs install + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man pages for LLVM ${version}"; +}) diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix index b003d2f334ac..fdcfbfc3f3ed 100644 --- a/pkgs/development/compilers/llvm/5/clang/default.nix +++ b/pkgs/development/compilers/llvm/5/clang/default.nix @@ -5,7 +5,7 @@ let gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; - self = stdenv.mkDerivation { + self = stdenv.mkDerivation ({ name = "clang-${version}"; unpackPhase = '' @@ -37,10 +37,6 @@ let patches = [ ./purity.patch ]; - postBuild = stdenv.lib.optionalString enableManpages '' - cmake --build . --target docs-clang-man - ''; - postPatch = '' sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ @@ -50,8 +46,7 @@ let sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt ''; - outputs = [ "out" "python" ] - ++ stdenv.lib.optional enableManpages "man"; + outputs = [ "out" "python" ]; # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix @@ -68,13 +63,6 @@ let mv $out/share/clang/*.py $python/share/clang rm $out/bin/c-index-test - '' - + stdenv.lib.optionalString enableManpages '' - # Manually install clang manpage - cp docs/man/*.1 $out/share/man/man1/ - - # Move it and other man pages to 'man' output - moveToOutput "share/man" "$man" ''; enableParallelBuilding = true; @@ -93,5 +81,23 @@ let license = stdenv.lib.licenses.ncsa; platforms = stdenv.lib.platforms.all; }; - }; + } // stdenv.lib.optionalAttrs enableManpages { + name = "clang-manpages-${version}"; + + buildPhase = '' + make docs-clang-man + ''; + + installPhase = '' + mkdir -p $out/share/man/man1 + # Manually install clang manpage + cp docs/man/*.1 $out/share/man/man1/ + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man page for Clang ${version}"; + }); in self diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix index a7e16c08ce96..a38acaf07398 100644 --- a/pkgs/development/compilers/llvm/5/default.nix +++ b/pkgs/development/compilers/llvm/5/default.nix @@ -20,7 +20,7 @@ let # Add man output without introducing extra dependencies. overrideManOutput = drv: let drv-manpages = drv.override { enableManpages = true; }; in - drv // { man = drv-manpages.man; /*outputs = drv.outputs ++ ["man"];*/ }; + drv // { man = drv-manpages.out; /*outputs = drv.outputs ++ ["man"];*/ }; llvm = callPackage ./llvm.nix { inherit compiler-rt_src stdenv; diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix index 6c7fd9eb0a38..400ffa341171 100644 --- a/pkgs/development/compilers/llvm/5/llvm.nix +++ b/pkgs/development/compilers/llvm/5/llvm.nix @@ -27,7 +27,7 @@ let # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = with stdenv.lib; concatStringsSep "." (take 2 (splitString "." release_version)); -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (rec { name = "llvm-${version}"; unpackPhase = '' @@ -39,8 +39,7 @@ in stdenv.mkDerivation rec { ''; outputs = [ "out" ] - ++ stdenv.lib.optional enableSharedLibraries "lib" - ++ stdenv.lib.optional enableManpages "man"; + ++ stdenv.lib.optional enableSharedLibraries "lib"; nativeBuildInputs = [ perl groff cmake python ] ++ stdenv.lib.optional enableManpages python.pkgs.sphinx; @@ -123,10 +122,7 @@ in stdenv.mkDerivation rec { export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib ''; - postInstall = stdenv.lib.optionalString enableManpages '' - moveToOutput "share/man" "$man" - '' - + stdenv.lib.optionalString enableSharedLibraries '' + postInstall = stdenv.lib.optionalString enableSharedLibraries '' moveToOutput "lib/libLLVM-*" "$lib" moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ @@ -154,4 +150,22 @@ in stdenv.mkDerivation rec { maintainers = with stdenv.lib.maintainers; [ lovek323 raskin viric dtzWill ]; platforms = stdenv.lib.platforms.all; }; -} +} // stdenv.lib.optionalAttrs enableManpages { + name = "llvm-manpages-${version}"; + + buildPhase = '' + make docs-llvm-man + ''; + + propagatedBuildInputs = []; + + installPhase = '' + make -C docs install + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man pages for LLVM ${version}"; +}) From 514f67e3a89d2dc98aba1761f75210a649f2cf6c Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 16 Jan 2018 13:38:37 -0600 Subject: [PATCH 2/2] clang-{4,5}: set postBuild to empty string to avoid rebuild for now --- pkgs/development/compilers/llvm/4/clang/default.nix | 3 +++ pkgs/development/compilers/llvm/5/clang/default.nix | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix index 81819f72c417..f9d1e5261523 100644 --- a/pkgs/development/compilers/llvm/4/clang/default.nix +++ b/pkgs/development/compilers/llvm/4/clang/default.nix @@ -37,6 +37,9 @@ let patches = [ ./purity.patch ]; + # XXX: TODO: This should be removed on next rebuild + postBuild = ""; + postPatch = '' sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix index fdcfbfc3f3ed..749074ef53ac 100644 --- a/pkgs/development/compilers/llvm/5/clang/default.nix +++ b/pkgs/development/compilers/llvm/5/clang/default.nix @@ -37,6 +37,9 @@ let patches = [ ./purity.patch ]; + # XXX: TODO: This should be removed on next rebuild + postBuild = ""; + postPatch = '' sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \