Perka

buildscript_cm9

Jun 17th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Common defines (Arch-dependent)
  4. case `uname -s` in
  5. Darwin)
  6. txtrst='\033[0m' # Color off
  7. txtred='\033[0;31m' # Red
  8. txtgrn='\033[0;32m' # Green
  9. txtylw='\033[0;33m' # Yellow
  10. txtblu='\033[0;34m' # Blue
  11. THREADS=`sysctl -an hw.logicalcpu`
  12. ;;
  13. *)
  14. txtrst='\e[0m' # Color off
  15. txtred='\e[0;31m' # Red
  16. txtgrn='\e[0;32m' # Green
  17. txtylw='\e[0;33m' # Yellow
  18. txtblu='\e[0;34m' # Blue
  19. THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
  20. ;;
  21. esac
  22.  
  23. echo -e "${txtgrn}##########################################"
  24. echo -e "${txtgrn}# #"
  25. echo -e "${txtgrn}# TEAMHACKSUNG ANDROID BUILDSCRIPT #"
  26. echo -e "${txtgrn}# visit us @ http://www.teamhacksung.org #"
  27. echo -e "${txtgrn}# #"
  28. echo -e "${txtgrn}##########################################"
  29. echo -e "\r\n ${txtrst}"
  30.  
  31. # Starting Timer
  32. START=$(date +%s)
  33. DEVICE="$1"
  34. ADDITIONAL="$2"
  35. #Moved to arch-dependent case above
  36. #THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
  37.  
  38. # Device specific settings
  39. case "$DEVICE" in
  40. clean)
  41. make clean
  42. rm -rf ./out/target/product
  43. exit
  44. ;;
  45. captivatemtd)
  46. board=aries
  47. lunch=cm_captivatemtd-userdebug
  48. brunch=cm_captivatemtd-userdebug
  49. ;;
  50. fascinatemtd)
  51. board=aries
  52. lunch=cm_fascinatemtd-userdebug
  53. brunch=cm_fascinatemtd-userdebug
  54. ;;
  55. galaxys2)
  56. board=smdk4210
  57. lunch=cm_galaxys2-userdebug
  58. brunch=cm_galaxys2-userdebug
  59. ;;
  60. i777)
  61. board=smdk4210
  62. lunch=cm_i777-userdebug
  63. brunch=cm_i777-userdebug
  64. ;;
  65. galaxysl)
  66. board=latona
  67. lunch=cm_galaxysl-userdebug
  68. brunch=cm_galaxysl-userdebug
  69. ;;
  70. galaxynote)
  71. board=smdk4210
  72. lunch=cm_galaxynote-userdebug
  73. brunch=cm_galaxynote-userdebug
  74. ;;
  75. galaxysmtd)
  76. board=aries
  77. lunch=cm_galaxysmtd-userdebug
  78. brunch=cm_galaxysmtd-userdebug
  79. ;;
  80. galaxysbmtd)
  81. board=aries
  82. lunch=cm_galaxysbmtd-userdebug
  83. brunch=cm_galaxysbmtd-userdebug
  84. ;;
  85. maguro)
  86. board=tuna
  87. lunch=cm_maguro-userdebug
  88. brunch=cm_maguro-userdebug
  89. ;;
  90. vibrantmtd)
  91. board=aries
  92. lunch=cm_vibrantmtd-userdebug
  93. brunch=cm_vibrantmtd-userdebug
  94. ;;
  95. *)
  96. echo -e "${txtred}Usage: $0 DEVICE ADDITIONAL"
  97. echo -e "Example: ./build.sh galaxys2"
  98. echo -e "Example: ./build.sh galaxys2 kernel"
  99. echo -e "Supported Devices: captivatemtd, epic, fascinate, galaxys2, i777, galaxynote, galaxysmtd, galaxysbmtd, maguro, vibrantmtd${txtrst}"
  100. exit 2
  101. ;;
  102. esac
  103.  
  104. # Check for Prebuilts
  105. echo -e "${txtylw}Checking for Prebuilts...${txtrst}"
  106. if [ ! -e vendor/cm/proprietary/RomManager.apk ] || [ ! -e vendor/cm/proprietary/Term.apk ] || [ ! -e vendor/cm/proprietary/lib/armeabi/libjackpal-androidterm3.so ]; then
  107. echo -e "${txtred}Prebuilts not found, downloading now...${txtrst}"
  108. cd vendor/cm
  109. ./get-prebuilts
  110. cd ../..
  111. else
  112. echo -e "${txtgrn}Prebuilts found.${txtrst}"
  113. fi
  114.  
  115. # Setting up Build Environment
  116. echo -e "${txtgrn}Setting up Build Environment...${txtrst}"
  117. . build/envsetup.sh
  118. lunch ${lunch}
  119.  
  120. # Start the Build
  121. case "$ADDITIONAL" in
  122. kernel)
  123. echo -e "${txtgrn}Building Kernel...${txtrst}"
  124. cd kernel/samsung/${board}
  125. ./build.sh "$DEVICE"
  126. cd ../../..
  127. echo -e "${txtgrn}Building Android...${txtrst}"
  128. brunch ${brunch}
  129. ;;
  130. *)
  131. echo -e "${txtgrn}Building Android...${txtrst}"
  132. brunch ${brunch}
  133. ;;
  134. esac
  135.  
  136. END=$(date +%s)
  137. ELAPSED=$((END - START))
  138. E_MIN=$((ELAPSED / 60))
  139. E_SEC=$((ELAPSED - E_MIN * 60))
  140. printf "Elapsed: "
  141. [ $E_MIN != 0 ] && printf "%d min(s) " $E_MIN
  142. printf "%d sec(s)\n" $E_SEC
Add Comment
Please, Sign In to add comment