cc-wrapper: Wrap/link all other GNAT commands

This commit is contained in:
Boey Maun Suang 2023-01-06 20:32:49 +11:00
parent 3d64e7edbb
commit a584587bea
2 changed files with 34 additions and 17 deletions

View File

@ -236,10 +236,15 @@ stdenv.mkDerivation {
fi fi
'' ''
# No need to wrap gnat, gnatkr, gnatname or gnatprep; we can just symlink them in
+ optionalString cc.langAda or false '' + optionalString cc.langAda or false ''
wrap ${targetPrefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatmake for cmd in gnatbind gnatchop gnatclean gnatlink gnatls gnatmake; do
wrap ${targetPrefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatbind wrap ${targetPrefix}$cmd ${./gnat-wrapper.sh} $ccPath/${targetPrefix}$cmd
wrap ${targetPrefix}gnatlink ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatlink done
for cmd in gnat gnatkr gnatname gnatprep; do
ln -s $ccPath/${targetPrefix}$cmd $out/bin/${targetPrefix}$cmd
done
# this symlink points to the unwrapped gnat's output "out". It is used by # this symlink points to the unwrapped gnat's output "out". It is used by
# our custom gprconfig compiler description to find GNAT's ada runtime. See # our custom gprconfig compiler description to find GNAT's ada runtime. See

View File

@ -127,20 +127,32 @@ if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
params=(${rest+"${rest[@]}"}) params=(${rest+"${rest[@]}"})
fi fi
if [ "$(basename $0)x" = "gnatmakex" ]; then case "$(basename $0)x" in
extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink") "gnatbindx")
extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@ -cargs $NIX_GNATMAKE_CARGS_@suffixSalt@) extraBefore=()
fi extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@)
;;
if [ "$(basename $0)x" = "gnatbindx" ]; then "gnatchopx")
extraBefore=() extraBefore=("--GCC=@out@/bin/gcc")
extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@) extraAfter=()
fi ;;
"gnatcleanx")
if [ "$(basename $0)x" = "gnatlinkx" ]; then extraBefore=($NIX_GNATFLAGS_COMPILE_@suffixSalt@)
extraBefore=() extraAfter=()
extraAfter=("--GCC=@out@/bin/gcc") ;;
fi "gnatlinkx")
extraBefore=()
extraAfter=("--GCC=@out@/bin/gcc")
;;
"gnatlsx")
extraBefore=()
extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@)
;;
"gnatmakex")
extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink")
extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@ -cargs $NIX_GNATMAKE_CARGS_@suffixSalt@)
;;
esac
# As a very special hack, if the arguments are just `-v', then don't # As a very special hack, if the arguments are just `-v', then don't
# add anything. This is to prevent `gcc -v' (which normally prints # add anything. This is to prevent `gcc -v' (which normally prints