cc-wrapper: expose wrapper script as overridable attribute (#65813)

This commit is contained in:
David Wood 2019-11-27 19:15:56 +00:00 committed by Dmitry Kalinkin
parent fa383dcb7c
commit 4d26c18306

View file

@ -132,6 +132,8 @@ stdenv.mkDerivation {
src=$PWD
'';
wrapper = ./cc-wrapper.sh;
installPhase =
''
mkdir -p $out/bin $out/nix-support
@ -171,42 +173,42 @@ stdenv.mkDerivation {
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
if [ -e $ccPath/${targetPrefix}gcc ]; then
wrap ${targetPrefix}gcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gcc
wrap ${targetPrefix}gcc $wrapper $ccPath/${targetPrefix}gcc
ln -s ${targetPrefix}gcc $out/bin/${targetPrefix}cc
export named_cc=${targetPrefix}gcc
export named_cxx=${targetPrefix}g++
elif [ -e $ccPath/clang ]; then
wrap ${targetPrefix}clang ${./cc-wrapper.sh} $ccPath/clang
wrap ${targetPrefix}clang $wrapper $ccPath/clang
ln -s ${targetPrefix}clang $out/bin/${targetPrefix}cc
export named_cc=${targetPrefix}clang
export named_cxx=${targetPrefix}clang++
fi
if [ -e $ccPath/${targetPrefix}g++ ]; then
wrap ${targetPrefix}g++ ${./cc-wrapper.sh} $ccPath/${targetPrefix}g++
wrap ${targetPrefix}g++ $wrapper $ccPath/${targetPrefix}g++
ln -s ${targetPrefix}g++ $out/bin/${targetPrefix}c++
elif [ -e $ccPath/clang++ ]; then
wrap ${targetPrefix}clang++ ${./cc-wrapper.sh} $ccPath/clang++
wrap ${targetPrefix}clang++ $wrapper $ccPath/clang++
ln -s ${targetPrefix}clang++ $out/bin/${targetPrefix}c++
fi
if [ -e $ccPath/cpp ]; then
wrap ${targetPrefix}cpp ${./cc-wrapper.sh} $ccPath/cpp
wrap ${targetPrefix}cpp $wrapper $ccPath/cpp
fi
''
+ optionalString cc.langFortran or false ''
wrap ${targetPrefix}gfortran ${./cc-wrapper.sh} $ccPath/${targetPrefix}gfortran
wrap ${targetPrefix}gfortran $wrapper $ccPath/${targetPrefix}gfortran
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}g77
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}f77
''
+ optionalString cc.langJava or false ''
wrap ${targetPrefix}gcj ${./cc-wrapper.sh} $ccPath/${targetPrefix}gcj
wrap ${targetPrefix}gcj $wrapper $ccPath/${targetPrefix}gcj
''
+ optionalString cc.langGo or false ''
wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo
wrap ${targetPrefix}gccgo $wrapper $ccPath/${targetPrefix}gccgo
'';
strictDeps = true;