tarlz upgraded to version 0.12
[dragora.git] / stages / 1 / 21-toolchain
blobef12c7211f58f929704cd24ee30fc82232eff856
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
11 #! /bin/sh -
13 if test -r /tools/bin/ld-new
14 then
15     set -e
16     echo "\${0}: Adjusting toolchain ..."
17     set -x
19     CC=cc
20     TRIPLET="\$(\$CC -dumpmachine)"
21     libSuffix=$libSuffix
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 \\
29      -e 's@/tools@@g' \\
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
35 EOF
37 chmod 700 /tools/bin/adjust-toolchain