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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. #!/bin/sh
  2. #
  3. # Lol Engine build script
  4. # Usage:
  5. # lol-build <action> [<platform>]
  6. #
  7. # Where <action> is one of:
  8. # - bootstrap
  9. # - configure
  10. # - build
  11. # - check
  12. # - clean
  13. #
  14. # And <platform> is one of:
  15. # - linux-i386
  16. # - linux-amd64
  17. # - nacl-i386
  18. # - nacl-amd64
  19. # - ios-arm
  20. # - osx-amd64
  21. # - android-arm
  22. # - ps3-ppu
  23. # - win*-i386
  24. # - win*-amd64
  25. #
  26. set -e
  27. action="$1"
  28. platform="$2"
  29. __init__()
  30. {
  31. top_srcdir="$(dirname "$0")/.."
  32. cd "$top_srcdir"
  33. top_srcdir="`pwd`"
  34. case "${MSYSTEM}" in
  35. MINGW32|MINGW64)
  36. PATH="$PATH:./contrib/gtk-2.22.1/bin"
  37. M4PATH="$M4PATH:./contrib/gtk-2.22.1/share/aclocal"
  38. ;;
  39. esac
  40. }
  41. bootstrap()
  42. {
  43. cd "$top_srcdir"
  44. case "$platform" in
  45. ios-arm)
  46. # No bootstrapping needed
  47. ;;
  48. android-arm)
  49. # No bootstrapping needed
  50. ;;
  51. *)
  52. PATH="$PATH" M4PATH="$M4PATH" ./bootstrap
  53. ;;
  54. esac
  55. }
  56. configure()
  57. {
  58. cd "$top_srcdir"
  59. case "$platform" in
  60. win*-i386)
  61. if test "x${MSYSTEM}" = xMINGW32; then
  62. :
  63. elif i586-mingw32msvc-g++ --version >/dev/null 2>&1; then
  64. HOSTFLAGS=--host=i586-mingw32msvc
  65. BUILDFLAGS=--build=none
  66. elif i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
  67. HOSTFLAGS=--host=i686-w64-mingw32
  68. BUILDFLAGS=--build=none
  69. else
  70. echo "Error: could not find win32 compiler" >&2
  71. false
  72. fi
  73. if test "x${MSYSTEM}" = xMINGW64; then
  74. # If using mingw64, we're not really cross-compiling
  75. BUILDFLAGS=
  76. fi
  77. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
  78. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/libcaca-0.99.beta18/lib/pkgconfig"
  79. LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/i686-w64-mingw32"
  80. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.15/lib/i686-w64-mingw32"
  81. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/i686-w64-mingw32"
  82. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/i686-w64-mingw32"
  83. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
  84. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
  85. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
  86. LDFLAGS="$LDFLAGS -L$PWD/contrib/libcaca-0.99.beta18/lib/i686-w64-mingw32"
  87. ;;
  88. win*-amd64)
  89. if test "x${MSYSTEM}" = xMINGW64; then
  90. :
  91. elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
  92. HOSTFLAGS=--host=x86_64-w64-mingw32
  93. BUILDFLAGS=--build=none
  94. else
  95. echo "Error: could not find win64 compiler" >&2
  96. false
  97. fi
  98. if test "x${MSYSTEM}" = xMINGW32; then
  99. # If using mingw32, we're not really cross-compiling
  100. BUILDFLAGS=
  101. fi
  102. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
  103. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/libcaca-0.99.beta18/lib/pkgconfig"
  104. LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
  105. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.15/lib/x86_64-w64-mingw32"
  106. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/x86_64-w64-mingw32"
  107. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/x86_64-w64-mingw32"
  108. LDFLAGS="$LDFLAGS -L$PWD/contrib/libcaca-0.99.beta18/lib/x86_64-w64-mingw32"
  109. ;;
  110. *-i386)
  111. # Ensure we're _really_ on i386
  112. CXXFLAGS="$CXXFLAGS -m32"
  113. ;;
  114. *-amd64)
  115. # Ensure we're _really_ on amd64
  116. CXXFLAGS="$CXXFLAGS -m64"
  117. ;;
  118. esac
  119. case "$platform" in
  120. ios-arm)
  121. # No configuration needed
  122. ;;
  123. android-arm)
  124. cd monsterz/android
  125. android update project --path .
  126. ;;
  127. nacl-i386)
  128. ./configure CXX=i686-nacl-g++ CC=i686-nacl-gcc ac_cv_exeext=.32.nexe --host=i386 LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp -u _ZN2pp12CreateModuleEv"
  129. ;;
  130. nacl-amd64)
  131. ./configure CXX=x86_64-nacl-g++ CC=x86_64-nacl-gcc ac_cv_exeext=.64.nexe --host=x86_64 LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp -u _ZN2pp12CreateModuleEv"
  132. ;;
  133. ps3-ppu)
  134. PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=powerpc
  135. ;;
  136. win*-i386|win*-amd64)
  137. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.15/include"
  138. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
  139. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
  140. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include/GL -DGLEW_STATIC"
  141. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
  142. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
  143. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
  144. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
  145. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
  146. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
  147. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
  148. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
  149. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
  150. CPPFLAGS="$CPPFLAGS -mms-bitfields"
  151. LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
  152. GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
  153. GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
  154. GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
  155. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/libcaca-0.99.beta18/include -DCACA_STATIC"
  156. PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
  157. ;;
  158. *)
  159. PATH="$PATH" ./configure CFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS"
  160. ;;
  161. esac
  162. }
  163. build()
  164. {
  165. cd "$top_srcdir"
  166. case "$platform" in
  167. ios-arm)
  168. cd monsterz/ios
  169. xcodebuild -configuration Release -sdk iphonesimulator4.3
  170. ;;
  171. android-arm)
  172. cd monsterz/android
  173. ndk-build
  174. ant compile
  175. ;;
  176. *)
  177. make -j6
  178. ;;
  179. esac
  180. }
  181. check()
  182. {
  183. cd "$top_srcdir"
  184. case "$platform" in
  185. ios-arm)
  186. ;;
  187. android-arm)
  188. ;;
  189. ps3-ppu)
  190. ;;
  191. nacl-*)
  192. ;;
  193. win*-i386)
  194. # If neither $MSYSTEM or $DISPLAY are set, and xvfb-run
  195. # exists, use it to run the test suite.
  196. if test "x${MSYSTEM}${DISPLAY}" = x \
  197. && xvfb-run --help 2>&1 >/dev/null; then
  198. xvfb-run make check
  199. else
  200. make check
  201. fi
  202. ;;
  203. win*-amd64)
  204. # No support for Wine64 yet
  205. ;;
  206. *)
  207. make check
  208. ;;
  209. esac
  210. }
  211. clean()
  212. {
  213. cd "$top_srcdir"
  214. case "$platform" in
  215. ios-arm)
  216. cd monsterz/ios
  217. xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
  218. ;;
  219. android-arm)
  220. cd monsterz/android
  221. ndk-build distclean
  222. ant clean
  223. ;;
  224. *)
  225. make distclean
  226. ;;
  227. esac
  228. }
  229. __init__
  230. echo "lol-build: executing action '$action' on platform '$platform'" >&2
  231. eval "$action"