Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

209 lignes
6.1 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. # - 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. LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
  98. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/x86_64-w64-mingw32"
  99. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/x86_64-w64-mingw32"
  100. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/x86_64-w64-mingw32"
  101. ;;
  102. esac
  103. case "$platform" in
  104. ios-arm)
  105. # No configuration needed
  106. ;;
  107. android-arm)
  108. cd monsterz/android
  109. android update project --path .
  110. ;;
  111. ps3-ppu)
  112. PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
  113. ;;
  114. windows-i386|windows-amd64)
  115. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
  116. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
  117. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
  118. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include -DGLEW_STATIC"
  119. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
  120. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
  121. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
  122. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
  123. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
  124. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
  125. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
  126. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
  127. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
  128. CPPFLAGS="$CPPFLAGS -mms-bitfields"
  129. LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
  130. GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
  131. GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
  132. GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
  133. PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
  134. ;;
  135. *)
  136. PATH="$PATH" ./configure
  137. ;;
  138. esac
  139. }
  140. build()
  141. {
  142. cd $top_srcdir
  143. case "$platform" in
  144. ios-arm)
  145. cd monsterz/ios
  146. xcodebuild -configuration Release -sdk iphonesimulator4.3
  147. ;;
  148. android-arm)
  149. cd monsterz/android
  150. ndk-build
  151. ant compile
  152. ;;
  153. *)
  154. make -j6
  155. ;;
  156. esac
  157. }
  158. check()
  159. {
  160. cd $top_srcdir
  161. case "$platform" in
  162. ios-arm)
  163. ;;
  164. android-arm)
  165. ;;
  166. ps3-ppu)
  167. ;;
  168. windows-amd64)
  169. # No support for Wine64 yet
  170. ;;
  171. *)
  172. make check
  173. ;;
  174. esac
  175. }
  176. clean()
  177. {
  178. cd $top_srcdir
  179. case "$platform" in
  180. ios-arm)
  181. cd monsterz/ios
  182. xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
  183. ;;
  184. android-arm)
  185. cd monsterz/android
  186. ndk-build distclean
  187. ant clean
  188. ;;
  189. *)
  190. make distclean
  191. ;;
  192. esac
  193. }
  194. __init__
  195. echo "lol-build: executing action '$action' on platform '$platform'" >&2
  196. eval "$action"