Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

lol-build 7.0 KiB

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