source: trunk/build/lol-build @ 946

Last change on this file since 946 was 946, checked in by sam, 9 years ago

build: add debug information to lol-build output.

  • Property svn:executable set to *
File size: 5.4 KB
Line 
1#!/bin/sh
2
3#
4# Lol Engine build script
5# Usage:
6#   lol-build <action> [<platform>]
7#
8# Where <action> is one of:
9#  - bootstrap
10#  - configure
11#  - build
12#  - check
13#  - clean
14#
15# And <platform> is one of:
16#  - linux-i386
17#  - linux-amd64
18#  - ios-arm
19#  - android-arm
20#  - ps3-ppu
21#  - windows-i386
22#  - windows-amd64
23#
24
25set -e
26
27action="$1"
28platform="$2"
29
30top_srcdir=$(dirname "$0")/..
31cd $top_srcdir
32top_srcdir="`pwd`"
33
34bootstrap()
35{
36    cd $top_srcdir
37    case "$platform" in
38        ios-arm)
39            # No bootstrapping needed
40            ;;
41        android-arm)
42            # No bootstrapping needed
43            ;;
44        windows-i386|windows-amd64)
45            PATH="$PATH:./contrib/gtk-2.22.1/bin"
46            M4PATH="$M4PATH:./contrib/gtk-2.22.1/share/aclocal"
47            PATH="$PATH" M4PATH="$M4PATH" ./bootstrap
48            ;;
49        *)
50            ./bootstrap
51            ;;
52    esac
53}
54
55configure()
56{
57    cd $top_srcdir
58    case "$platform" in
59        windows-i386)
60            if test "x${SYSTEM}" = xMINGW32; then
61                :
62            elif i586-mingw32msvc-g++ --version >/dev/null 2>&1; then
63                HOSTFLAGS=--host=i586-mingw32msvc
64                BUILDFLAGS=--build=none
65            elif i686-w64-mingw32-g++ --version >/dev/null 2>&1; then
66                HOSTFLAGS=--host=i686-w64-mingw32
67                BUILDFLAGS=--build=none
68            else
69                echo "Error: could not find win32 compiler" >&2
70                false
71            fi
72            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/i686-w64-mingw32"
73            ;;
74        windows-amd64)
75            if test "x${SYSTEM}" = xMINGW64; then
76                :
77            elif x86_64-w64-mingw32-g++ --version >/dev/null 2>&1; then
78                HOSTFLAGS=--host=x86_64-w64-mingw32
79                BUILDFLAGS=--build=none
80            else
81                echo "Error: could not find win64 compiler" >&2
82                false
83            fi
84            LDFLAGS="$LDFLAGS -L$PWD/contrib/glew-1.7.0/lib/x86_64-w64-mingw32"
85            ;;
86    esac
87    case "$platform" in
88        ios-arm)
89            # No configuration needed
90            ;;
91        android-arm)
92            cd monsterz/android
93            android update project --path .
94            ;;
95        ps3-ppu)
96            ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
97            ;;
98        windows-i386|windows-amd64)
99            PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PWD/contrib/gtkglarea-2.0.1/lib/pkgconfig"
100            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-1.2.14/include"
101            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-image-1.2.10/include"
102            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/sdl-mixer-1.2.11/include"
103            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/glew-1.7.0/include -DGLEW_STATIC"
104            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/glib-2.0/include"
105            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/lib/gtk-2.0/include"
106            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/glib-2.0"
107            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gtk-2.0"
108            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/cairo"
109            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/pango-1.0"
110            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/gdk-pixbuf-2.0"
111            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtk-2.22.1/include/atk-1.0"
112            CPPFLAGS="$CPPFLAGS -I$PWD/contrib/gtkglarea-2.0.1/include"
113            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-1.2.14/lib"
114            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-image-1.2.10/lib"
115            LDFLAGS="$LDFLAGS -L$PWD/contrib/sdl-mixer-1.2.11/lib"
116            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/lib"
117            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtk-2.22.1/bin"
118            LDFLAGS="$LDFLAGS -L$PWD/contrib/gtkglarea-2.0.1/lib"
119            CPPFLAGS="$CPPFLAGS -mms-bitfields"
120            LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
121            GTK_LIBS="$GTK_LIBS -lgtkgl-2.0 -lopengl32 -lglew32 -lgdi32"
122            GTK_LIBS="$GTK_LIBS -lgtk-win32-2.0 -lgdk-win32-2.0"
123            GTK_LIBS="$GTK_LIBS -lglib-2.0 -lgthread-2.0 -lgobject-2.0"
124            LOL_LIBS="$LOL_LIBS -lSDL_image -lSDL_mixer -lSDLmain -lSDL -lopengl32 -lglew32"
125            PKG_CONFIG_PATH="$PKG_CONFIG_PATH" ./configure $HOSTFLAGS $BUILDFLAGS CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" GTK_LIBS="$GTK_LIBS" LOL_LIBS="$LOL_LIBS"
126            ;;
127        *)
128            ./configure
129            ;;
130    esac
131}
132
133build()
134{
135    cd $top_srcdir
136    case "$platform" in
137        ios-arm)
138            cd monsterz/ios
139            xcodebuild -configuration Release -sdk iphonesimulator4.3
140            ;;
141        android-arm)
142            cd monsterz/android
143            ndk-build
144            ant compile
145            ;;
146        *)
147            make -j6
148            ;;
149    esac
150}
151
152check()
153{
154    cd $top_srcdir
155    case "$platform" in
156        ios-arm)
157            ;;
158        android-arm)
159            ;;
160        ps3-ppu)
161            ;;
162        *)
163            make check
164            ;;
165    esac
166}
167
168clean()
169{
170    cd $top_srcdir
171    case "$platform" in
172        ios-arm)
173            cd monsterz/ios
174            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
175            ;;
176        android-arm)
177            cd monsterz/android
178            ndk-build distclean
179            ant clean
180            ;;
181        *)
182            make distclean
183            ;;
184    esac
185}
186
187echo "lol-build: executing action '$action' on platform '$platform'" >&2
188eval "$action"
189
Note: See TracBrowser for help on using the repository browser.