source: trunk/build/lol-build @ 1084

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

nacl: the Mandelbrot zoomer is starting to work on NaCl.

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