20-toolchain 985 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Build script for adjust the toolchain
  2. #
  3. # Copyright (C) 2014-2017, 2020 Matias Fonzo, <selk@dragora.org>
  4. #
  5. # This script is free software: you have unlimited permission
  6. # to copy, distribute and modify it.
  7. # This will be handled by libs/musl (post-install script):
  8. cat << EOF > /tools/bin/adjust-toolchain
  9. #! /bin/sh -
  10. if test -r /tools/bin/ld-new
  11. then
  12. set -e
  13. echo "\${0}: Adjusting toolchain ..."
  14. set -x
  15. CC=gcc
  16. TRIPLET="\$(\$CC -dumpmachine)"
  17. libSuffix=$libSuffix
  18. mv /tools/bin/ld /tools/bin/ld-old
  19. mv /tools/\${TRIPLET}/bin/ld /tools/\${TRIPLET}/bin/ld-old
  20. mv /tools/bin/ld-new /tools/bin/ld
  21. ln -sf /tools/bin/ld /tools/\${TRIPLET}/bin/ld
  22. \$CC -dumpspecs | sed \\
  23. -e 's@/tools@@g' \\
  24. -e "/\*startfile_prefix_spec:/{n;s@.*@/usr/lib\${libSuffix}/ @}" \\
  25. -e '/\*cpp:/{n;s@\$@ -isystem /usr/include@}' \\
  26. > "\$(dirname -- "\$(\$CC --print-libgcc-file-name)")"/specs
  27. fi
  28. EOF
  29. chmod 700 /tools/bin/adjust-toolchain