decompress.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. . ${RECIPE_DIR}/build_scripts/build_env.sh
  3. set -e
  4. echo "Fetching sources ..."
  5. rm -rf gcc_toolchain-sources
  6. git clone -b "gcc-11.2-${target_platform}" https://github.com/AnacondaRecipes/gcc_toolchain-sources
  7. echo "Extracting sources ..."
  8. pushd "gcc_toolchain-sources"
  9. for f in *.tar.*; do
  10. H=${f/\.tar.*/}
  11. B="$(sed -r -e 's/(\-|_)+[0-9].*//' <<<"${H}" )"
  12. H="$(sed -r -e 's/\.[a-z].*//' <<<"${H}" )"
  13. HH=${H/_/\-}
  14. H="$(sed -r -e 's/\.[a-z].*//' <<<"${H}" )"
  15. F="$(sed -r -e 's/.*\.tar.(.*)/\1/' <<<"${f}" )"
  16. C=""
  17. if [ "${F}" == bz2 ]; then
  18. C="j"
  19. elif [ "${F}" == xz ]; then
  20. C="J"
  21. elif [ "${F}" == gz ]; then
  22. C="z"
  23. fi
  24. printf "\rUncompress \rUncompress ${H} ... "
  25. rm -rf ${WDIR}/${B} ${WDIR}/${H} ${WDIR}/${HH}
  26. cp $f ${WDIR}/.
  27. pushd "${WDIR}"
  28. tar -x${C}f $f
  29. if [ -d ./${H} ]; then
  30. mv $H $B
  31. elif [ -d ./${HH} ]; then
  32. mv $HH $B
  33. else
  34. echo "\nCannot find extracted $H nor $HH ... please check"
  35. exit 1
  36. fi
  37. # remove copied tar file after decompression ...
  38. rm -f $f
  39. popd
  40. done
  41. printf "\rUncompressed all source packages successful! \n"
  42. # create ports support for glibc
  43. ln -s §{WDIR}/glibc-ports ${WDIR}/glibc/ports
  44. CUR=$PWD/patches
  45. for f in binutils duma gcc gdb glibc "glibc-ports" gmp libelf linux ltrace; do
  46. echo "Patching $f ..."
  47. if [ -d "${CUR}/${f}" ]; then
  48. pushd "${WDIR}/${f}"
  49. for g in ${CUR}/${f}/*.patch; do echo "proocess ${g}"; patch -f -p1 -g0 -F1 -i $g; done
  50. popd
  51. fi
  52. done
  53. case "${HOST}" in
  54. *linux*)
  55. # we don't need them on linux architectures ... part of glibc
  56. rm -rf ${WDIR}/gettext ${WDIR}/libiconv
  57. ;;
  58. esac
  59. popd
  60. exit 0