You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

79 lines
1.8 KiB

  1. #!/bin/bash
  2. # Copyright (C) 2019 Denis 'GNUtoo' Carikli' <GNUtoo@cyberdimension.org>
  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. set -e
  17. supported_machines=" \
  18. espresso3g \
  19. espressowifi \
  20. i9100 \
  21. i9300 \
  22. i9305 \
  23. maguro \
  24. n5100 \
  25. n5110 \
  26. n7000 \
  27. n7100 \
  28. "
  29. usage()
  30. {
  31. printf "%s [" "$0"
  32. for machine in ${supported_machines} ; do
  33. printf "${machine}|"
  34. done
  35. printf "\b]\n"
  36. printf "%s all # build all machines\n" "$0"
  37. exit 1
  38. }
  39. build()
  40. {
  41. machine="$1"
  42. parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
  43. log="logs/build_${machine}_$(date '+%s').log"
  44. echo "starting to building for ${machine}: ${log}"
  45. source build/envsetup.sh
  46. lunch "replicant_${machine}-userdebug"
  47. time make -j$parallel_tasks bacon 2>&1 | tee "${log}"
  48. vendor/replicant/sign-build "${machine}" | tee -a "${log}"
  49. echo "${machine} DONE: ${log}"
  50. }
  51. if [ $# -ne 1 ] ; then
  52. usage
  53. fi
  54. if [ "$1" = "all" ] ; then
  55. for machine in ${supported_machines} ; do
  56. build "${machine}"
  57. done
  58. else
  59. found=0
  60. for machine in ${supported_machines} ; do
  61. if [ "${machine}" = "$1" ] ; then
  62. found=1
  63. fi
  64. done
  65. if [ ${found} -eq 0 ] ; then
  66. printf "machine %s not supported\n" "$1"
  67. usage
  68. fi
  69. build "$1"
  70. fi