crossgcc-helper 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. # Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. crossgcc_same_major_version_test() {
  17. local buildgcc_path="$sources_path/util/crossgcc/buildgcc"
  18. local sources_path="$(project_sources_path "$project" "$repository" "$@")"
  19. local crossgcc_version="$(sed -rne 's/^GCC_VERSION=(.*)$/\1/p' "$buildgcc_path")"
  20. local host_gcc_version="$(gcc -dumpversion)"
  21. if [[ "${host_gcc_version%%.*}" -eq "${crossgcc_version%%.*}" ]]; then
  22. return 0
  23. else
  24. return 1
  25. fi
  26. }
  27. crossgcc_tarballs() {
  28. local sources_path=$(project_sources_path "$project" "$repository" "$@")
  29. local install_path="$sources_path/util/crossgcc/tarballs/"
  30. local tarballs=$(ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//")
  31. printf '%s\n' "$tarballs"
  32. }
  33. crossgcc_tarball_sources_path() {
  34. local tarball=$1
  35. local tarball_sources_path="$root/$SOURCES/$tarball"
  36. printf '%s\n' "$tarball_sources_path"
  37. }
  38. crossgcc_tarball_install_path() {
  39. local tarball=$1
  40. shift
  41. local sources_path=$(project_sources_path "$project" "$repository" "$@")
  42. local install_path="$sources_path/util/crossgcc/tarballs/"
  43. local tarball_install_path="$install_path/$tarball"
  44. printf '%s\n' "$tarball_install_path"
  45. }
  46. crossgcc_tarball_release_path() {
  47. local tarball=$1
  48. shift
  49. local release_path=$(project_release_path "$project" "$SOURCES" "$@")
  50. local tarball_release_path="$release_path/$tarball"
  51. printf '%s\n' "$tarball_release_path"
  52. }