Open melvyn2 opened 2 years ago
As a bit of clarification, the wrapper binaries are actually symlinks to the usual distcc
/ccache
binaries, who use the 0th argument to decide what to call (I believe).
In the mean time, I am using this script to generate a similar directory:
#!/usr/bin/bash
cd "$(dirname "$0")"
for COMPILER in "c++" "c89" "c99" "cc" "clang" "clang++" "cpp" "g++" "gcc" "rustc" "x86_64-pc-linux-gnu-c++" "x86_64-pc-linux-gnu-cc" "x86_64-pc-linux-gnu-g++" "x86_64-pc-linux-gnu-gcc"; do
cat > "./${COMPILER}" <<-EOF
#!/bin/bash
SCCACHE_WRAPPER_BINDIR="\$(dirname \${BASH_SOURCE[0]})" # Intentionally don't resolve symlinks
PATH=\${PATH//":\$SCCACHE_WRAPPER_BINDIR:"/":"} # delete any instances in the middle
PATH=\${PATH/#"\$SCCACHE_WRAPPER_BINDIR:"/} # delete any instance at the beginning
PATH=\${PATH/%":\$SCCACHE_WRAPPER_BINDIR"/} # delete any instance in the at the end
/usr/bin/sccache ${COMPILER} "\$@"
EOF
chmod 755 "./${COMPILER}"
done
ccache
anddistcc
both shipbin
directories with wrapper binaries of the compilers they support:These allow users to change their
PATH
environment variable so that the wrappers'bin
folder is set before the general folder where the real compilers are stored, instead of having to modify whatever the build system calls. I believe that adding a similar feature tosccache
would make it easier to drop in to different systems with less modification.