From 4d26c18306d26346937cf019d06c4363382d5bf4 Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 27 Nov 2019 19:15:56 +0000 Subject: [PATCH] cc-wrapper: expose wrapper script as overridable attribute (#65813) --- pkgs/build-support/cc-wrapper/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 2c35fdb1a3c6..757985e07161 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -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;