您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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