Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

run-bitten.sh 5.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. #!/bin/sh
  2. tmpdir="$TMPDIR"
  3. if [ -z "${tmpdir}" ]; then tmpdir="$TEMP"; fi
  4. if [ -z "${tmpdir}" ]; then tmpdir="$TEMPDIR"; fi
  5. if [ -z "${tmpdir}" ]; then tmpdir="$TMP"; fi
  6. if [ -z "${tmpdir}" ]; then tmpdir="/tmp"; fi
  7. conffile="`mktemp -q "${tmpdir}/lol-bitten-XXXXXXXX" 2>/dev/null`"
  8. if [ "${conffile}" = "" ]; then
  9. conffile="`mktemp 2>/dev/null`"
  10. fi
  11. scriptfile=""
  12. builddir="${tmpdir}/lol-bitten-`whoami`"
  13. url="http://lolengine.net/builds"
  14. #
  15. # Utility functions
  16. #
  17. append() {
  18. echo "$*" >> "${conffile}"
  19. }
  20. cleanup() {
  21. rm -f "${conffile}" "${scriptfile}"
  22. rm -rf "${builddir}"
  23. }
  24. bailout() {
  25. cleanup
  26. # Exit gracefully
  27. exit 0
  28. }
  29. trap bailout EXIT HUP INT QUIT ABRT KILL ALRM TERM
  30. #
  31. # Fork if necessary
  32. #
  33. if [ "$1" = "--forked" ]; then
  34. shift
  35. scriptfile="$1"
  36. shift
  37. else
  38. cp "$0" "${conffile}"
  39. chmod +x "${conffile}"
  40. exec "${conffile}" --forked "${conffile}" "$@"
  41. exit 0
  42. fi
  43. #
  44. # Check for command line
  45. #
  46. if [ "$#" != 2 ]; then
  47. echo "Usage: run-bitten.sh <username> <password>"
  48. exit 1
  49. fi
  50. #
  51. # Clean up working directory
  52. #
  53. cleanup
  54. if [ -e "${builddir}" ]; then
  55. echo "Error: cannot get rid of ${builddir}"
  56. exit 1
  57. fi
  58. #
  59. # Operating system information
  60. #
  61. append "[os]"
  62. append "name = `uname -srmo 2>/dev/null || uname -srm`"
  63. append "version = 0"
  64. family="`uname -s | tr A-Z a-z`"
  65. case "$family" in
  66. mingw*) family="windows" ;;
  67. darwin*) family="osx" ;;
  68. esac
  69. append "family = $family"
  70. # This random token prevents HTTP conflicts when several instances
  71. # are run from the same machine.
  72. append "token = $$$RANDOM"
  73. append ""
  74. #
  75. # Hardware information
  76. #
  77. append "[machine]"
  78. name="`uname -n | tr A-Z a-z | sed 's/[.].*//'`"
  79. case "$name" in
  80. d*e*s*o*v*) name="putois" ;;
  81. esac
  82. append "name = $name"
  83. processor="`uname -m`"
  84. case "$processor" in
  85. x86_64) processor="amd64"
  86. if test "`getconf LONG_BIT 2>/dev/null`" = 32; then
  87. processor="i386"
  88. fi ;;
  89. i*86) processor="i386" ;;
  90. esac
  91. # Windows defines a lot of crazy shit, try to make sense of it
  92. case "$PROCESSOR_ARCHITECTURE" in
  93. amd64|AMD64) processor="amd64" ;;
  94. x86|X86) processor="i386" ;;
  95. esac
  96. case "$PROCESSOR_ARCHITEW6432" in
  97. amd64|AMD64) processor="amd64" ;;
  98. x86|X86) processor="i386" ;;
  99. esac
  100. append "processor = $processor"
  101. append ""
  102. #
  103. # Authentication information
  104. #
  105. append "[authentication]"
  106. append "username = $1"
  107. append "password = $2"
  108. append ""
  109. #
  110. # Visual Studio configuration
  111. #
  112. # FIXME: we also need to check for the Visual Studio SDK
  113. append "[msvc]"
  114. if [ -n "$VS100COMNTOOLS" ]; then
  115. append "version = 10"
  116. elif [ -n "$VS110COMNTOOLS" ]; then
  117. append "version = 11"
  118. elif [ -n "$VS90COMNTOOLS" ]; then
  119. append "version = 9"
  120. fi
  121. append ""
  122. #
  123. # iOS development kit
  124. #
  125. append "[ios]"
  126. if [ -d "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk" ]; then
  127. append "version = 6.1"
  128. fi
  129. append ""
  130. #
  131. # Xbox development kit
  132. #
  133. append "[xdk]"
  134. if [ -n "$XEDK" ]; then
  135. # FIXME: we don't know how to check the version
  136. append "version = 2.0.20675.0"
  137. fi
  138. append ""
  139. #
  140. # PS3 development kit
  141. #
  142. append "[ps3sdk]"
  143. # Try to "detect" the SNC compiler on Windows
  144. if [ -n "$SN_PS3_PATH" ]; then
  145. append "version = 410"
  146. fi
  147. # The setup is easier to detect on Linux
  148. if [ -f "$CELLSDK/version-SDK" ]; then
  149. append "version = $(cat "$CELLSDK/version-SDK")"
  150. fi
  151. append ""
  152. #
  153. # mingw32 / mingw-w64
  154. #
  155. append "[mingw64]"
  156. if x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
  157. append "version = $(x86_64-w64-mingw32-g++ --version | sed -ne 's/.*g++ *([^)]*) *//p')"
  158. fi
  159. append ""
  160. append "[mingw32]"
  161. if i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
  162. append "version = $(i686-w64-mingw32-g++ --version | sed -ne 's/.*g++ *([^)]*) *//p')"
  163. fi
  164. append ""
  165. #
  166. # Emscripten
  167. #
  168. append "[emscripten]"
  169. if em++ --version >/dev/null 2>&1; then
  170. append "version = $(em++ --version | sed -ne 's/.*emcc.* \([0-9.]\{1,\}\).*/\1/p')"
  171. fi
  172. append ""
  173. #
  174. # Android NDK
  175. #
  176. append "[ndk]"
  177. if [ "$family" != "windows" ]; then
  178. if [ -f "$ANDROID_NDK_ROOT/RELEASE.TXT" ]; then
  179. append "version = $(cat "$ANDROID_NDK_ROOT/RELEASE.TXT")"
  180. fi
  181. fi
  182. append ""
  183. #
  184. # Google NaCl SDK
  185. #
  186. append "[pepper]"
  187. if [ "$family" != "windows" ]; then
  188. if [ -f "$NACL_SDK_ROOT/README" ]; then
  189. pepper_version=$(sed -ne 's/Version: //p' "$NACL_SDK_ROOT/README")
  190. if [ "x$pepper_version" != "x" ]; then
  191. append "version = $pepper_version"
  192. fi
  193. fi
  194. fi
  195. append ""
  196. #
  197. # Raspberry Pi cross-compiler
  198. #
  199. append "[raspi]"
  200. if [ "$family" != "windows" ]; then
  201. if [ -d "$RASPI_SDK_ROOT/tools" ]; then
  202. append "version = 0"
  203. fi
  204. fi
  205. append ""
  206. #
  207. # Show what we just did here
  208. #
  209. cat "${conffile}"
  210. #
  211. # Fix system
  212. #
  213. if [ "$family" = "osx" ]; then
  214. # The version of Subversion shipped by Apple is antique; try to
  215. # use the one in /usr/local/bin instead.
  216. PATH="/usr/local/bin:$PATH"
  217. export PATH
  218. # HACK: the version of llvm-g++ shipped by Apple has an insane
  219. # memory leak; use clang++ instead.
  220. CC="clang"
  221. export CC
  222. CXX="clang++"
  223. export CXX
  224. fi
  225. #
  226. # Launch everything
  227. #
  228. while : ; do
  229. bitten-slave "$url" \
  230. -f "${conffile}" \
  231. --name "$name" \
  232. --work-dir="${builddir}"
  233. rm -rf "${builddir}"
  234. sleep 10
  235. done
  236. exit 0