Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

213 righe
6.3 KiB

  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-amd64)
  173. # No support for Wine64 yet
  174. ;;
  175. *)
  176. make check
  177. ;;
  178. esac
  179. }
  180. clean()
  181. {
  182. cd $top_srcdir
  183. case "$platform" in
  184. ios-arm)
  185. cd monsterz/ios
  186. xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
  187. ;;
  188. android-arm)
  189. cd monsterz/android
  190. ndk-build distclean
  191. ant clean
  192. ;;
  193. *)
  194. make distclean
  195. ;;
  196. esac
  197. }
  198. __init__
  199. echo "lol-build: executing action '$action' on platform '$platform'" >&2
  200. eval "$action"