Merge #33948: {llvm,clang}-{4,5}: better man-pages

Don't rebuild entire projects just to get manpages.
This commit is contained in:
Vladimír Čunát 2018-01-21 11:35:10 +01:00
commit 5fb5beb929
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
6 changed files with 92 additions and 46 deletions

View file

@ -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,9 +37,8 @@ let
patches = [ ./purity.patch ];
postBuild = stdenv.lib.optionalString enableManpages ''
cmake --build . --target docs-clang-man
'';
# 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
@ -49,8 +48,7 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "lib" "python" ]
++ stdenv.lib.optional enableManpages "man";
outputs = [ "out" "lib" "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -69,13 +67,6 @@ let
fi
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 +84,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

View file

@ -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;

View file

@ -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}";
})

View file

@ -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,9 +37,8 @@ let
patches = [ ./purity.patch ];
postBuild = stdenv.lib.optionalString enableManpages ''
cmake --build . --target docs-clang-man
'';
# XXX: TODO: This should be removed on next rebuild
postBuild = "";
postPatch = ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
@ -50,8 +49,7 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "lib" "python" ]
++ stdenv.lib.optional enableManpages "man";
outputs = [ "out" "lib" "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -70,13 +68,6 @@ let
fi
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;
@ -94,5 +85,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

View file

@ -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;

View file

@ -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}";
})