Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

198 рядки
5.7 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. PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
  71. LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/i686-w64-mingw32"
  72. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/i686-w64-mingw32"
  73. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/i686-w64-mingw32"
  74. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/i686-w64-mingw32"
  75. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
  76. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
  77. LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
  78. ;;
  79. windows-amd64)
  80. if test "x${MSYSTEM}" = xMINGW64; then
  81. :
  82. elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
  83. HOSTFLAGS=--host=x86_64-w64-mingw32
  84. BUILDFLAGS=--build=none
  85. else
  86. echo "Error: could not find win64 compiler" >&2
  87. false
  88. fi
  89. LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
  90. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib/x86_64-w64-mingw32"
  91. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib/x86_64-w64-mingw32"
  92. LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib/x86_64-w64-mingw32"
  93. ;;
  94. esac
  95. case "$platform" in
  96. ios-arm)
  97. # No configuration needed
  98. ;;
  99. android-arm)
  100. cd monsterz/android
  101. android update project --path .
  102. ;;
  103. ps3-ppu)
  104. PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
  105. ;;
  106. windows-i386|windows-amd64)
  107. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
  108. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
  109. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
  110. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include -DGLEW_STATIC"
  111. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
  112. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
  113. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
  114. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
  115. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
  116. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
  117. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
  118. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
  119. CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
  120. CPPFLAGS="$CPPFLAGS -mms-bitfields"
  121. LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
  122. GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
  123. GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
  124. GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
  125. PATH="$PATH" PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS"
  126. ;;
  127. *)
  128. PATH="$PATH" ./configure
  129. ;;
  130. esac
  131. }
  132. build()
  133. {
  134. cd $top_srcdir
  135. case "$platform" in
  136. ios-arm)
  137. cd monsterz/ios
  138. xcodebuild -configuration Release -sdk iphonesimulator4.3
  139. ;;
  140. android-arm)
  141. cd monsterz/android
  142. ndk-build
  143. ant compile
  144. ;;
  145. *)
  146. make -j6
  147. ;;
  148. esac
  149. }
  150. check()
  151. {
  152. cd $top_srcdir
  153. case "$platform" in
  154. ios-arm)
  155. ;;
  156. android-arm)
  157. ;;
  158. ps3-ppu)
  159. ;;
  160. *)
  161. make check
  162. ;;
  163. esac
  164. }
  165. clean()
  166. {
  167. cd $top_srcdir
  168. case "$platform" in
  169. ios-arm)
  170. cd monsterz/ios
  171. xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
  172. ;;
  173. android-arm)
  174. cd monsterz/android
  175. ndk-build distclean
  176. ant clean
  177. ;;
  178. *)
  179. make distclean
  180. ;;
  181. esac
  182. }
  183. __init__
  184. echo "lol-build: executing action '$action' on platform '$platform'" >&2
  185. eval "$action"