crossgcc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. arguments() {
  17. project_arguments_targets "$project" "$@"
  18. }
  19. usage() {
  20. project_usage_actions "$project" "prefix"
  21. project_usage_arguments "$project" "$@"
  22. }
  23. download() {
  24. local repository="coreboot"
  25. git_project_prepare "$project" "$repository" "$@"
  26. }
  27. download_check() {
  28. local repository="coreboot"
  29. git_project_prepare_check "$project" "$repository" "$@"
  30. }
  31. extract() {
  32. local arguments=$@
  33. local repository="coreboot"
  34. local tarball
  35. project_extract "$project" "$@"
  36. crossgcc_tarballs "$@" | while read tarball
  37. do
  38. local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" )
  39. local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
  40. local tarball_install_directory_path=$( dirname "$tarball_install_path" )
  41. if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ]
  42. then
  43. printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
  44. mkdir -p "$tarball_install_directory_path"
  45. file_verification_check "$tarball_sources_path"
  46. cp "$tarball_sources_path" "$tarball_install_path"
  47. fi
  48. done
  49. }
  50. extract_check() {
  51. local repository="coreboot"
  52. local tarball
  53. project_extract_check "$project" "$@"
  54. crossgcc_tarballs "$@" | while read tarball
  55. do
  56. local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
  57. test ! -f "$tarball_install_path"
  58. done
  59. }
  60. update() {
  61. local arguments=$@
  62. local repository="coreboot"
  63. local tarball
  64. project_update_git $project $repository $arguments
  65. crossgcc_tarballs "$@" | while read tarball
  66. do
  67. local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" )
  68. local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
  69. local tarball_install_directory_path=$( dirname "$tarball_install_path" )
  70. if [ -f $tarball_sources_path ]
  71. then
  72. printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
  73. mkdir -p "$tarball_install_directory_path"
  74. file_verification_check "$tarball_sources_path"
  75. cp "$tarball_sources_path" "$tarball_install_path"
  76. fi
  77. done
  78. }
  79. update_check() {
  80. local repository="coreboot"
  81. local tarball
  82. project_update_check_git "$project" "$repository" "$@"
  83. crossgcc_tarballs "$@" | while read tarball
  84. do
  85. local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" "$@" )
  86. test ! -f "$tarball_sources_path"
  87. done
  88. }
  89. prefix() {
  90. local arch=$1
  91. local build_path=$( project_build_path "$project" "$@" )
  92. case $arch in
  93. "arm")
  94. printf '%s\n' "$build_path/bin/arm-eabi-"
  95. ;;
  96. esac
  97. }
  98. build() {
  99. local arch=$1
  100. local repository="coreboot"
  101. project_sources_directory_missing_empty_error "$project" "$repository" "$@"
  102. local sources_path=$( project_sources_path "$project" "$repository" "$@" )
  103. local build_path=$( project_build_path "$project" "$@" )
  104. if git_project_check "$repository"
  105. then
  106. git_project_checkout "$project" "$repository" "$@"
  107. fi
  108. mkdir -p "$build_path"
  109. make -C "$sources_path" CPUS="$TASKS" DEST="$build_path" "crossgcc-$arch"
  110. }
  111. build_check() {
  112. project_build_check "$project" "$@"
  113. }
  114. install() {
  115. project_install "$project" "$@"
  116. }
  117. install_check() {
  118. project_install_check "$project" "$@"
  119. }
  120. release() {
  121. local arguments=$@
  122. local repository="coreboot"
  123. local tarball
  124. project_release_install_archive "$project" "$TOOLS" "$@"
  125. project_release_sources_git "$project" "$repository" "$@"
  126. crossgcc_tarballs "$@" | while read tarball
  127. do
  128. local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
  129. local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" )
  130. local release_path=$( project_release_path "$project" "$SOURCES" "$@" )
  131. mkdir -p "$release_path"
  132. if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ]
  133. then
  134. printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})"
  135. cp "$tarball_install_path" "$tarball_release_path"
  136. file_verification_create "$tarball_release_path"
  137. fi
  138. done
  139. }
  140. release_check() {
  141. local repository="coreboot"
  142. local tarball
  143. project_release_install_archive_check "$project" "$TOOLS" "$@"
  144. project_release_check_sources_git "$project" "$repository" "$@"
  145. crossgcc_tarballs "$@" | while read tarball
  146. do
  147. local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" )
  148. test -f "$tarball_release_path"
  149. done
  150. }
  151. clean() {
  152. project_clean "$project" "$@"
  153. }