1 # Build script for adjust the toolchain
3 # Copyright (C) 2014-2017 Matias Fonzo, <selk@dragora.org>
5 # This script is free software: you have unlimited permission
6 # to copy, distribute and modify it.
8 # This will be handled by libs/musl (post-install script):
10 cat << EOF > /tools/bin/adjust-toolchain
13 if test -r /tools/bin/ld-new
16 echo "\${0}: Adjusting toolchain ..."
20 TRIPLET="\$(\$CC -dumpmachine)"
23 mv /tools/bin/ld /tools/bin/ld-old
24 mv /tools/\${TRIPLET}/bin/ld /tools/\${TRIPLET}/bin/ld-old
25 mv /tools/bin/ld-new /tools/bin/ld
26 ln -sf /tools/bin/ld /tools/\${TRIPLET}/bin/ld
28 \$CC -dumpspecs | sed \\
30 -e "/\*startfile_prefix_spec:/{n;s@.*@/usr/lib\${libSuffix}/ @}" \\
31 -e '/\*cpp:/{n;s@\$@ -isystem /usr/include@}' \\
32 > "\$(dirname -- "\$(\$CC --print-libgcc-file-name)")"/specs
37 chmod 700 /tools/bin/adjust-toolchain