No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

lol-build 6.2 KiB

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