選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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