Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

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